[RFA][Bug gold/10471] hidden symbol gets added to dynamic symbol table
Ian Lance Taylor
iant@google.com
Wed Aug 12 18:22:00 GMT 2009
Cary Coutant <ccoutant@google.com> writes:
> 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
That is an error. The GNU linker generally prints "warning" before
warnings, and nothing in particular before errors. I don't have an
opinion as to whether this should be an error for gold or not.
> 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.
This is OK.
Thanks.
Ian
More information about the Binutils
mailing list