[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


================
@@ -1596,8 +1599,13 @@ void Writer::assignAddresses() {
 
   for (OutputSection *sec : ctx.outputSections) {
     llvm::TimeTraceScope timeScope("Section: ", sec->name);
-    if (sec == relocSec)
+    if (sec == relocSec) {
       addBaserels();
+      if (ctx.dynamicRelocs) {
+        ctx.dynamicRelocs->finalize();
+        relocSec->addChunk(ctx.dynamicRelocs);
----------------
mstorsjo wrote:

The added code here, `->finalize()` and `->addChunk`, how does this behave if `assignAddresses()` gets called multiple times? If we need to add range extension thunks, we'll end up calling this method multiple times.

Ok, I see that `addBaserels()` starts out with `relocSec->chunks.clear();` so I guess the `->addChunk()` part is fine at least.

I'm pondering if there are other ways of making this clearer to the reader - either moving the newly added code here into `addBaserels()`, but that's probably not entirely right either, or moving the `relocSec->chunks.clear()` out here, to make it more visible that first we clear the section, then we add one kind of relocations, then we add another kind of relocations.

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


More information about the llvm-commits mailing list