[Bug ld/20737] [aarch64] -static -pie linked binary has R_AARCH64_ABS64 relocation

2016-10-26 Thread nszabolcs at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20737

Szabolcs Nagy  changed:

   What|Removed |Added

 Target||aarch64-*, arm-*

--- Comment #1 from Szabolcs Nagy  ---
it seems 32bit arm is also affected:

$ arm-none-linux-gnueabihf-ld -nostdlib -Bstatic -X -marmelf_linux_eabi -pie
--no-dynamic-linker a.o b.o
$ arm-none-linux-gnueabihf-readelf -r --dyn-sym -W a.out 

Relocation section '.rel.dyn' at offset 0x134 contains 2 entries:
 Offset InfoTypeSym. Value  Symbol's Name
0001100c  0017 R_ARM_RELATIVE
00011010  0302 R_ARM_ABS3200011014   i

Symbol table '.dynsym' contains 4 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1: 0144 0 SECTION LOCAL  DEFAULT5 
 2: 00011010 0 SECTION LOCAL  DEFAULT8 
 3: 00011014 4 OBJECT  GLOBAL DEFAULT9 i

-- 
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/20737] New: [aarch64] -static -pie linked binary has R_AARCH64_ABS64 relocation

2016-10-26 Thread nszabolcs at gmail dot com
https://sourceware.org/bugzilla/show_bug.cgi?id=20737

Bug ID: 20737
   Summary: [aarch64] -static -pie linked binary has
R_AARCH64_ABS64 relocation
   Product: binutils
   Version: 2.28 (HEAD)
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: ld
  Assignee: unassigned at sourceware dot org
  Reporter: nszabolcs at gmail dot com
  Target Milestone: ---

with -static -pie all symbols should be resolved within the executable module,
only R_AARCH64_RELATIVE relocations may remain in the binary (which can be
processed in the startup code).

ld sometimes produces R_AARCH64_ABS64 relocs and exported symbols in the
dynamic symbol table:

$ cat a.c
int i = 0;
int foo(int *);
void _start(){foo(&i);}

$ cat b.c
extern int i;
static int *q = &i;
int foo(int *p){ return p==q; }

$ aarch64-none-linux-gnu-gcc -c -fPIC a.c
$ aarch64-none-linux-gnu-gcc -c -fPIC b.c
$ aarch64-none-linux-gnu-ld -nostdlib -Bstatic -X -EL -maarch64linux -pie
--no-dynamic-linker a.o b.o
$ aarch64-none-linux-gnu-readelf -r --dyn-syms -W  a.out

Relocation section '.rela.dyn' at offset 0x1e0 contains 2 entries:
Offset Info Type   Symbol's Value 
Symbol's Name + Addend
00010fe0  0403 R_AARCH64_RELATIVE   
11008
00011000  00030101 R_AARCH64_ABS6400011008 i +
0

Symbol table '.dynsym' contains 4 entries:
   Num:Value  Size TypeBind   Vis  Ndx Name
 0:  0 NOTYPE  LOCAL  DEFAULT  UND 
 1: 0210 0 SECTION LOCAL  DEFAULT5 
 2: 00011000 0 SECTION LOCAL  DEFAULT9 
 3: 00011008 4 OBJECT  GLOBAL DEFAULT   10 i

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