https://sourceware.org/bugzilla/show_bug.cgi?id=20608
Bug ID: 20608 Summary: Relocation truncated to fit: R_ARM_THM_JUMP24 for relocation to PLT entry. Product: binutils Version: 2.25 Status: UNCONFIRMED Severity: normal Priority: P2 Component: ld Assignee: unassigned at sourceware dot org Reporter: peter.smith at linaro dot org Target Milestone: --- I'm raising this as a result of an investigation of a buildbot failure found whilst trying to link libclang.so https://llvm.org/bugs/show_bug.cgi?id=27813 The exact error the buildbot was intermittently seeing was: DebugHandlerBase.cpp:(.text._ZN4llvm8DenseMapIPKNS_12MachineInstrEPNS_8MCSymbolENS_12DenseMapInfoIS3_EENS_6detail12DenseMapPairIS3_S5_EEE4growEj[_ZN4llvm8DenseMapIPKNS_12MachineInstrEPNS_8MCSymbolENS_12DenseMapInfoIS3_EENS_6detail12DenseMapPairIS3_S5_EEE4growEj]+0x18a): relocation truncated to fit: R_ARM_THM_JUMP24 against symbol `operator delete(void*)@@GLIBCXX_3.4' defined in .text section in /usr/lib/gcc/arm-linux-gnueabihf/4.8/libstdc++.so collect2: error: ld returned 1 exit status This sounds similar to https://sourceware.org/bugzilla/show_bug.cgi?id=12965 but that has been fixed for some time. The failure on the buildbot is with binutils 2.24, but I've also reproducible on 2.25 (the latest ARM build that I have available). I don't have access to the original objects from the clang build, but I've made a reproducer for what I think the problem is. It needs a shared object or some other means of generating a PLT entry for a symbol. The b.w instruction with the R_ARM_THUMB_JUMP24 relocation needs to be in range of the ARM part of the PLT entry, but not in range of the inline Thumb state change that the b.w needs to target. If the instruction is closer the b.w can reach the inline state change, it the instruction is further away than the ARM part then a stub is generated. The test case is highly sensitive to the distance between the .plt entry and the b.w. I'm using the (Linaro GCC 5.3-2016.02) 5.3.1 20160113 release. -- shared.c -- int func(void) { return 0; } arm-linux-gnueabihf-gcc shared.c --shared -fPIC -o shared.so -- space.s -- .text .syntax unified .thumb .global sp .type sp,%function .space (1024 * 1024 * 16) - 0x108 .space 2 // Will fail values 2 or 4 .global func2 .type func2,%function func2: b.w func arm-linux-gnueabihf-gcc space.s -fPIC --shared -O2 -o test.axf shared.so -mthumb (.text+0xfffefa): relocation truncated to fit: R_ARM_THM_JUMP24 against symbol `func' defined in .text section in shared.so collect2: error: ld returned 1 exit status -- You are receiving this mail because: You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils