https://sourceware.org/bugzilla/show_bug.cgi?id=33409
--- Comment #5 from Sam James <sam at gentoo dot org> ---
What about this?
l.c:
```
[[gnu::visibility("protected")]] char **__environ;
```
a.c:
```
char **
__gnat_environ (void)
{
extern char **environ;
return environ;
}
int main() {
__gnat_environ ();
}
```
```
$ gcc l.c -o l.o -mno-direct-extern-access -c
$ gcc a.c l.o -mdirect-extern-access -o a -ggdb3 -fno-PIE -no-pie -Wl,-z,text
/usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/bin/ld:
/tmp/cc3DQUCr.o: warning: relocation against `__environ@@GLIBC_2.2.5' in
read-only section `.text'
/usr/lib/gcc/x86_64-pc-linux-gnu/16/../../../../x86_64-pc-linux-gnu/bin/ld:
read-only segment has dynamic relocations
collect2: error: ld returned 1 exit status
```
(Same with PIE.)
--
You are receiving this mail because:
You are on the CC list for the bug.