summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2020-01-21 16:28:30 -0800
committerHans Wennborg <hans@chromium.org>2020-01-29 21:50:16 +0100
commit32723d572077e9a3776553a2067563974e85e7c8 (patch)
tree72635c7810a1525721b9b12e1cb9fbfbfcad96ef /llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
parentf7f0fd4a21d52d30f9b3257cd537fbc706f0f176 (diff)
downloadbcm5719-llvm-32723d572077e9a3776553a2067563974e85e7c8.tar.gz
bcm5719-llvm-32723d572077e9a3776553a2067563974e85e7c8.zip
[ORC] Add support for emulated TLS to ORCv2.
This commit adds a ManglingOptions struct to IRMaterializationUnit, and replaces IRCompileLayer::CompileFunction with a new IRCompileLayer::IRCompiler class. The ManglingOptions struct defines the emulated-TLS state (via a bool member, EmulatedTLS, which is true if emulated-TLS is enabled and false otherwise). The IRCompileLayer::IRCompiler class wraps an IRCompiler (the same way that the CompileFunction typedef used to), but adds a method to return the IRCompileLayer::ManglingOptions that the compiler will use. These changes allow us to correctly determine the symbols that will be produced when a thread local global variable defined at the IR level is compiled with or without emulated TLS. This is required for ORCv2, where MaterializationUnits must declare their interface up-front. Most ORCv2 clients should not require any changes. Clients writing custom IR compilers will need to wrap their compiler in an IRCompileLayer::IRCompiler, rather than an IRCompileLayer::CompileFunction, however this should be a straightforward change (see modifications to CompileUtils.* in this patch for an example). (cherry picked from commit ce2207abaf9a925b35f15ef92aaff6b301ba6d22)
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
index f1c0da6a9ab..0c66841e9af 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
@@ -89,7 +89,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
if (!TM)
return;
- auto Obj = SimpleCompiler(*TM)(*M);
+ auto Obj = cantFail(SimpleCompiler(*TM)(*M));
EXPECT_FALSE(testSetProcessAllSections(
MemoryBuffer::getMemBufferCopy(Obj->getBuffer()), false))
@@ -115,7 +115,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
public:
FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
- CompileResult operator()(Module &M) {
+ Expected<CompileResult> operator()(Module &M) {
auto *Foo = M.getFunction("foo");
assert(Foo && "Expected function Foo not found");
Foo->setVisibility(GlobalValue::HiddenVisibility);
@@ -155,7 +155,8 @@ TEST(RTDyldObjectLinkingLayerTest, TestOverrideObjectFlags) {
auto Foo = ES.intern("foo");
RTDyldObjectLinkingLayer ObjLayer(
ES, []() { return std::make_unique<SectionMemoryManager>(); });
- IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
+ IRCompileLayer CompileLayer(ES, ObjLayer,
+ std::make_unique<FunkySimpleCompiler>(*TM));
ObjLayer.setOverrideObjectFlagsWithResponsibilityFlags(true);
@@ -184,7 +185,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
public:
FunkySimpleCompiler(TargetMachine &TM) : SimpleCompiler(TM) {}
- CompileResult operator()(Module &M) {
+ Expected<CompileResult> operator()(Module &M) {
Function *BarImpl = Function::Create(
FunctionType::get(Type::getVoidTy(M.getContext()), {}, false),
GlobalValue::ExternalLinkage, "bar", &M);
@@ -221,7 +222,8 @@ TEST(RTDyldObjectLinkingLayerTest, TestAutoClaimResponsibilityForSymbols) {
auto Foo = ES.intern("foo");
RTDyldObjectLinkingLayer ObjLayer(
ES, []() { return std::make_unique<SectionMemoryManager>(); });
- IRCompileLayer CompileLayer(ES, ObjLayer, FunkySimpleCompiler(*TM));
+ IRCompileLayer CompileLayer(ES, ObjLayer,
+ std::make_unique<FunkySimpleCompiler>(*TM));
ObjLayer.setAutoClaimResponsibilityForObjectSymbols(true);
OpenPOWER on IntegriCloud