[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:56 PST 2024


================
@@ -2555,6 +2566,33 @@ void Writer::addBaserelBlocks(std::vector<Baserel> &v) {
   relocSec->addChunk(make<BaserelChunk>(page, &v[i], &v[0] + j));
 }
 
+void Writer::createDynamicRelocs() {
+  if (!ctx.dynamicRelocs)
+    return;
+
+  const uint32_t coffHeaderOffset = dosStubSize + sizeof(PEMagic);
+  const uint32_t peHeaderOffset = coffHeaderOffset + sizeof(coff_file_header);
+  const uint32_t dataDirOffset = peHeaderOffset + sizeof(pe32plus_header);
----------------
mstorsjo wrote:

These constants are pretty straightforward as such, but I wonder, if we'd move them somewhere outside of this function, would it be possible to have asserts checking that they actually are correct, e.g. at the point where we actually write them?

>From my memory offhand about these headers; isn't the case that some of them point to each other, so that there in principle could be some padding/gaps inbetween them, or do any reader/user assume the same kind of sequential packing?

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


More information about the llvm-commits mailing list