[lld] [ELF] -r --compress-debug-sections: update addends for .debug_* sections relocated by REL (PR #66804)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 07:54:06 PDT 2023


================
@@ -463,7 +463,10 @@ void InputSection::copyRelocations(uint8_t *buf,
 
       if (RelTy::IsRela)
         p->r_addend = sym.getVA(addend) - section->getOutputSection()->addr;
-      else if (config->relocatable && type != target.noneRel)
+      // See the comment in writeSections. For SHF_ALLOC sections relocated by
----------------
smithp35 wrote:

I guess the comment is:
```
// In -r or --emit-relocs mode, write the relocation sections first as in                                                                                         // ELf_Rel targets we might find out that we need to modify the relocated                                                                                         // section while doing it.
```

I not sure what the non-REL/RELA loop is referring to? I'm assuming this parses as (non-REL)/RELA and not non-(REL/RELA).

In writeSections there is a write relocations (REL or RELA), write non-relocations (!REL && !RELA) followed by an optional dynamic relocations check.

Would it be possible to clarify?
 


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


More information about the llvm-commits mailing list