bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/26659] x86_64 pe relocation truncated to fit: R_X86_64_PC32 agai


From: mati865 at gmail dot com
Subject: [Bug ld/26659] x86_64 pe relocation truncated to fit: R_X86_64_PC32 against undefined symbol
Date: Mon, 28 Sep 2020 19:14:42 +0000

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

Mateusz Mikuła <mati865 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mati865 at gmail dot com

--- Comment #1 from Mateusz Mikuła <mati865 at gmail dot com> ---
There is discussion about this issue in
https://github.com/msys2/MINGW-packages/issues/6986

I tested it with GCC 10.2, Binutils 2.35, Clang/LLD 11.
Using reproducer in shared.zip by calling ./build.sh (designed to run under
MSYS2) GCC+ld.bfd fails with this error:

D:\tmp\weak\shared-wiki\build-bfd/../power_slow.c:15:(.text+0x18): relocation
truncated to fit: R_X86_64_PC32 against undefined symbol `user_hook'

The same code works as expected when using GCC+ld.lld, Clang+ld.bfd,
Clang+ld.lld.

Extracted details from issue in MSYS2 repo (I couldn't find anything beyond
what was already said there):

Relocations:
Clang:
  Section (1) .text {
    0xB IMAGE_REL_AMD64_REL32 .refptr.user_hook (10)
    0x1F IMAGE_REL_AMD64_REL32 .refptr.user_hook (10)
    0x4D IMAGE_REL_AMD64_REL32 power2 (24)
  }

GCC:
  Section (1) .text {
    0xE IMAGE_REL_AMD64_REL32 .refptr.user_hook (29)
    0x18 IMAGE_REL_AMD64_REL32 user_hook (33)
    0x37 IMAGE_REL_AMD64_REL32 power2 (31)
  }

Relevant symbols:
  Symbol {
    Name: user_hook
    Value: 0
    Section: IMAGE_SYM_UNDEFINED (0)
    BaseType: Null (0x0)
    ComplexType: Function (0x2)
    StorageClass: WeakExternal (0x69)
    AuxSymbolCount: 1
    AuxWeakExternal {
      Linked: .weak.user_hook.power3 (30)
      Search: NoLibrary (0x1)
    }
  }
Symbol {
    Name: .rdata$.refptr.user_hook
    Value: 0
    Section: .rdata$.refptr.user_hook (12)
    BaseType: Null (0x0)
    ComplexType: Null (0x0)
    StorageClass: Static (0x3)
    AuxSymbolCount: 1
    AuxSectionDef {
      Length: 8
      RelocationCount: 1
      LineNumberCount: 0
      Checksum: 0x0
      Number: 0
      Selection: Any (0x2)
    }
  }
  Symbol {
    Name: .refptr.user_hook
    Value: 0
    Section: .rdata$.refptr.user_hook (12)
    BaseType: Null (0x0)
    ComplexType: Null (0x0)
    StorageClass: External (0x2)
    AuxSymbolCount: 0
  }

Assembly and object file are included in objects.zip.

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