mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-29 13:32:33 +00:00
llvm-objdump: Detach symbol listing from section enumeration for mach-o.
This reduces memory usage as we don't add the same symbol multiple times anymore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140278 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3ca2ad1156
commit
afbaf48fc4
@ -230,15 +230,6 @@ static void getSectionsAndSymbols(const macho::Header &Header,
|
||||
MachOObj->ReadSection(LCI, SectNum, Sect);
|
||||
Sections.push_back(copySection(Sect));
|
||||
|
||||
// Store the symbols in this section.
|
||||
if (SymtabLC) {
|
||||
for (unsigned i = 0; i != (*SymtabLC)->NumSymbolTableEntries; ++i) {
|
||||
InMemoryStruct<macho::SymbolTableEntry> STE;
|
||||
MachOObj->ReadSymbolTableEntry((*SymtabLC)->SymbolTableOffset, i,
|
||||
STE);
|
||||
Symbols.push_back(copySymbol(STE));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (LCI.Command.Type == macho::LCT_Segment64) {
|
||||
InMemoryStruct<macho::Segment64LoadCommand> Segment64LC;
|
||||
@ -250,16 +241,6 @@ static void getSectionsAndSymbols(const macho::Header &Header,
|
||||
InMemoryStruct<macho::Section64> Sect64;
|
||||
MachOObj->ReadSection64(LCI, SectNum, Sect64);
|
||||
Sections.push_back(copySection(Sect64));
|
||||
|
||||
// Store the symbols in this section.
|
||||
if (SymtabLC) {
|
||||
for (unsigned i = 0; i != (*SymtabLC)->NumSymbolTableEntries; ++i) {
|
||||
InMemoryStruct<macho::Symbol64TableEntry> STE;
|
||||
MachOObj->ReadSymbol64TableEntry((*SymtabLC)->SymbolTableOffset, i,
|
||||
STE);
|
||||
Symbols.push_back(copySymbol(STE));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (LCI.Command.Type == macho::LCT_FunctionStarts) {
|
||||
// We found a function starts segment, parse the addresses for later
|
||||
@ -270,6 +251,22 @@ static void getSectionsAndSymbols(const macho::Header &Header,
|
||||
MachOObj->ReadULEB128s(LLC->DataOffset, FoundFns);
|
||||
}
|
||||
}
|
||||
// Store the symbols.
|
||||
if (SymtabLC) {
|
||||
for (unsigned i = 0; i != (*SymtabLC)->NumSymbolTableEntries; ++i) {
|
||||
if (MachOObj->is64Bit()) {
|
||||
InMemoryStruct<macho::Symbol64TableEntry> STE;
|
||||
MachOObj->ReadSymbol64TableEntry((*SymtabLC)->SymbolTableOffset, i,
|
||||
STE);
|
||||
Symbols.push_back(copySymbol(STE));
|
||||
} else {
|
||||
InMemoryStruct<macho::SymbolTableEntry> STE;
|
||||
MachOObj->ReadSymbolTableEntry((*SymtabLC)->SymbolTableOffset, i,
|
||||
STE);
|
||||
Symbols.push_back(copySymbol(STE));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void llvm::DisassembleInputMachO(StringRef Filename) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user