bug-binutils
[Top][All Lists]
Advanced

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

[Bug gold/26939] New: gold: Don't relax R_X86_64_GOTPCRELX when addend !


From: i at maskray dot me
Subject: [Bug gold/26939] New: gold: Don't relax R_X86_64_GOTPCRELX when addend != -4
Date: Tue, 24 Nov 2020 18:09:56 +0000

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

            Bug ID: 26939
           Summary: gold: Don't relax R_X86_64_GOTPCRELX when addend != -4
           Product: binutils
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gold
          Assignee: ccoutant at gmail dot com
          Reporter: i at maskray dot me
                CC: ian at airs dot com
  Target Milestone: ---

Clang emits movl x@GOTPCREL+4(%rip), %eax for the following code:

   void x();
   int foo() { return (long)x >> 32; }

HJ Lu said this is valid:
https://sourceware.org/pipermail/binutils/2020-November/114264.html

---

Let's compare the -no-pie linked output of `movl foo@GOTPCREL(%rip), %eax; movl
foo@GOTPCREL+4(%rip), %eax`:

GNU ld (the second instruction loads the high 32-bit address):

0000000000401000 <foo-0xd>:
   401000:       48 c7 c0 0d 10 40 00    mov    rax,0x40100d
   401007:       8b 05 ef 1f 00 00       mov    eax,DWORD PTR [rip+0x1fef]     
  # 402ffc <.got+0x4>

gold (the second instruction loads the address of foo plus 4; it should be
changed to not relax the instruction):

00000000004000e8 <foo-0xd>:
   4000e8:       48 8d 05 06 00 00 00    lea    rax,[rip+0x6]        # 4000f5
<foo>
   4000ef:       8d 05 04 00 00 00       lea    eax,[rip+0x4]        # 4000f9
<foo+0x4>

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