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

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 8 16:30:44 PST 2016


On Tue, Mar 8, 2016 at 4:24 PM, Sean Silva via llvm-commits <
llvm-commits at lists.llvm.org> 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?
>

My usual approach for things like that is to change it to an assert, then
do some broad testing (such as a bootstrap).


>
> 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);
>    }
>  }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160308/f0d30028/attachment.html>


More information about the llvm-commits mailing list