This adds the basic support for GOT in elf x86. Was able to just get away using the macho code. So there will be a follow up patch to turn that into a generic utility for both of the x86
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This includes support for section relative relocations as well as responding to the clang-tidy issues
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | ||
---|---|---|
35 | PCRel32GOT & PCRel32GOTLoad seem to match the names of Mach-O X86_64_RELOC_GOT & X86_64_RELOC_GOT_LOAD. The ELF relocation types are named R_X86_64_GOTPCREL & R_X86_64_GOTPCRELX |
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | ||
---|---|---|
35 | This was done on purpose, this code is lifted verbatim from the Mach-O side. By normalising the edges of the graph it allows us to write more generic code. The next commit after this, will merge all this to a base class that both Mach-O and elf can use. | |
208 | Not sure what this got left in or not flagged as unused :) | |
489 | Thanks. Fixed up. | |
637 | Thanks, That actually can remove the comment above as well. |
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | ||
---|---|---|
35 | Yep. The long term plan for JITLink is to make the graph edge kinds per-architecture rather than per-(format,architecture), so I think these names are fine for now. |
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | ||
---|---|---|
408 | https://llvm.org/docs/CodingStandards.html#use-auto-type-deduction-to-make-code-more-readable Please spell out the exact type if it is non-obvious... |
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | ||
---|---|---|
408 | I'm comfortable with auto being used where the variable name clearly implies valid usage, in this case as an index. I understand there's room for differences in opinion there, but I don't want to delay this landing: We want to get it into LLVM 11 so that people can start testing/living on it. |
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | ||
---|---|---|
408 | I share langs view, to me that the name is index the type almost doesn't matter, but understand there could be a difference of opinion there. There is also the consideration that this just supports x86 at the moment, Given that the we want to follow up with 32 bit support and this class is going to become very templated to match the ElfFile<T> so keeping it auto will help with reducing code churn. Are you ok with landing it as is? |
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp | ||
---|---|---|
408 |
Yep. Please go ahead and commit. We can address style issues in follow up patches. The focus for now should be on getting as much ELF functionality as we reasonably can into the LLVM 11 release branch so that potential clients can start testing and providing feedback. |
PCRel32GOT & PCRel32GOTLoad seem to match the names of Mach-O X86_64_RELOC_GOT & X86_64_RELOC_GOT_LOAD. The ELF relocation types are named R_X86_64_GOTPCREL & R_X86_64_GOTPCRELX