summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-01-21 00:21:53 +0000
committerJim Grosbach <grosbach@apple.com>2012-01-21 00:21:53 +0000
commit8c592f13e3e4c6cb111342b7818d17b90931b602 (patch)
tree380608479e5c8fbb0d52cd07b9dfa83f9f792901 /llvm
parenta7956f92dfc43238089e099a861c74c1794fded6 (diff)
downloadbcm5719-llvm-8c592f13e3e4c6cb111342b7818d17b90931b602.tar.gz
bcm5719-llvm-8c592f13e3e4c6cb111342b7818d17b90931b602.zip
RuntimeDyld alignment adjustment from MachO file.
The MachO file stores section alignment as log2(alignment-in-bytes). The allocation routines want the raw alignment-in-bytes value, so adjust for that. llvm-svn: 148604
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
index 1926af8885d..fb005bba452 100644
--- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
+++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp
@@ -272,16 +272,18 @@ loadSegment64(const MachOObject *Obj,
// Allocate memory via the MM for the section.
uint8_t *Buffer;
uint32_t SectionID = Sections.size();
+ unsigned Align = 1 << Sect->Align; // .o file has log2 alignment.
if (Sect->Flags == 0x80000400)
- Buffer = MemMgr->allocateCodeSection(Sect->Size, Sect->Align, SectionID);
+ Buffer = MemMgr->allocateCodeSection(Sect->Size, Align, SectionID);
else
- Buffer = MemMgr->allocateDataSection(Sect->Size, Sect->Align, SectionID);
+ Buffer = MemMgr->allocateDataSection(Sect->Size, Align, SectionID);
DEBUG(dbgs() << "Loading "
<< ((Sect->Flags == 0x80000400) ? "text" : "data")
<< " (ID #" << SectionID << ")"
<< " '" << Sect->SegmentName << ","
<< Sect->Name << "' of size " << Sect->Size
+ << " (align " << Align << ")"
<< " to address " << Buffer << ".\n");
// Copy the payload from the object file into the allocated buffer.
OpenPOWER on IntegriCloud