summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2014-06-25 10:59:37 +0000
committerTim Northover <tnorthover@apple.com>2014-06-25 10:59:37 +0000
commit36bd9ab2c51d67907813b0ee5ef6490dd8d056d1 (patch)
tree3fb8d44487b32c19543786f4ce5ada63b9a5e455 /lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
parent42df5d2a8f2801b0f6b0e9a489fc5b32189364c3 (diff)
downloadbcm5719-llvm-36bd9ab2c51d67907813b0ee5ef6490dd8d056d1.tar.gz
bcm5719-llvm-36bd9ab2c51d67907813b0ee5ef6490dd8d056d1.zip
[mach-o] don't assume all sections have symbols
We were trying to examine the first symbol in a section that we wanted to atomize by symbols, even when there wasn't one. Instead, we should make the initial anonymous symbol cover the entire section in that situation. llvm-svn: 211681
Diffstat (limited to 'lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp')
-rw-r--r--lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
index 2be8d3b2db0..7de85e87603 100644
--- a/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
+++ b/lld/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp
@@ -284,11 +284,13 @@ std::error_code processSymboledSection(DefinedAtom::ContentType atomType,
if (symbols.empty() && section.content.empty())
return std::error_code();
- const uint64_t firstSymbolAddr = symbols.front()->value;
- if (firstSymbolAddr != section.address) {
+ uint64_t anonAtomEnd = symbols.empty()
+ ? section.address + section.content.size()
+ : (uint64_t)symbols.front()->value;
+ if (anonAtomEnd != section.address) {
// Section has anonymous content before first symbol.
- atomFromSymbol(atomType, section, file, section.address, StringRef(),
- 0, Atom::scopeTranslationUnit, firstSymbolAddr, copyRefs);
+ atomFromSymbol(atomType, section, file, section.address, StringRef(), 0,
+ Atom::scopeTranslationUnit, anonAtomEnd, copyRefs);
}
const Symbol *lastSym = nullptr;
OpenPOWER on IntegriCloud