[PATCH] D26201: [ELF/GC] Fix pending references to garbage collected sections

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 11:03:23 PDT 2016


Bigcheese requested changes to this revision.
Bigcheese added inline comments.
This revision now requires changes to proceed.


================
Comment at: ELF/InputSection.cpp:410-414
+    uint64_t SymVA;
+    if (Sym.isTls() && !Out<ELFT>::TlsPhdr)
+      SymVA = 0;
+    else
+      SymVA = SignExtend64<sizeof(uintX_t) * 8>(
----------------
This can be simplified to:

```
uint64_t SymVA = 0;
if (!Sym.isTls() || Out<ELFT>::TlsPhdr)
  SymVA = SignExtend64<sizeof(uintX_t) * 8>(getSymVA<ELFT>(Type, Addend, AddrLoc, Sym, R_ABS));
```


================
Comment at: test/ELF/gc-debuginfo-tls.s:19-28
+      .file   1 "patatino.cpp"
+      .globl  main
+main:
+      .loc    1 2 0
+      .cfi_startproc
+      .cfi_endproc
+      .cfi_startproc
----------------
This is a pretty obfuscated way to get a TLS symbol to a gced section. I think this can be simplified to something like:

```
  .section .tbss,"awT", at nobits
patatino:
  .long 0
  .section .noalloc,""
  .quad patatino
```


https://reviews.llvm.org/D26201





More information about the llvm-commits mailing list