diff options
author | Cary Coutant <ccoutant@google.com> | 2015-02-16 22:15:12 -0800 |
---|---|---|
committer | Cary Coutant <ccoutant@google.com> | 2015-02-16 22:15:12 -0800 |
commit | e9c1bdad269c0c3352eebcc9481ed65144001b0b (patch) | |
tree | 0dabc7d3f20256f18f091b51f72de9b4c4f421bb /gold/testsuite | |
parent | 0ed4b0bf3d2ca248778a2ffbcb2c5cafbfdd64dc (diff) | |
download | gdb-e9c1bdad269c0c3352eebcc9481ed65144001b0b.zip gdb-e9c1bdad269c0c3352eebcc9481ed65144001b0b.tar.gz gdb-e9c1bdad269c0c3352eebcc9481ed65144001b0b.tar.bz2 |
Fix --dynamic-list so that symbols not in the list are still exported.
In PR 13577, the complaint was that -Bsymbolic was overriding the binding
behavior for symbols listed in the --dynamic-list by setting the DT_SYMBOLIC
tag in the dynamic table. In reading the Gnu ld manual, I decided that
--dynamic-list should be mutually exclusive of -Bsymbolic, and modified
gold so that --dynamic-list would treat symbols listed as preemptible,
and all other symbols as internally bound. I was wrong.
PR 16992 shows that with --dynamic-list (and not -Bsymbolic), a symbol
not listed in the dynamic list is being internally bound within the
shared library, but because it's still in the dynamic symbol table, we
expose it to a COPY relocation, and things go really bad from there.
(I can reproduce the same failure, simply by turning on -Bsymbolic-functions
with the Gnu linker. Even though the symbol is bound internally, it's
still exported to the dynamic symbol table, and is exposed to a COPY
relocation.)
I've backed out part of the fix for PR 13577, and -Bsymbolic (or
-Bsymbolic-functions) can now be used with --dynamic-list, but if the
two are used together, we do not set DT_SYMBOLIC or DF_SYMBOLIC
(this matches Gnu ld behavior). We now treat symbols listed in the
dynamic list as premptible, but we do not automatically treat symbols
not listed there as non-premptible.
gold/
PR gold/13577
PR gold/16992
* layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
DF_SYMBOLIC if --dynamic-list option is used.
* options.cc (General_options::finalize): --dynamic-list is not
mutually exclusive with -Bsymbolic.
* symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
listed in --dynamic-list.
* testsuite/Makefile.am (dynamic_list_lib2.so): Add
-Bsymbolic-functions.
* testsuite/Makefile.in: Regenerate.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 2 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index f767c21..7b73f9d 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -1518,7 +1518,7 @@ dynamic_list_lib1.o: dynamic_list_lib1.cc $(CXXCOMPILE) -c -fpic -o $@ $< dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t - $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o + $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o dynamic_list_lib2.o: dynamic_list_lib2.cc $(CXXCOMPILE) -c -fpic -o $@ $< diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 217e472..b4ae3fd 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -5319,7 +5319,7 @@ uninstall-am: @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t -@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o @GCC_TRUE@@NATIVE_LINKER_TRUE@dynamic_list_lib2.o: dynamic_list_lib2.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< |