Switching from PLT to GOT makes following errors go away: "error: 32 bit reloc applied to a field with a different size".
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
20 ms | x64 debian > Flang.Evaluate::folding28.f90 |
Event Timeline
What's the effect on the relocation types in the object file with this change? I don't think it's valid to have a branch with an @GOT modifier.
Moving from PTL to GOT fixed this errors like this: "error: 32 bit reloc applied to a field with a different size". What do you thing should be the right type for this? Not specifying PTL also had problems with linking so living in blank is not an option.
Before it was like this:
28: e9 00 00 00 00 jmpq 2d <__asan_check_store2_rn53+0x2d> 29: R_X86_64_PLT32 __asan_report_store2-0x4
With the new flag it is like this:
28: e9 00 00 00 00 jmpq 2d <__asan_check_store2_rn53+0x2d> 29: R_X86_64_GOTPC32 __asan_report_store2-0x4
Have you verified that things work at runtime with this change? Because I believe that your change will result in branching to the GOT entry for the runtime functions. Since GOT entries are just addresses and are not executable, I believe that this would result in a segfault.
I believe that R_X86_64_PLT32 is the correct relocation to use in this case. What's unclear to me though is how you're getting that error. That should only be happening if the relocation is being applied to an address of the wrong size. Can you check what the value of Type is in checkIs32 in llvm/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp when the check fails? I suspect that the JMP_1 in your instruction somehow remains a JMP_1 instead of being properly "unrelaxed" to JMP_4.
Thanks for the review. I think the culprit was that I was using JMP_1 instead of JMP_4. I will drop this patch and send out another one.