This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA][Bug gold/10471] hidden symbol gets added to dynamic symbol table


The attached patch is a proposed fix for PR 10471, where gold ends up putting a
local symbol in the dynamic symbol table when a DSO tries to reference a hidden
(or internal) symbol. In this patch, I issue a warning and refuse to resolve
the symbol, but the link completes successfully. For the included test case, we
get these warning messages:

gcctestdir/ld: warning: hidden symbol 'main_hidden' in hidden_test_main.o is
referenced by DSO libhidden.so
gcctestdir/ld: warning: internal symbol 'main_internal' in hidden_test_main.o
is referenced by DSO libhidden.so

I'm not sure whether these should be made errors (along with undefined symbol
errors, we'd want to see them all before terminating the link) or not.

For comparison, gnu ld prints a message (not sure whether it's a warning or an
error) about the first such symbol, then terminates with a mysterious error
message:

/usr/bin/ld: a.out: internal symbol `main_internal' in hidden_test_main.o is
referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output

Comments?

-cary


	PR 10471
	* resolve.cc (Symbol_table::resolve): Check for references from
	dynamic objects to hidden and internal symbols.
	* testsuite/Makefile.am (hidden_test.sh): New test.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/hidden_test.sh: New script.
	* testsuite/hidden_test_1.c: New test source.
	* testsuite/hidden_test_main.c: New test source.

Attachment: gold-hidden-patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]