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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 10:47:20 PDT 2023


MaskRay wrote:

I improved `relocatable-local-sym.s` in commit a317afaf00b0b898538855c36c203bb9117d6b86. I need to adjust the condition to restrict to `STT_SECTION` (keeping just one `STT_SECTION`, originally from https://github.com/llvm/llvm-project/commit/08d6a3f1337238a480225d4caf71b8fec10dc8c6)

```
@@ -954,8 +960,10 @@ void InputSection::relocateNonAlloc(uint8_t *buf, ArrayRef<RelTy> rels) {
       }
     }

-    // For a relocatable link, only tombstone values are applied.
-    if (config->relocatable)
+    // For a relocatable link, content relocated by RELA remains unchanged and
+    // we can stop here, while content relocated by REL needs updating for
+    // computed implicit addends.
+    if (config->relocatable && (RelTy::IsRela || sym.type != STT_SECTION))
       continue;
```

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


More information about the llvm-commits mailing list