bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/30137] LD --dynamicbase does not generate relocation info


From: pali at kernel dot org
Subject: [Bug ld/30137] LD --dynamicbase does not generate relocation info
Date: Sun, 19 Feb 2023 18:28:06 +0000

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

--- Comment #3 from Pali Rohár <pali at kernel dot org> ---
Ou, my bad. I totally forgot that I wrote example for AMD64 and AMD64 does not
use relocation for indirect calls. Only 32-bit x86 needs it.

IX86 example is:

$ cat test-dynamicbase.S
.globl  _main
_main:
        call    *__imp__external
        mov     $0, %eax
        leave
        ret

$ i686-w64-mingw32-dlltool -d external.def -l external.dll.a
$ i686-w64-mingw32-as test-dynamicbase.S -o test-dynamicbase.o
$ i686-w64-mingw32-ld --dynamicbase test-dynamicbase.o external.dll.a -o
test-dynamicbase.exe

$ i686-w64-mingw32-objdump -f -p test-dynamicbase.exe | grep -i reloc
HAS_RELOC, EXEC_P, HAS_SYMS, HAS_LOCALS, D_PAGED
Entry 5 00003000 0000000c Base Relocation Directory [.reloc]
PE File Base Relocations (interpreted .reloc section contents)
        reloc    0 offset    2 [1002] HIGHLOW
        reloc    1 offset    0 [1000] ABSOLUTE

$ i686-w64-mingw32-objdump -d test-dynamicbase.exe
...
  401000:       ff 15 30 20 40 00       call   *0x402030
  401006:       b8 00 00 00 00          mov    $0x0,%eax
  40100b:       c9                      leave
  40100c:       c3                      ret
...

So for IX86 relocation information with LD 2.40 is correctly generated.

When I tried those steps with LD 2.31 I got from objdump output:

        relocations stripped
Entry 5 00000000 00000000 Base Relocation Directory [.reloc]

So the issue is already fixed. Sorry for the noise and wrong example (AMD64 vs
IX86).

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