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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 03:13:15 PST 2021


grimar added a comment.

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



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


================
Comment at: lld/test/ELF/gdb-index.s:4
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index.s -o %t2.o
-# RUN: ld.lld --gdb-index %t1.o %t2.o -o %t
+# RUN: ld.lld --gdb-index --emit-relocs %t1.o %t2.o -o %t
 
----------------
I think we should test `--gdb-index` independently too.


================
Comment at: lld/test/ELF/gdb-index.s:51
 
-# SECTION-NOT: debug_gnu_pubnames
+# SECTION-NOT: .debug_gnu_pubnames
+# SECTION-NOT: .debug_gnu_pubtypes
----------------
Perhaps, just 

```
SECTION-NOT: .debug_gnu_pub
```

And move the comment from above here to clarify that this line checks we
don't emit `.debug_gnu_pubnames`, `.debug_gnu_pubtypes` and their relocation sections if --emit-relocs is specified.


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