[PATCH] D17974: [lto] Record whether a variable is TLS.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 16:30:48 PST 2016


The !GV case is for symbols defined in inline assembly.

Now that I think  of it, we should probably drop it for now. It will
be clear when adding inline assembly.

Cheers,
Rafael


On 8 March 2016 at 19:24, Sean Silva <chisophugis at gmail.com> wrote:
> silvas created this revision.
> silvas added a reviewer: rafael.
> silvas added subscribers: llvm-commits, Bigcheese.
> Herald added a subscriber: joker.eph.
>
> I'm not sure whether the `if (GV)` is needed; I'm just following the
> code above which is checking the same thing. No tests fail when I remove
> both `if (GV)` checks.
> Rafael, any ideas?
>
> http://reviews.llvm.org/D17974
>
> Files:
>   ELF/InputFiles.cpp
>   test/ELF/lto/Inputs/tls-mixed.s
>   test/ELF/lto/tls-mixed.ll
>
> Index: test/ELF/lto/tls-mixed.ll
> ===================================================================
> --- /dev/null
> +++ test/ELF/lto/tls-mixed.ll
> @@ -0,0 +1,10 @@
> +; REQUIRES: x86
> +; RUN: llvm-as %s -o %t1.o
> +; RUN: llvm-mc %p/Inputs/tls-mixed.s -o %t2.o -filetype=obj -triple=x86_64-pc-linux
> +; RUN: ld.lld -m elf_x86_64 %t1.o %t2.o -o %t.so -shared
> +
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-unknown-linux-gnu"
> +
> +; Should not encounter TLS-ness mismatch for @foo
> + at foo = external thread_local global i32, align 4
> Index: test/ELF/lto/Inputs/tls-mixed.s
> ===================================================================
> --- /dev/null
> +++ test/ELF/lto/Inputs/tls-mixed.s
> @@ -0,0 +1,5 @@
> +.globl foo
> +.section .tbss,"awT", at nobits
> +.p2align 2
> +foo:
> +.long 0
> Index: ELF/InputFiles.cpp
> ===================================================================
> --- ELF/InputFiles.cpp
> +++ ELF/InputFiles.cpp
> @@ -467,6 +467,8 @@
>      } else {
>        Body = new (Alloc) DefinedBitcode(NameRef, IsWeak, Visibility);
>      }
> +    if (GV)
> +      Body->IsTls = GV->isThreadLocal();
>      SymbolBodies.push_back(Body);
>    }
>  }
>
>


More information about the llvm-commits mailing list