[lld] [LLD][COFF] Add basic ARM64X dynamic relocations support (PR #118035)

Jacek Caban via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 08:22:18 PST 2024


================
@@ -835,6 +835,43 @@ class ECExportThunkChunk : public NonSectionCodeChunk {
   Defined *target;
 };
 
+// ARM64X entry for dynamic relocations.
+class Arm64XDynamicRelocEntry {
+public:
+  Arm64XDynamicRelocEntry(llvm::COFF::Arm64XFixupType type, uint8_t size,
+                          uint32_t offset, uint64_t value)
+      : offset(offset), value(value), type(type), size(size) {}
+
+  size_t getSize() const;
+  void writeTo(uint8_t *buf) const;
+
+  uint32_t offset;
+  uint64_t value;
+
+private:
+  llvm::COFF::Arm64XFixupType type;
+  uint8_t size;
+};
+
+// Dynamic relocation chunk containing ARM64X relocations for the hybrid image.
+class DynamicRelocsChunk : public NonSectionChunk {
+public:
+  DynamicRelocsChunk() {}
+  size_t getSize() const override { return size; }
+  void writeTo(uint8_t *buf) const override;
+  void finalize();
+
+  uint32_t add(llvm::COFF::Arm64XFixupType type, uint8_t size, uint32_t offset,
+               uint64_t value) {
+    arm64xRelocs.emplace_back(type, size, offset, value);
+    return arm64xRelocs.size() - 1;
----------------
cjacek wrote:

I needed it in a previous versions and forgot to remove, I will fix that.

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


More information about the llvm-commits mailing list