[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:10:15 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);
----------------
cjacek wrote:

Yes, the format allows padding, and we will use that padding for the DOS stub program. lld-link differs from MSVC, which doesn’t emit the program for ARM targets. What matters here is matching the behavior of `writeHeader()`. Asserts sound good to me; I’ll add them.

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


More information about the llvm-commits mailing list