[lld] [LLD][COFF] Add basic ARM64X dynamic relocations support (PR #118035)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 05:36:58 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;
----------------
mstorsjo wrote:
This return value doesn't seem to be used in this commit yet; it's not entirely obvious to me how it's going to be used, but I guess it's fine to keep the return value here, as it probably becomes understandable in later patches.
https://github.com/llvm/llvm-project/pull/118035
More information about the llvm-commits
mailing list