[Bug binutils/17615] aarch64: ld.bfd generates SHN_ABS instead of SHN_UNDEF

2014-12-17 Thread jiwang at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=17615

Jiong Wang  changed:

   What|Removed |Added

 Target|aarch64-none-linux-gnu  |aarch64-none-linux-gnu,
   ||arm-none-linux-gnu

--- Comment #7 from Jiong Wang  ---
I believe this is a generic issue.

Confirmed arm has this issue also, if you use bfd linker instead of gold
linker.
the default linker "ld" in prebuilt for arm is actually ld.gold, not ld.bfd,
that's why ARM is OK.

And the symbol start to be wrong since in libiprouteutil.so, it's marked as ABS
with absolute value 4.

-- 
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


[Bug ld/17615] aarch64: ld.bfd generates SHN_ABS instead of SHN_UNDEF

2014-12-17 Thread jiwang at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=17615

Jiong Wang  changed:

   What|Removed |Added

  Component|binutils|ld
Version|2.24|2.26 (HEAD)

-- 
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


[Bug ld/17615] aarch64: ld.bfd generates SHN_ABS instead of SHN_UNDEF

2014-12-17 Thread jiwang at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=17615

Jiong Wang  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |INVALID

--- Comment #8 from Jiong Wang  ---
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