[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/32443] ABS symbol value depends on its visibility
From: |
hjl.tools at gmail dot com |
Subject: |
[Bug ld/32443] ABS symbol value depends on its visibility |
Date: |
Sat, 10 May 2025 21:06:15 +0000 |
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.
- [Bug ld/32443] ABS symbol value depends on its visibility, i at maskray dot me, 2025/05/09
- [Bug ld/32443] ABS symbol value depends on its visibility,
hjl.tools at gmail dot com <=
- [Bug ld/32443] ABS symbol value depends on its visibility, srk31 at srcf dot ucam.org, 2025/05/13
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/13
- [Bug ld/32443] ABS symbol value depends on its visibility, srk31 at srcf dot ucam.org, 2025/05/13
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/13
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/13
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/13
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/14
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/14
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/14
- [Bug ld/32443] ABS symbol value depends on its visibility, hjl.tools at gmail dot com, 2025/05/14