diff options
-rw-r--r-- | lld/ELF/LinkerScript.cpp | 4 | ||||
-rw-r--r-- | lld/test/ELF/linkerscript/multiple-tbss.s | 17 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index a8ed92513fb..7edfacae97a 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -373,7 +373,9 @@ template <class ELFT> void LinkerScript<ELFT>::output(InputSection<ELFT> *S) { // .foo { *(.aaa) a = SIZEOF(.foo); *(.bbb) } CurOutSec->setSize(Pos - CurOutSec->getVA()); - if (!IsTbss) + if (IsTbss) + ThreadBssOffset = Pos - Dot; + else Dot = Pos; } diff --git a/lld/test/ELF/linkerscript/multiple-tbss.s b/lld/test/ELF/linkerscript/multiple-tbss.s new file mode 100644 index 00000000000..d30ac057282 --- /dev/null +++ b/lld/test/ELF/linkerscript/multiple-tbss.s @@ -0,0 +1,17 @@ +# REQUIRES: x86 +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +# RUN: echo "SECTIONS { }" > %t.script +# RUN: ld.lld -T %t.script %t.o -o %t +# RUN: llvm-readobj -l %t | FileCheck %s + +# CHECK: Type: PT_TLS +# CHECK-NEXT: Offset: +# CHECK-NEXT: VirtualAddress: +# CHECK-NEXT: PhysicalAddress: +# CHECK-NEXT: FileSize: 0 +# CHECK-NEXT: MemSize: 9 + +.section .tbss,"awT",@nobits +.quad 0 +.section foo,"awT",@nobits +.byte 0 |