[llvm] [BOLT] support mold linker generated PLT in disassembling (PR #115256)
Patrick Zhang via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 9 02:22:11 PST 2024
================
@@ -2127,6 +2127,29 @@ class X86MCPlusBuilder : public MCPlusBuilder {
return Type;
}
+ /// Analyze a series of insns that match the PLT header of the mold linker
+ /// (https://github.com/rui314/mold/blob/v2.34.1/src/arch-x86-64.cc#L50).
+ /// The size of the header is 32 bytes and the format is as follows:
+ /// endbr64
+ /// push %r11
+ /// push GOTPLT+8(%rip)
+ /// jmp *GOTPLT+16(%rip)
+ /// padding (14 bytes)
+ ///
+ bool isMoldPLTHeader(std::vector<MCInst *> &Insns) const override {
----------------
patrickphzhang wrote:
Do you mean a function (e.g., `getPLTHeaderType()`) to get the header type?
In this way, the `disassemblePLTSectionX86()` function should call it at the beginning to get the header type and parse the PLT based on it. In the current patch, we only check the mold header when the code hits the original range check because the mold header is a special case.
If other linkers propose a new header type, we might need a generic interface. Could you please provide any suggestions regarding the detailed implementation?
https://github.com/llvm/llvm-project/pull/115256
More information about the llvm-commits
mailing list