One and a half bugs plus some hacks

Ian Lance Taylor iant@google.com
Thu May 8 18:50:00 GMT 2008


"Andreas Hartmetz" <ahartmetz@gmail.com> writes:

> 2008/5/7 Ian Lance Taylor <iant@google.com>:
>> "Andreas Hartmetz" <ahartmetz@gmail.com> writes:
>>
>>
>> > -gold aborts with an error message about "undefined symbol version
>>  > OPENSSL_0.9.8" (paraphrased) in one instance when linking against
>>  > openssl.
>>
>>  This one I don't understand.  Can you give me some more details about
>>  what is happening?

Andreas provided some additional details off-list--thanks!  I believe
the problem is that gold was not properly overriding the version when
it saw a normal definition of a symbol after seeing a definition of
the symbol in a shared library with a non-hidden version.

In the case at hand I suspect this is happening due to an over-zealous
a version script, which does "global: *;".  This is not a good idea--a
version script should control symbol visibility, which means that it
should explicitly list the global symbols and not just make all
symbols global.  However, that is a valid version script, and in fact
gold did not handle it correctly.  Most of this patch is actually
making that work.

Once that worked, I could recreate the problem using gold.  The few
lines in resolve.cc fix it.

Andreas, as far as I know, at this point all the problem with building
KDE are fixed.  Please let me know if there are problems.  And thanks
for reporting them.

Ian


	* symtab.c (Symbol::init_base_output_data): Add version
	parameter.  Change all callers.
	(Symbol::init_base_output_segment): Likewise.
	(Symbol::init_base_constant): Likewise.
	(Symbol::init_base_undefined): Likewise.
	(Sized_symbol::init_output_data): Likewise.
	(Sized_symbol::init_output_segment): Likewise.
	(Sized_symbol::init_constant): Likewise.
	(Sized_symbol::init_undefined): Likewise.
	(Symbol_table::do_define_in_output_data): If the new symbol has a
	version, mark it as the default.
	(Symbol_table::do_define_in_output_segment): Likewise.
	(Symbol_table::do_define_as_constant): Likewise.
	* symtab.h (class Symbol): Update declarations.
	(class Sized_symbol): Likewise.
	* resolve.cc (Symbol::override_version): New function.
	(Symbol::override_base: Call override_version.
	(Symbol::override_base_with_special): Likewise.
	* testsuite/ver_script_8.script: New file.
	* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
	(ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
	(ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
	(ver_test_8_1.so, ver_test_8_2.so): New targets.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-patch
Size: 17197 bytes
Desc: Fix overriding symbol with a empty version
URL: <https://sourceware.org/pipermail/binutils/attachments/20080508/c81fb4a8/attachment.bin>


More information about the Binutils mailing list