[PATCH] D26201: [ELF/GC] Fix pending references to garbage collected sections
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 1 11:26:12 PDT 2016
davide updated this revision to Diff 76609.
davide added a comment.
Addressed Spence's comments.
https://reviews.llvm.org/D26201
Files:
ELF/InputSection.cpp
test/ELF/gc-debuginfo-tls.s
Index: test/ELF/gc-debuginfo-tls.s
===================================================================
--- /dev/null
+++ test/ELF/gc-debuginfo-tls.s
@@ -0,0 +1,23 @@
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld %t.o --gc-sections -shared -o %t1
+# RUN: ld.lld %t.o -shared -o %t2
+# RUN: llvm-readobj -symbols %t1 | FileCheck %s --check-prefix=GC
+# RUN: llvm-readobj -symbols %t2 | FileCheck %s --check-prefix=NOGC
+
+# NOGC: Symbol {
+# NOGC: Name: .tbss
+# NOGC: Value: 0x1000
+# NOGC: Size: 0
+# NOGC: Binding: Local
+# NOGC: Type: TLS
+# NOGC: Other: 0
+# NOGC: Section: .tbss
+# NOGC: }
+
+# GC-NOT: tbss
+
+.section .tbss,"awT", at nobits
+patatino:
+ .long 0
+ .section .noalloc,""
+ .quad patatino
Index: ELF/InputSection.cpp
===================================================================
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -407,8 +407,10 @@
}
uintX_t AddrLoc = this->OutSec->getVA() + Offset;
- uint64_t SymVA = SignExtend64<sizeof(uintX_t) * 8>(
- getSymVA<ELFT>(Type, Addend, AddrLoc, Sym, R_ABS));
+ uint64_t SymVA = 0;
+ if (!Sym.isTls() || Out<ELFT>::TlsPhdr)
+ SymVA = SignExtend64<sizeof(uintX_t) * 8>(
+ getSymVA<ELFT>(Type, Addend, AddrLoc, Sym, R_ABS));
Target->relocateOne(BufLoc, Type, SymVA);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26201.76609.patch
Type: text/x-patch
Size: 1343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161101/7a5ef8ac/attachment.bin>
More information about the llvm-commits
mailing list