diff options
| author | Lang Hames <lhames@gmail.com> | 2015-07-24 17:40:04 +0000 |
|---|---|---|
| committer | Lang Hames <lhames@gmail.com> | 2015-07-24 17:40:04 +0000 |
| commit | a8183e5c401cd44b8b0f494030e9b8699f423ea8 (patch) | |
| tree | cf7ea6633b881f176dc94dd6c7c333f594575375 /llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp | |
| parent | cda1cd5770aa840ef8792086f1e4d02d30a5fd00 (diff) | |
| download | bcm5719-llvm-a8183e5c401cd44b8b0f494030e9b8699f423ea8.tar.gz bcm5719-llvm-a8183e5c401cd44b8b0f494030e9b8699f423ea8.zip | |
[RuntimeDyld] MachO: Add support for ARM scattered vanilla relocations.
llvm-svn: 243126
Diffstat (limited to 'llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp')
| -rw-r--r-- | llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp index c0741141757..c61b1c2fb27 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp @@ -50,6 +50,42 @@ int64_t RuntimeDyldMachO::memcpyAddend(const RelocationEntry &RE) const { return static_cast<int64_t>(readBytesUnaligned(Src, NumBytes)); } +relocation_iterator RuntimeDyldMachO::processScatteredVANILLA( + unsigned SectionID, relocation_iterator RelI, + const ObjectFile &BaseObjT, + RuntimeDyldMachO::ObjSectionToIDMap &ObjSectionToID) { + const MachOObjectFile &Obj = + static_cast<const MachOObjectFile&>(BaseObjT); + MachO::any_relocation_info RE = + Obj.getRelocation(RelI->getRawDataRefImpl()); + + SectionEntry &Section = Sections[SectionID]; + uint32_t RelocType = Obj.getAnyRelocationType(RE); + bool IsPCRel = Obj.getAnyRelocationPCRel(RE); + unsigned Size = Obj.getAnyRelocationLength(RE); + uint64_t Offset = RelI->getOffset(); + uint8_t *LocalAddress = Section.Address + Offset; + unsigned NumBytes = 1 << Size; + int64_t Addend = readBytesUnaligned(LocalAddress, NumBytes); + + unsigned SymbolBaseAddr = Obj.getScatteredRelocationValue(RE); + section_iterator TargetSI = getSectionByAddress(Obj, SymbolBaseAddr); + assert(TargetSI != Obj.section_end() && "Can't find section for symbol"); + uint64_t SectionBaseAddr = TargetSI->getAddress(); + SectionRef TargetSection = *TargetSI; + bool IsCode = TargetSection.isText(); + uint32_t TargetSectionID = + findOrEmitSection(Obj, TargetSection, IsCode, ObjSectionToID); + + Addend -= SectionBaseAddr; + RelocationEntry R(SectionID, Offset, RelocType, Addend, IsPCRel, Size); + + addRelocationForSection(R, TargetSectionID); + + return ++RelI; +} + + RelocationValueRef RuntimeDyldMachO::getRelocationValueRef( const ObjectFile &BaseTObj, const relocation_iterator &RI, const RelocationEntry &RE, ObjSectionToIDMap &ObjSectionToID) { |

