bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/27119] ld improperly relocates function address, creating an inv


From: hjl.tools at gmail dot com
Subject: [Bug ld/27119] ld improperly relocates function address, creating an invalid pointer
Date: Mon, 28 Dec 2020 12:52:25 +0000

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-12-28
                 CC|                            |hjl.tools at gmail dot com

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Please try

[hjl@gnu-cfl-2 pr27119]$ cat link.lds 
OUTPUT_FORMAT("elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(_start)

SECTIONS
{
  . = 0x0000000001000000;
  .text : {
    *(.text)
  }
  .data : {
    *(.data)
  }
}
[hjl@gnu-cfl-2 pr27119]$ make
gcc -B./ -fPIE   -c -o prog.o prog.c
gcc -B./ -fPIE   -c -o func.o func.c
./ld -pie -o prog prog.o func.o -T link.lds
objcopy -O binary prog binary
[hjl@gnu-cfl-2 pr27119]$ radare2 -a x86 -b 64 binary
 -- Setup dbg.fpregs to true to visualize the fpu registers in the debugger
view.
[0x00000000]> pd 12
            0x00000000      55             push rbp
            0x00000001      4889e5         mov rbp, rsp
            0x00000004      488d05070000.  lea rax, [0x00000012]       ;
"UH\x89\xe5\x90]\xc3"
            0x0000000b      488945f8       mov qword [rbp - 8], rax
            0x0000000f      90             nop
            0x00000010      5d             pop rbp
            0x00000011      c3             ret
            0x00000012      55             push rbp
            0x00000013      4889e5         mov rbp, rsp
            0x00000016      90             nop
            0x00000017      5d             pop rbp
            0x00000018      c3             ret
[0x00000000]>

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