fix: Error on R_X86_64_32 to DSO symbols in PIE output #2125
fix: Error on R_X86_64_32 to DSO symbols in PIE output #2125deepakshirkem wants to merge 1 commit into
Conversation
Wild was silently succeeding when R_X86_64_32 or R_X86_64_32S relocations were used against DSO symbols in PIE or shared object output. Both GNU ld and lld correctly error with 'recompile with -fPIC'. This is a partial fix for wild-linker#2114. R_X86_64_PC32 to DSO symbols and R_X86_64_64 to local symbols in PIE still need investigation. Fixes part of wild-linker#2114
21b3801 to
d5713cd
Compare
| //#Shared:pie-invalid-reloc-dso.s | ||
| //#LinkArgs:-pie --no-gc-sections | ||
| //#ExpectError:R_X86_64_32 | ||
| //#RunEnabled:false |
There was a problem hiding this comment.
Note that ExpectError implies "RunEnabled:False"
Possibly whether the target of the relocation has
If lld errors here, then I'd say it'd be good to do the same. We can always relax it later to accept it like GNU ld if it turns out to be problematic. But it also depends a bit on how hard the implementation is. If it ends up significantly simpler to accept rather than error, then I'd be open to that. |
|
It's fine, possibly even preferable to fix each case in a separate PR. So don't feel that you need to fix them all in this PR. Note that github isn't very good at reading intention when issues are referenced, so saying "partial fix for X" is just as likely to close X when the PR is merged. I usually just put "Issue X", since that definitely doesn't close the issue. |
Wild was silently succeeding when
R_X86_64_32orR_X86_64_32Srelocations were used against DSO symbols in PIE output. Both GNU ld and lld correctly error with "recompile with -fPIC".What still needs fixing (#2114)
R_X86_64_PC32to DSO symbols in PIE — tricky because it's valid for PLT calls but invalid for data references. Not sure how to distinguish the two cases.R_X86_64_64to local symbols in PIE — lld errors but GNU ld emitsR_X86_64_RELATIVEdynamic relocation instead. Not sure which behavior Wild should match.Help needed
@davidlattimore @lapla-cogito
R_X86_64_PC32in PIE contextR_X86_64_64to local symbols should error or emit dynamic relocPartial fix for #2114