Bug 12896 – ld.gold complains about bad relocations when building libphobos2.so
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2014-06-12T03:54:00Z
Last change time
2014-08-22T08:04:07Z
Keywords
pull
Assigned to
nobody
Creator
code
Comments
Comment #0 by code — 2014-06-12T03:54:19Z
The error message looks like this.
generated/linux/release/64/libphobos2.so.0.66.o(.text.d_dso_init+0x38): error: reloc has bad offset 56
generated/linux/release/64/libphobos2.so.0.66.o(.text.d_dso_init+0x38): error: reloc has bad offset 56
This looks like a problem with the recently added R_ARCH_NONE relocations that were emitted to .text.d_dso_init to fix bug 4758 (--gc-section).
The ld.gold linker is complaining about a bad offset for the fake relocations added to pin the deh_eh and the minfo section.
Those are 0-sized NONE relocations added to the end of the d_dso_init function.
The gold linker complains, because it thinks there is no space for the relocation (the section only has 56 bytes) even though it doesn't require any space.
A simple solution would be to set the relocation offset to 0 (i.e. the begin of d_dso_init) but there are further issues with --gc-sections and ld.gold which necessitate a different solution, so reverting is the best option for now.
https://github.com/D-Programming-Language/dmd/pull/3715
Comment #3 by github-bugzilla — 2014-07-04T21:54:06Z