From 35a514d200d1a9847e6f56b533d842cca12af97c Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 2 Feb 2015 19:51:18 +0000 Subject: [Orc] Make OrcMCJITReplacement::addObject calls transfer buffer ownership to the ObjectLinkingLayer. There are a two of overloads for addObject, one of which transfers ownership of the underlying buffer to OrcMCJITReplacement. This commit makes the ownership transfering version pass ownership down to the ObjectLinkingLayer in order to prevent the issue described in r227778. I think this commit will fix the sanitizer bot failures that necessitated the removal of the load-object-a.ll regression test in r227785, so I'm reinstating that test. llvm-svn: 227845 --- llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'llvm/lib/ExecutionEngine/Orc') diff --git a/llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h b/llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h index 838f5dce97f..ddbc73251c7 100644 --- a/llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h +++ b/llvm/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h @@ -154,8 +154,13 @@ public: std::tie(Obj, Buf) = O.takeBinary(); std::vector> Objs; Objs.push_back(std::move(Obj)); - ObjectLayer.addObjectSet(std::move(Objs), - llvm::make_unique(*this)); + auto H = + ObjectLayer.addObjectSet(std::move(Objs), + llvm::make_unique(*this)); + + std::vector> Bufs; + Bufs.push_back(std::move(Buf)); + ObjectLayer.takeOwnershipOfBuffers(H, std::move(Bufs)); } void addArchive(object::OwningBinary A) override { -- cgit v1.2.3