diff options
| author | Pete Cooper <peter_cooper@apple.com> | 2016-03-22 23:07:34 +0000 |
|---|---|---|
| committer | Pete Cooper <peter_cooper@apple.com> | 2016-03-22 23:07:34 +0000 |
| commit | 10bf15ee8ee3dc32c05ff78de79811345a0b9a2c (patch) | |
| tree | db4d615e00163b0f741b16330b5e156eaab8d32c /lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp | |
| parent | b9a9d7163f984123875a8c6276a1567fe79bd29f (diff) | |
| download | bcm5719-llvm-10bf15ee8ee3dc32c05ff78de79811345a0b9a2c.tar.gz bcm5719-llvm-10bf15ee8ee3dc32c05ff78de79811345a0b9a2c.zip | |
Move empty atom check to target independent code. NFC.
Turns out that checking only x86 for empty atoms to fix UBSan then
requires the same code in the other targets too. Better to just
check this in the main run loop instead of in each target.
Should be NFC, other than fixing UBSan failures.
llvm-svn: 264116
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp')
| -rw-r--r-- | lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp index b412a6ce7a8..a90e2913035 100644 --- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp +++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileFromAtoms.cpp @@ -672,6 +672,11 @@ void Util::copySectionContent(NormalizedFile &file) { uint8_t *sectionContent = file.ownedAllocations.Allocate<uint8_t>(si->size); normSect->content = llvm::makeArrayRef(sectionContent, si->size); for (AtomInfo &ai : si->atomsAndOffsets) { + if (!ai.atom->size()) { + assert(ai.atom->begin() == ai.atom->end() && + "Cannot have references without content"); + continue; + } uint8_t *atomContent = reinterpret_cast<uint8_t*> (§ionContent[ai.offsetInSection]); _archHandler.generateAtomContent(*ai.atom, r, addrForAtom, |

