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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Blocks|                            |25749
                 CC|                            |hjl.tools at gmail dot com
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2025-05-10

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Stephen Kell from comment #0)
> Created attachment 15835 [details]
> reproducer
> 
> If I define an ABS symbol preemptibly in a shared object, such that its GOT
> entry is relocated by the ld.so and a `R_*_GLOB_DAT` relocation, the ABS
> symbol takes the value I expect.
> ```
> $ 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?

> lib.c:void lib_func(void)
> lib.c:{
> lib.c:  printf("In lib, value is %lx\n", (long) &value);
> lib.c:}
> lib.lds:PROVIDE (value = 42);
> $ cc -fPIC -shared -o lib.so lib.c lib.lds -Wl,-rpath,`pwd`
> $ cc -fPIC -o exe  exe.c lib.so -Wl,-rpath,`pwd`
> $ ./exe
> exe: In lib, value is 2a
> ```
>


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=25749
[Bug 25749] Non-const relocation against SHN_ABS symbol in PIE or shared
library should be disallowed
-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to