bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/26583] R_X86_64_PC32 relocation against data symbol is mishandle


From: hjl.tools at gmail dot com
Subject: [Bug ld/26583] R_X86_64_PC32 relocation against data symbol is mishandled
Date: Tue, 08 Sep 2020 17:18:48 +0000

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|erroneous address           |R_X86_64_PC32 relocation
                   |relocation: Mircrosoft COFF |against data symbol is
                   |.BSS linked to .ELF using   |mishandled
                   |ld                          |
             Target|                            |pe-x86-64

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-cfl-2 ldBugDemo0]$ cat x.S
        .text
        .align 16
        .globl  getaddr1
        .def    getaddr1;       .scl    2;      .type   32;     .endef
getaddr1:
        leaq    var(%rip), %rax
        ret
        .comm   var, 1   # 1
[hjl@gnu-cfl-2 ldBugDemo0]$ ./as -o x.o x.S
[hjl@gnu-cfl-2 ldBugDemo0]$ ./objdump -dwr x.o

x.o:     file format pe-x86-64


Disassembly of section .text:

0000000000000000 <getaddr1>:
   0:   48 8d 05 00 00 00 00    lea    0x0(%rip),%rax        # 7
<getaddr1+0x7>3: R_X86_64_PC32 var-0x1
   7:   c3                      ret    
   8:   90                      nop
   9:   90                      nop
   a:   90                      nop
   b:   90                      nop
   c:   90                      nop
   d:   90                      nop
   e:   90                      nop
   f:   90                      nop
[hjl@gnu-cfl-2 ldBugDemo0]$ ./ld x.o
./ld: warning: cannot find entry symbol _start; defaulting to 0000000000401000
[hjl@gnu-cfl-2 ldBugDemo0]$ objdump -dw a.out 

a.out:     file format elf64-x86-64


Disassembly of section .text:

0000000000401000 <getaddr1>:
  401000:       48 8d 05 f8 0f 00 00    lea    0xff8(%rip),%rax        # 401fff
<getaddr1+0xfff>
                                                                       ^^^^
Wrong address.
  401007:       c3                      ret    
  401008:       90                      nop
  401009:       90                      nop
  40100a:       90                      nop
  40100b:       90                      nop
  40100c:       90                      nop
  40100d:       90                      nop
  40100e:       90                      nop
  40100f:       90                      nop
[hjl@gnu-cfl-2 ldBugDemo0]$ ./nm a.out 
0000000000402000 B __bss_start
0000000000402000 B _edata
0000000000402008 B _end
0000000000401000 T getaddr1
                 U _start
0000000000402000 B var
[hjl@gnu-cfl-2 ldBugDemo0]$

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