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]

Re: PATCH: PR ld/10630: Linker generates hidden local symbols


On Mon, Sep 14, 2009 at 12:04 AM, Alan Modra <amodra@bigpond.net.au> wrote:
> On Sat, Sep 12, 2009 at 06:43:01AM -0700, H.J. Lu wrote:
>> On Sat, Sep 12, 2009 at 5:42 AM, Alan Modra<amodra@bigpond.net.au> wrote:
>> > On Fri, Sep 11, 2009 at 12:50:12PM -0700, H.J. Lu wrote:
>> >> This patch turns off visibility on local symbol and dynamic local symbol.
>> >> Tested on Linux/ia32, Linux/ia64 and Linux/x86-64 as well as for
>> >> alpha-linux, cris-elf, s390-linux, sparc-linux, powerpc-linux and
>> >> xtensa-linux with cross binutils. ?There are no regressions. ?OK
>> >> to install?
>> >
>> > Does having non-default visibility on a local symbol break some
>> > application?
>>
>> It failed a test in elfutils on ia64 due to hidden dynamic local symbol,
>> which leads to rpm build failure.
>
> I'm not willing to OK your patch on the strength of a failed elfutils
> test. ?That's not to say I'm against the patch, just that I'm unsure
> what the ELF gabi intends. ?I won't be unhappy if someone else wants
> to OK it..
>
> The ELF gabi says "A symbol with STB_LOCAL binding may not have
> STV_PROTECTED visibility." ?It does not say anything like this about
> STV_HIDDEN or STV_INTERNAL. ?That leads me to think that STB_LOCAL
> symbols may be marked STV_HIDDEN or STV_INTERNAL. ?(Such symbols
> wouldn't be inconsistent with the definitions of STB_LOCAL or
> STV_HIDDEN/STV_INTERNAL.)

Well, we do generate STB_LOCAL and STV_PROTECTED:

[hjl@gnu-6 hidden-5]$ cat foo.c
void
#if 0
__attribute__ ((visibility ("hidden")))
#else
__attribute__ ((visibility ("protected")))
#endif
hidden ()
{
}

void (*foo) () = hidden;
[hjl@gnu-6 hidden-5]$ cat libfoo.map
{
global:
 *;
local:
 hidden;
};
[hjl@gnu-6 hidden-5]$ make
gcc -B./ -O -g -fPIC -c foo.c
./ld -shared -o libfoo.so --version-script libfoo.map foo.o
readelf -s libfoo.so | grep hidden
    18: 0000000000000218     2 FUNC    LOCAL  PROTECTED    5 hidden
[hjl@gnu-6 hidden-5]$

My patch fixes it.


-- 
H.J.


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