summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-devel/llvm/files/ExceptionTableOverflowFix.patch')
-rw-r--r--sys-devel/llvm/files/ExceptionTableOverflowFix.patch111
1 files changed, 0 insertions, 111 deletions
diff --git a/sys-devel/llvm/files/ExceptionTableOverflowFix.patch b/sys-devel/llvm/files/ExceptionTableOverflowFix.patch
deleted file mode 100644
index a082dd5..0000000
--- a/sys-devel/llvm/files/ExceptionTableOverflowFix.patch
+++ /dev/null
@@ -1,111 +0,0 @@
-Index: unittests/ExecutionEngine/JIT/JITTest.cpp
-===================================================================
---- unittests/ExecutionEngine/JIT/JITTest.cpp (revision 163535)
-+++ unittests/ExecutionEngine/JIT/JITTest.cpp (working copy)
-@@ -203,14 +203,21 @@
-
- class JITTest : public testing::Test {
- protected:
-+ virtual RecordingJITMemoryManager* CreateMemoryManager() {
-+ return new RecordingJITMemoryManager;
-+ }
-+
- virtual void SetUp() {
- M = new Module("<main>", Context);
-- RJMM = new RecordingJITMemoryManager;
-+ RJMM = CreateMemoryManager();
- RJMM->setPoisonMemory(true);
- std::string Error;
-+ TargetOptions Options;
-+ Options.JITExceptionHandling = true;
- TheJIT.reset(EngineBuilder(M).setEngineKind(EngineKind::JIT)
- .setJITMemoryManager(RJMM)
-- .setErrorStr(&Error).create());
-+ .setErrorStr(&Error)
-+ .setTargetOptions(Options).create());
- ASSERT_TRUE(TheJIT.get() != NULL) << Error;
- }
-
-@@ -292,6 +299,46 @@
- EXPECT_EQ(3, *GPtr);
- }
-
-+// Regression test for a bug. The JITEmitter wasn't checking to verify that
-+// it hadn't run out of space while generating the DWARF exception information
-+// for an emitted function.
-+
-+class ExceptionMemoryManagerMock : public RecordingJITMemoryManager {
-+ public:
-+ virtual uint8_t* startExceptionTable(const Function* F,
-+ uintptr_t &ActualSize) {
-+ // force an insufficient size the first time through.
-+ bool ChangeActualSize = false;
-+ if (ActualSize == 0)
-+ ChangeActualSize = true;;
-+ uint8_t* result =
-+ RecordingJITMemoryManager::startExceptionTable(F, ActualSize);
-+ if (ChangeActualSize)
-+ ActualSize = 1;
-+ return result;
-+ }
-+};
-+
-+class JITExceptionMemoryTest : public JITTest {
-+ protected:
-+ virtual RecordingJITMemoryManager* CreateMemoryManager() {
-+ return new ExceptionMemoryManagerMock;
-+ }
-+};
-+
-+TEST_F(JITExceptionMemoryTest, ExceptionTableOverflow) {
-+ Function *F = Function::Create(TypeBuilder<void(void), false>::get(Context),
-+ Function::ExternalLinkage,
-+ "func1", M);
-+ BasicBlock *Block = BasicBlock::Create(Context, "block", F);
-+ IRBuilder<> Builder(Block);
-+ Builder.CreateRetVoid();
-+ TheJIT->getPointerToFunction(F);
-+ ASSERT_TRUE(RJMM->startExceptionTableCalls.size() == 2);
-+ ASSERT_TRUE(RJMM->deallocateExceptionTableCalls.size() == 1);
-+ ASSERT_TRUE(RJMM->endExceptionTableCalls.size() == 1);
-+}
-+
- int PlusOne(int arg) {
- return arg + 1;
- }
-Index: lib/ExecutionEngine/JIT/JITEmitter.cpp
-===================================================================
---- lib/ExecutionEngine/JIT/JITEmitter.cpp (revision 163478)
-+++ lib/ExecutionEngine/JIT/JITEmitter.cpp (working copy)
-@@ -974,14 +974,24 @@
- SavedBufferBegin = BufferBegin;
- SavedBufferEnd = BufferEnd;
- SavedCurBufferPtr = CurBufferPtr;
-+ uint8_t *FrameRegister;
-
-- BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
-- ActualSize);
-- BufferEnd = BufferBegin+ActualSize;
-- EmittedFunctions[F.getFunction()].ExceptionTable = BufferBegin;
-- uint8_t *EhStart;
-- uint8_t *FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd,
-- EhStart);
-+ while (true) {
-+ BufferBegin = CurBufferPtr = MemMgr->startExceptionTable(F.getFunction(),
-+ ActualSize);
-+ BufferEnd = BufferBegin+ActualSize;
-+ EmittedFunctions[F.getFunction()].ExceptionTable = BufferBegin;
-+ uint8_t *EhStart;
-+ FrameRegister = DE->EmitDwarfTable(F, *this, FnStart, FnEnd, EhStart);
-+
-+ // If we've run out of memory, try again with twice as much space.
-+ if (CurBufferPtr == BufferEnd) {
-+ ActualSize = (CurBufferPtr-BufferBegin)*2;
-+ MemMgr->deallocateExceptionTable(BufferBegin);
-+ } else {
-+ break;
-+ }
-+ }
- MemMgr->endExceptionTable(F.getFunction(), BufferBegin, CurBufferPtr,
- FrameRegister);
- BufferBegin = SavedBufferBegin;