[PATCH v2 2/2] ld: Support the -exclude-symbols option via COFF def files, with the EXCLUDE_SYMBOLS keyword
Jan Beulich
jbeulich@suse.com
Mon Jul 25 09:56:14 GMT 2022
More information about the Binutils mailing list
Mon Jul 25 09:56:14 GMT 2022
- Previous message (by thread): [PATCH v2 2/2] ld: Support the -exclude-symbols option via COFF def files, with the EXCLUDE_SYMBOLS keyword
- Next message (by thread): [PATCH v2 2/2] ld: Support the -exclude-symbols option via COFF def files, with the EXCLUDE_SYMBOLS keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 23.07.2022 00:02, Martin Storsjo wrote:
> This was requested in review.
> ---
> WIP: The testcase doesn't run successfully. How do I pass the
> full path to exclude-symbols-def.def as parameter to the ld command?
Without having tried but merely deriving from gas tests perhaps
${srcdir}/${subdir}/exclude-symbols-def.def. A few other ld test
cases look to have such or similar uses as well.
Jan
> ---
> ld/deffilep.y | 3 +++
> ld/testsuite/ld-pe/exclude-symbols-def.d | 10 ++++++++++
> ld/testsuite/ld-pe/exclude-symbols-def.def | 4 ++++
> ld/testsuite/ld-pe/exclude-symbols-def.s | 11 +++++++++++
> ld/testsuite/ld-pe/pe.exp | 1 +
> 5 files changed, 29 insertions(+)
> create mode 100644 ld/testsuite/ld-pe/exclude-symbols-def.d
> create mode 100644 ld/testsuite/ld-pe/exclude-symbols-def.def
> create mode 100644 ld/testsuite/ld-pe/exclude-symbols-def.s
>
> diff --git a/ld/deffilep.y b/ld/deffilep.y
> index 126f33a1352..e8d31c6dae7 100644
> --- a/ld/deffilep.y
> +++ b/ld/deffilep.y
> @@ -249,6 +249,7 @@ keyword_as_name: BASE { $$ = "BASE"; }
> | DATAL { $$ = "data"; }
> | DESCRIPTION { $$ = "DESCRIPTION"; }
> | DIRECTIVE { $$ = "DIRECTIVE"; }
> + | EXCLUDE_SYMBOLS { $$ = "EXCLUDE_SYMBOLS"; }
> | EXECUTE { $$ = "EXECUTE"; }
> | EXPORTS { $$ = "EXPORTS"; }
> | HEAPSIZE { $$ = "HEAPSIZE"; }
> @@ -337,6 +338,7 @@ anylang_id: ID { $$ = $1; }
>
> symbol_list:
> anylang_id { def_exclude_symbols ($1); }
> + | symbol_list anylang_id { def_exclude_symbols ($2); }
> | symbol_list ',' anylang_id { def_exclude_symbols ($3); }
> ;
>
> @@ -1355,6 +1357,7 @@ tokens[] =
> { "data", DATAL },
> { "DESCRIPTION", DESCRIPTION },
> { "DIRECTIVE", DIRECTIVE },
> + { "EXCLUDE_SYMBOLS", EXCLUDE_SYMBOLS },
> { "EXECUTE", EXECUTE },
> { "EXPORTS", EXPORTS },
> { "HEAPSIZE", HEAPSIZE },
> diff --git a/ld/testsuite/ld-pe/exclude-symbols-def.d b/ld/testsuite/ld-pe/exclude-symbols-def.d
> new file mode 100644
> index 00000000000..4582d03c670
> --- /dev/null
> +++ b/ld/testsuite/ld-pe/exclude-symbols-def.d
> @@ -0,0 +1,10 @@
> +#source: exclude-symbols-def.s
> +#target: i*86-*-cygwin* i*86-*-pe i*86-*-mingw*
> +#ld: -shared exclude-symbols-def.def
> +#objdump: -p
> +
> +#...
> +.*\[[ ]*0\] sym1
> +.*\[[ ]*1\] sym3
> +.*\[[ ]*2\] sym5
> +#pass
> diff --git a/ld/testsuite/ld-pe/exclude-symbols-def.def b/ld/testsuite/ld-pe/exclude-symbols-def.def
> new file mode 100644
> index 00000000000..c0cee7b1e70
> --- /dev/null
> +++ b/ld/testsuite/ld-pe/exclude-symbols-def.def
> @@ -0,0 +1,4 @@
> +LIBRARY exclude-symbols-def.dll
> +EXCLUDE_SYMBOLS
> +sym2
> +sym4
> diff --git a/ld/testsuite/ld-pe/exclude-symbols-def.s b/ld/testsuite/ld-pe/exclude-symbols-def.s
> new file mode 100644
> index 00000000000..fd533bb44c9
> --- /dev/null
> +++ b/ld/testsuite/ld-pe/exclude-symbols-def.s
> @@ -0,0 +1,11 @@
> +.global _sym1
> +.global _sym2
> +.global _sym3
> +.global _sym4
> +.global _sym5
> +_sym1:
> +_sym2:
> +_sym3:
> +_sym4:
> +_sym5:
> + ret
> diff --git a/ld/testsuite/ld-pe/pe.exp b/ld/testsuite/ld-pe/pe.exp
> index 8dfdd0cc16e..45b16f843ac 100644
> --- a/ld/testsuite/ld-pe/pe.exp
> +++ b/ld/testsuite/ld-pe/pe.exp
> @@ -126,3 +126,4 @@ setup_xfail mcore-*-pe
> run_ld_link_tests $foreign_sym_test
>
> run_dump_test "exclude-symbols-embedded"
> +run_dump_test "exclude-symbols-def"
- Previous message (by thread): [PATCH v2 2/2] ld: Support the -exclude-symbols option via COFF def files, with the EXCLUDE_SYMBOLS keyword
- Next message (by thread): [PATCH v2 2/2] ld: Support the -exclude-symbols option via COFF def files, with the EXCLUDE_SYMBOLS keyword
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list