diff options
author | Fangrui Song <maskray@google.com> | 2021-05-11 23:10:45 -0700 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-05-13 12:53:49 +0930 |
commit | cf893b0ef7482ec11df3787772f35e820ef2592a (patch) | |
tree | 77832443e8f794f951b402a1824b2151d107f999 /ld | |
parent | 4863cddb5079ce34007c5bebc0315b8eddb9ef6d (diff) | |
download | binutils-cf893b0ef7482ec11df3787772f35e820ef2592a.zip binutils-cf893b0ef7482ec11df3787772f35e820ef2592a.tar.gz binutils-cf893b0ef7482ec11df3787772f35e820ef2592a.tar.bz2 |
ld: Add -Bno-symbolic
PR 27834
* ldlex.h (enum option_values): Add OPTION_NO_SYMBOLIC.
* lexsup.c (ld_options): Add -Bno-symbolic.
(parse_args): Handle -Bno-symbolic.
* ld.texi: Document -Bno-symbolic.
* NEWS: Mention -Bno-symbolic.
* testsuite/ld-elf/shared.exp: Add a test.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/ChangeLog | 10 | ||||
-rw-r--r-- | ld/NEWS | 2 | ||||
-rw-r--r-- | ld/ld.texi | 5 | ||||
-rw-r--r-- | ld/ldlex.h | 1 | ||||
-rw-r--r-- | ld/lexsup.c | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/shared.exp | 7 |
6 files changed, 30 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 77b10eb..e9aae88 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2021-05-13 Fangrui Song <maskray@google.com> + + PR 27834 + * ldlex.h (enum option_values): Add OPTION_NO_SYMBOLIC. + * lexsup.c (ld_options): Add -Bno-symbolic. + (parse_args): Handle -Bno-symbolic. + * ld.texi: Document -Bno-symbolic. + * NEWS: Mention -Bno-symbolic. + * testsuite/ld-elf/shared.exp: Add a test. + 2021-05-12 Richard Earnshaw <rearnsha@arm.com> * testsuite/ld-arm/arm-elf.exp (farcall test for v8-m.mainline): @@ -8,6 +8,8 @@ * Add -z start-stop-gc to disable special treatment of __start_*/__stop_* references when --gc-sections. +* Add -Bno-symbolic to cancel -Bsymbolic and -Bsymbolic-functions. + Changes in 2.36: * Add libdep plugin, for linking dependencies of static libraries that @@ -1633,6 +1633,11 @@ symbols to the definition within the shared library, if any. This option is only meaningful on ELF platforms which support shared libraries. +@kindex -Bno-symbolic +@item -Bno-symbolic +This option can cancel previously specified @samp{-Bsymbolic} and +@samp{-Bsymbolic-functions}. + @kindex --dynamic-list=@var{dynamic-list-file} @item --dynamic-list=@var{dynamic-list-file} Specify the name of a dynamic list file to the linker. This is @@ -54,6 +54,7 @@ enum option_values OPTION_OFORMAT, OPTION_RELAX, OPTION_NO_RELAX, + OPTION_NO_SYMBOLIC, OPTION_RETAIN_SYMBOLS_FILE, OPTION_RPATH, OPTION_RPATH_LINK, diff --git a/ld/lexsup.c b/ld/lexsup.c index f6b6b2e..dcb2d9d 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -302,6 +302,8 @@ static const struct ld_option ld_options[] = '\0', NULL, NULL, ONE_DASH }, { {"static", no_argument, NULL, OPTION_NON_SHARED}, '\0', NULL, NULL, ONE_DASH }, + { {"Bno-symbolic", no_argument, NULL, OPTION_NO_SYMBOLIC}, + '\0', NULL, N_("Don't bind global references locally"), ONE_DASH }, { {"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC}, '\0', NULL, N_("Bind global references locally"), ONE_DASH }, { {"Bsymbolic-functions", no_argument, NULL, OPTION_SYMBOLIC_FUNCTIONS}, @@ -1301,6 +1303,9 @@ parse_args (unsigned argc, char **argv) case OPTION_STATS: config.stats = true; break; + case OPTION_NO_SYMBOLIC: + opt_symbolic = symbolic_unset; + break; case OPTION_SYMBOLIC: opt_symbolic = symbolic; break; diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 6bf4978..d00358e 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -618,6 +618,10 @@ set build_tests { {"Build libdl2k.so with --export-dynamic-symbol-list=dl2.list and -Bsymbolic" "-shared -Wl,--export-dynamic-symbol-list=dl2.list,-Bsymbolic" "-fPIC" {dl2.c dl2xxx.c} {} "libdl2k.so"} + # Check that -Bno-symbolic cancels -Bsymbolic. + {"Build libdl2l.so with -Bsymbolic -Bno-symbolic and --export-dynamic-symbol=foo" + "-shared -Wl,-Bsymbolic,-Bno-symbolic,--export-dynamic-symbol=foo" "-fPIC" + {dl2.c dl2xxx.c} {} "libdl2l.so"} {"Build libdl4a.so with --dynamic-list=dl4.list" "-shared -Wl,--dynamic-list=dl4.list" "-fPIC" {dl4.c dl4xxx.c} {} "libdl4a.so"} @@ -1028,6 +1032,9 @@ set run_tests [list \ [list "Run with libdl2k.so" \ "-Wl,--no-as-needed tmpdir/libdl2k.so" "" \ {dl2main.c} "dl2k" "dl2a.out" ] \ + [list "Run with libdl2l.so" \ + "-Wl,--no-as-needed tmpdir/libdl2l.so" "" \ + {dl2main.c} "dl2l" "dl2b.out" ] \ [list "Run with libdl4a.so" \ "-Wl,--no-as-needed tmpdir/libdl4a.so" "" \ {dl4main.c} "dl4a" "dl4a.out" "-fPIC"] \ |