summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-04-04 17:03:49 +0000
committerLang Hames <lhames@gmail.com>2017-04-04 17:03:49 +0000
commitd22badef45b001389bb584350a855c82b3157812 (patch)
treeaade7205975090818b9409571495a1f5040258bd /llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
parentac618383e3507d21d5b451f121a6123bb8084326 (diff)
downloadbcm5719-llvm-d22badef45b001389bb584350a855c82b3157812.tar.gz
bcm5719-llvm-d22badef45b001389bb584350a855c82b3157812.zip
[RuntimeDyld] Make RuntimeDyld honor the ProcessAllSections flag.
When the ProcessAllSections flag (introduced in r204398) is set RuntimeDyld is supposed to make a call to the client's memory manager for every section in each object that is loaded. Due to some missing checks, this was not happening in all cases. This patch adds the missing cases, and fixes the Orc unit test that verifies correct behavior for ProcessAllSections (The unit test had been silently bailing out due to an ordering issue: a change in the test order meant that this unit-test was running before the native target was registered. This issue has also been fixed in this patch). This fixes <rdar://problem/22789965> llvm-svn: 299449
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
index f4cec0cc930..de99c022fb9 100644
--- a/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/RTDyldObjectLinkingLayerTest.cpp
@@ -60,7 +60,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
IsReadOnly);
}
private:
- bool DebugSeen;
+ bool &DebugSeen;
};
RTDyldObjectLinkingLayer<> ObjLayer;
@@ -75,6 +75,10 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
GV->setSection(".debug_str");
+
+ // Initialize the native target in case this is the first unit test
+ // to try to build a TM.
+ OrcNativeTarget::initialize();
std::unique_ptr<TargetMachine> TM(
EngineBuilder().selectTarget(Triple(M->getTargetTriple()), "", "",
SmallVector<std::string, 1>()));
@@ -99,6 +103,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
{
// Test with ProcessAllSections = false (the default).
auto H = ObjLayer.addObjectSet(Objs, &SMMW, &*Resolver);
+ ObjLayer.emitAndFinalize(H);
EXPECT_EQ(DebugSectionSeen, false)
<< "Unexpected debug info section";
ObjLayer.removeObjectSet(H);
@@ -108,6 +113,7 @@ TEST(RTDyldObjectLinkingLayerTest, TestSetProcessAllSections) {
// Test with ProcessAllSections = true.
ObjLayer.setProcessAllSections(true);
auto H = ObjLayer.addObjectSet(Objs, &SMMW, &*Resolver);
+ ObjLayer.emitAndFinalize(H);
EXPECT_EQ(DebugSectionSeen, true)
<< "Expected debug info section not seen";
ObjLayer.removeObjectSet(H);
OpenPOWER on IntegriCloud