https://sourceware.org/bugzilla/show_bug.cgi?id=17615
Jiong Wang <jiwang at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |INVALID --- Comment #8 from Jiong Wang <jiwang at gcc dot gnu.org> --- And a further investigation, from my understanding this is not a bug. actually, this is caused by --gc-sections optimization, and existed on all arch with gc-section supported enabled, including x86. the problem can easily reproduced by 1.c == extern int hz_internal_1; extern int hz_internal_2; int main (int argc, char **argv) { printf ("%d, %d\n", hz_internal_1, hz_internal_2); return 0; } 2.c == int hz_internal_1; int hz_internal_2; int cal (int a) { return a + 1; } gcc -Wl,--gc-sections -shared -o lib2.so 2.c gcc 1.c -L. -l2 if --gc-sections specified, then linker will try to remove all unnecessary sections. in this example, if __iproute2_user_hz_internal is defined in shared library without initialized value, there is no need to allocate space in shared library, just allocate the space in .bss in where it's referenced, and make all relocation against that new place. while if __iproute2_user_hz_internal is defined in .so and with initialized value, then we need to always allocate space for it. and generate COPY relocation for whether it's referenced. so mark as invalid -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils