[llvm] [BOLT] support mold linker generated PLT in disassembling (PR #115256)

Alexander Yermolovich via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 13:51:39 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 {
----------------
ayermolo wrote:

Maybe something more generic? In case other linkers decide to implement this also.

https://github.com/llvm/llvm-project/pull/115256


More information about the llvm-commits mailing list