X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FExecutionEngine%2FRuntimeDyld%2FRuntimeDyldMachO.cpp;h=4553ef42df75e51806ff6781ba95113aa625ee63;hb=b0934ab7d811e23bf530371976b8b35f3242169c;hp=1926af8885d95fed3dac81b70ef6b471c725d07c;hpb=b442d7c6bf920b892b4b098923c1652700ee07e6;p=oota-llvm.git diff --git a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp index 1926af8885d..4553ef42df7 100644 --- a/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp +++ b/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp @@ -15,7 +15,7 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/STLExtras.h" -#include "RuntimeDyldImpl.h" +#include "RuntimeDyldMachO.h" using namespace llvm; using namespace llvm::object; @@ -26,7 +26,7 @@ resolveRelocation(uint8_t *Address, uint64_t Value, bool isPCRel, unsigned Type, unsigned Size, int64_t Addend) { // This just dispatches to the proper target specific routine. switch (CPUType) { - default: assert(0 && "Unsupported CPU type!"); + default: llvm_unreachable("Unsupported CPU type!"); case mach::CTM_x86_64: return resolveX86_64Relocation((uintptr_t)Address, (uintptr_t)Value, isPCRel, Type, Size, Addend); @@ -34,7 +34,6 @@ resolveRelocation(uint8_t *Address, uint64_t Value, bool isPCRel, return resolveARMRelocation((uintptr_t)Address, (uintptr_t)Value, isPCRel, Type, Size, Addend); } - llvm_unreachable(""); } bool RuntimeDyldMachO:: @@ -91,7 +90,6 @@ resolveARMRelocation(uintptr_t Address, uintptr_t Value, bool isPCRel, default: llvm_unreachable("Invalid relocation type!"); case macho::RIT_Vanilla: { - llvm_unreachable("Invalid relocation type!"); // Mask in the target value a byte at a time (we don't have an alignment // guarantee for the target address, so this is safest). uint8_t *p = (uint8_t*)Address; @@ -272,16 +270,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.