This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFA][Bug gold/10471] hidden symbol gets added to dynamic symbol table
- From: Ian Lance Taylor <iant at google dot com>
- To: Cary Coutant <ccoutant at google dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Wed, 12 Aug 2009 11:22:03 -0700
- Subject: Re: [RFA][Bug gold/10471] hidden symbol gets added to dynamic symbol table
- References: <20090801001039.10471.silvius.rus@gmail.com> <20090807225611.9584.qmail@sourceware.org> <c17be2b30908121113y2ef4ccd0mc0f64127d8f15895@mail.gmail.com>
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