OSDN Git Service

[RuntimeDyld] Update reserveAllocationSpace to account for stub padding.
authorLang Hames <lhames@gmail.com>
Thu, 30 May 2019 20:58:28 +0000 (20:58 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 30 May 2019 20:58:28 +0000 (20:58 +0000)
This should fix the buildbot failures caused by r362139.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362151 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp

index b1d22b8..e0642ad 100644 (file)
@@ -540,7 +540,14 @@ Error RuntimeDyldImpl::computeTotalAllocSize(const ObjectFile &Obj,
         return errorCodeToError(EC);
 
       uint64_t StubBufSize = computeSectionStubBufSize(Obj, Section);
-      uint64_t SectionSize = DataSize + StubBufSize;
+
+      uint64_t PaddingSize = 0;
+      if (Name == ".eh_frame")
+        PaddingSize += 4;
+      if (StubBufSize != 0)
+        PaddingSize += getStubAlignment() - 1;
+
+      uint64_t SectionSize = DataSize + PaddingSize + StubBufSize;
 
       // The .eh_frame section (at least on Linux) needs an extra four bytes
       // padded