diff options
| author | Nick Kledzik <kledzik@apple.com> | 2014-05-29 23:50:48 +0000 |
|---|---|---|
| committer | Nick Kledzik <kledzik@apple.com> | 2014-05-29 23:50:48 +0000 |
| commit | f317d66c315e09da0481843256be83512ba114b8 (patch) | |
| tree | 7162434c0b10504118b4cfc32020aac1574e6d27 /lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp | |
| parent | 35b80eaef19f9a928273cc35b6fd6d91016b2110 (diff) | |
| download | bcm5719-llvm-f317d66c315e09da0481843256be83512ba114b8.tar.gz bcm5719-llvm-f317d66c315e09da0481843256be83512ba114b8.zip | |
[mach-0] Add support for parsing compact unwind info section
llvm-svn: 209865
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp index 569f32f09de..60f2ffbd8e8 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp @@ -229,6 +229,27 @@ static error_code processCFISection(MachOFile &file, const Section §ion, return error_code::success(); } +static error_code +processCompactUnwindSection(MachOFile &file, const Section §ion, + bool is64, bool copyRefs) { + const uint32_t cuObjSize = (is64 ? 32 : 20); + if ((section.content.size() % cuObjSize) != 0) { + return make_dynamic_error_code(Twine("Section __LD/__compact_unwind has a " + "size (" + Twine(section.content.size()) + + ") that is not a multiple of " + + Twine(cuObjSize))); + } + unsigned offset = 0; + for (size_t i = 0, e = section.content.size(); i != e; i += cuObjSize) { + ArrayRef<uint8_t> byteContent = section.content.slice(offset, cuObjSize); + file.addDefinedAtom(StringRef(), DefinedAtom::scopeTranslationUnit, + DefinedAtom::typeCompactUnwindInfo, + DefinedAtom::mergeNo, byteContent, copyRefs); + offset += cuObjSize; + } + return error_code::success(); +} + static error_code processSection(MachOFile &file, const Section §ion, bool is64, bool swap, bool copyRefs, SymbolsInSection &symbolsInSect) { @@ -244,6 +265,10 @@ static error_code processSection(MachOFile &file, const Section §ion, section.sectionName.equals("__cfstring")) { symbolsInSect = symbolsIllegal; return processCFStringSection(file, section, is64, copyRefs); + } else if (section.segmentName.equals("__LD") && + section.sectionName.equals("__compact_unwind")) { + symbolsInSect = symbolsIllegal; + return processCompactUnwindSection(file, section, is64, copyRefs); } break; case llvm::MachO::S_COALESCED: |

