https://sourceware.org/bugzilla/show_bug.cgi?id=32443

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Stephen Kell from comment #3)
> (In reply to H.J. Lu from comment #2)
> > (In reply to Stephen Kell from comment #0)
> > > $ grep . exe.c lib.c lib.lds
> > > exe.c:extern void lib_func(void);
> > > exe.c:int main(void)
> > > exe.c:{
> > > exe.c:  lib_func();
> > > exe.c:}
> > > lib.c:#include <stdio.h>
> > > lib.c:extern void value;
> > 
> > If the above line is changed to:
> > 
> > extern void value __attribute__ ((visibility("hidden")));
> > 
> > what should be the expected behavior?
> 
> I think it should be unchanged, i.e. I expect 0x2a as the ABS symbol's value.

When compiler sees a hidden undefined symbol, it assumes that
it is defined somewhere else and it isn't an ABS symbol.  As
the result, you won't get 0x2a.

> Caveat: currently struggling to find the relevant ELF spec for the meaning
> of an UND symbol of hidden visibility. If it's analogous to protected, I

Linker disallows undefined hidden symbol during the final link.

> think it means it should only bind to a hidden def. So the link might fail
> in the non-PROVIDE_HIDDEN cases. But if it does link, I would expect the
> value 0x2a.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to