[PATCH] D94354: [ELF] Drop .rel[a].debug_gnu_pub{names,types} for --gdb-index --emit-relocs

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 09:15:13 PST 2021


MaskRay added a comment.

In D94354#2489729 <https://reviews.llvm.org/D94354#2489729>, @grimar wrote:

> Does this behavior of `-gdb-index --emit-relocs` match GNU ld?

GNU ld does not have `--gdb-index`. The behavior matches gold.



================
Comment at: lld/ELF/SyntheticSections.cpp:2889
+        if (!rel->isLive())
+          return true;
+    return !s->isLive();
----------------
grimar wrote:
> ```
> if (InputSectionBase *rel = isec->getRelocatedSection())
>   return !rel->isLive();
> ```
```
if (!rel->isLive())
   return true;
```
is deliberate.

The suggested version is less reliable: if .debug_pubnames erroneously relocates other sections, it may still trigger a crash...



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94354/new/

https://reviews.llvm.org/D94354



More information about the llvm-commits mailing list