https://sourceware.org/bugzilla/show_bug.cgi?id=19827

            Bug ID: 19827
           Summary: Wrong relocation with linker-defined symbol in PIE
           Product: binutils
           Version: 2.26
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

[hjl@gnu-6 pr19807b]$ cat x.s
        .text
        .global _start
_start:
        .dc.a _bss
[hjl@gnu-6 pr19807b]$ cat x.t
_bss = .;
[hjl@gnu-6 pr19807b]$ make
as --32  -o x.o x.s
./ld.2.26 -pie -m elf_i386 -T x.t x.o -o x
./ld.2.26 -shared -Bsymbolic -m elf_i386 -T x.t x.o -o y
readelf -r --dyn-syms --wide x

Relocation section '.rel.dyn' at offset 0x1054 contains 1 entries:
 Offset     Info    Type                Sym. Value  Symbol's Name
00000000  00000101 R_386_32               00000000   _bss
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This should be R_386_RELATIVE, the same as -shared -Bsymbolic.

Symbol table '.dynsym' contains 2 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _bss
readelf -r --dyn-syms --wide y

Relocation section '.rel.dyn' at offset 0x105c contains 1 entries:
 Offset     Info    Type                Sym. Value  Symbol's Name
00000000  00000008 R_386_RELATIVE        

Symbol table '.dynsym' contains 3 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _bss
     2: 00000000     0 NOTYPE  GLOBAL DEFAULT    1 _start
[hjl@gnu-6 pr19807b]$

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

Reply via email to