bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/20737] New: [aarch64] -static -pie linked binary has R_AARCH64_A


From: nszabolcs at gmail dot com
Subject: [Bug ld/20737] New: [aarch64] -static -pie linked binary has R_AARCH64_ABS64 relocation
Date: Wed, 26 Oct 2016 09:25:17 +0000

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
0000000000010fe0  0000000000000403 R_AARCH64_RELATIVE                       
11008
0000000000011000  0000000300000101 R_AARCH64_ABS64        0000000000011008 i +
0

Symbol table '.dynsym' contains 4 entries:
   Num:    Value          Size Type    Bind   Vis      Ndx Name
     0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 0000000000000210     0 SECTION LOCAL  DEFAULT    5 
     2: 0000000000011000     0 SECTION LOCAL  DEFAULT    9 
     3: 0000000000011008     4 OBJECT  GLOBAL DEFAULT   10 i

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]