From 9f9e4681ace64e6200f82d9d7f011701fd4e9cc8 Mon Sep 17 00:00:00 2001 From: Chih-Hung Hsieh Date: Wed, 28 Feb 2018 17:48:55 +0000 Subject: [TLS] use emulated TLS if the target supports only this mode Emulated TLS is enabled by llc flag -emulated-tls, which is passed by clang driver. When llc is called explicitly or from other drivers like LTO, missing -emulated-tls flag would generate wrong TLS code for targets that supports only this mode. Now use useEmulatedTLS() instead of Options.EmulatedTLS to decide whether emulated TLS code should be generated. Unit tests are modified to run with and without the -emulated-tls flag. Differential Revision: https://reviews.llvm.org/D42999 llvm-svn: 326341 --- llvm/lib/ExecutionEngine/TargetSelect.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'llvm/lib/ExecutionEngine/TargetSelect.cpp') diff --git a/llvm/lib/ExecutionEngine/TargetSelect.cpp b/llvm/lib/ExecutionEngine/TargetSelect.cpp index 18dfa4e3c31..9626b8d3ffa 100644 --- a/llvm/lib/ExecutionEngine/TargetSelect.cpp +++ b/llvm/lib/ExecutionEngine/TargetSelect.cpp @@ -97,6 +97,8 @@ TargetMachine *EngineBuilder::selectTarget(const Triple &TargetTriple, Options, RelocModel, CMModel, OptLevel, /*JIT*/ true); Target->Options.EmulatedTLS = EmulatedTLS; + Target->Options.ExplicitEmulatedTLS = true; + assert(Target && "Could not allocate target machine!"); return Target; } -- cgit v1.2.3