gold patch committed: Improve special symbol version handling
Ian Lance Taylor
iant@google.com
Tue Mar 17 07:13:00 GMT 2009
gold uses separate routines to resolve normal symbols and symbols which
are defined by the linker itself. The latter routine didn't do the full
version handling of the former. This caused it to do the wrong thing in
the case where a special symbol was seen in an object file with no
version, and was then later defined by the linker with a version. This
is not a normal case, but it will happen when using a linker script
which uses "global: *;". I committed this patch to improve the
situation. In the long run the distinction between the two types of
symbols may be a mistake, and it may be appropriate to share more of the
resolution routines. This would have to be done without slowing down
the normal case, of course. I took a step toward that by having both
version call a new define_default_version function.
This fixes a problem on SPARC GNU/Linux, in which the
_GLOBAL_OFFSET_TABLE_ symbol can be referenced by crti.o before any .got
section is seen. This showed up in ver_test_8 in the gold testsuite.
Ian
2009-03-17 Ian Lance Taylor <iant@google.com>
* symtab.cc (Symbol_table::define_default_version): New function,
broken out of add_from_object.
(Symbol_table::add_from_object): Call define_default_version.
(Symbol_table::define_special_symbol): Add resolve_oldsym
parameter. Change all callers. If the version for a symbol comes
from a version script, resolve it with the symbol with the same
name with no version. Also add the symbol without a version if
appropriate.
(do_define_in_output_data): If resolving with oldsym, don't delete
sym.
(do_define_in_output_segment): Likewise.
(do_define_as_constant): Likewise.
* symtab.h (class Symbol_table): Update declarations.
More information about the Binutils
mailing list