[Bug c/98634] gcc 4.8.5 - 9.3.0 on target x86_64, when compile a exe and linking with a so, and exe's source file extern a var, the final exe has the var with the same name with the one in the so file

zuogang at huawei dot com gcc-bugzilla@gcc.gnu.org
Tue Jan 12 11:24:50 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98634

--- Comment #4 from zuogang <zuogang at huawei dot com> ---
(In reply to Jakub Jelinek from comment #1)
> And the bug is?
> This is due to copy relocations.
> And, it has nothing to do with the compiler, it is how linker handles it.

thanks for the reply, can you explain why the ld add a var into the bss
section?

why I add -fPIC, and the added var has gone?


More information about the Gcc-bugs mailing list