[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/17615] aarch64: ld.bfd generates SHN_ABS instead of SHN_UNDEF
From: |
jiwang at gcc dot gnu.org |
Subject: |
[Bug ld/17615] aarch64: ld.bfd generates SHN_ABS instead of SHN_UNDEF |
Date: |
Wed, 17 Dec 2014 11:33:00 +0000 |
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.