mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 05:24:01 +00:00
Add the option, -non-verbose to llvm-objdump used with -macho to print things
using numeric values and not their symbolic constant names. The routines that print Mach-O stuff already had a verbose parameter and this change is just changing the passing true to passing !NonVerbose. With just a couple of fixes and a bunch of test case updates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232182 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -101,6 +101,11 @@ cl::opt<bool>
|
||||
cl::desc("Print the info plist section as strings for "
|
||||
"Mach-O objects (requires -macho)"));
|
||||
|
||||
cl::opt<bool>
|
||||
llvm::NonVerbose("non-verbose",
|
||||
cl::desc("Print the info for Mach-O objects in "
|
||||
"non-verbose or numeric form (requires -macho)"));
|
||||
|
||||
static cl::list<std::string>
|
||||
ArchFlags("arch", cl::desc("architecture(s) from a Mach-O file to dump"),
|
||||
cl::ZeroOrMore);
|
||||
@ -328,15 +333,17 @@ static void PrintIndirectSymbolTable(MachOObjectFile *O, bool verbose,
|
||||
continue;
|
||||
}
|
||||
outs() << format("%5u ", indirect_symbol);
|
||||
MachO::symtab_command Symtab = O->getSymtabLoadCommand();
|
||||
if (indirect_symbol < Symtab.nsyms) {
|
||||
symbol_iterator Sym = O->getSymbolByIndex(indirect_symbol);
|
||||
SymbolRef Symbol = *Sym;
|
||||
StringRef SymName;
|
||||
Symbol.getName(SymName);
|
||||
outs() << SymName;
|
||||
} else {
|
||||
outs() << "?";
|
||||
if (verbose) {
|
||||
MachO::symtab_command Symtab = O->getSymtabLoadCommand();
|
||||
if (indirect_symbol < Symtab.nsyms) {
|
||||
symbol_iterator Sym = O->getSymbolByIndex(indirect_symbol);
|
||||
SymbolRef Symbol = *Sym;
|
||||
StringRef SymName;
|
||||
Symbol.getName(SymName);
|
||||
outs() << SymName;
|
||||
} else {
|
||||
outs() << "?";
|
||||
}
|
||||
}
|
||||
outs() << "\n";
|
||||
}
|
||||
@ -899,7 +906,7 @@ static void DumpRawSectionContents(MachOObjectFile *O, const char *sect,
|
||||
if (O->is64Bit())
|
||||
outs() << format("%016" PRIx64, addr) << "\t";
|
||||
else
|
||||
outs() << format("%08" PRIx64, sect) << "\t";
|
||||
outs() << format("%08" PRIx64, addr) << "\t";
|
||||
for (j = 0; j < 16 && i + j < size; j++) {
|
||||
uint8_t byte_word = *(sect + i + j);
|
||||
outs() << format("%02" PRIx32, (uint32_t)byte_word) << " ";
|
||||
@ -1111,9 +1118,9 @@ static void ProcessMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
||||
if (Disassemble)
|
||||
DisassembleMachO(Filename, MachOOF, "__TEXT", "__text");
|
||||
if (IndirectSymbols)
|
||||
PrintIndirectSymbols(MachOOF, true);
|
||||
PrintIndirectSymbols(MachOOF, !NonVerbose);
|
||||
if (DataInCode)
|
||||
PrintDataInCodeTable(MachOOF, true);
|
||||
PrintDataInCodeTable(MachOOF, !NonVerbose);
|
||||
if (LinkOptHints)
|
||||
PrintLinkOptHints(MachOOF);
|
||||
if (Relocations)
|
||||
@ -1123,7 +1130,7 @@ static void ProcessMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
||||
if (SectionContents)
|
||||
PrintSectionContents(MachOOF);
|
||||
if (DumpSections.size() != 0)
|
||||
DumpSectionContents(Filename, MachOOF, true);
|
||||
DumpSectionContents(Filename, MachOOF, !NonVerbose);
|
||||
if (InfoPlist)
|
||||
DumpInfoPlistSectionContents(Filename, MachOOF);
|
||||
if (SymbolTable)
|
||||
@ -1462,7 +1469,7 @@ void llvm::ParseInputMachO(StringRef Filename) {
|
||||
}
|
||||
if (UniversalHeaders) {
|
||||
if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(&Bin))
|
||||
printMachOUniversalHeaders(UB, true);
|
||||
printMachOUniversalHeaders(UB, !NonVerbose);
|
||||
}
|
||||
if (MachOUniversalBinary *UB = dyn_cast<MachOUniversalBinary>(&Bin)) {
|
||||
// If we have a list of architecture flags specified dump only those.
|
||||
@ -5461,8 +5468,8 @@ void llvm::printMachOFileHeader(const object::ObjectFile *Obj) {
|
||||
uint32_t ncmds = 0;
|
||||
uint32_t filetype = 0;
|
||||
uint32_t cputype = 0;
|
||||
getAndPrintMachHeader(file, ncmds, filetype, cputype, true);
|
||||
PrintLoadCommands(file, ncmds, filetype, cputype, true);
|
||||
getAndPrintMachHeader(file, ncmds, filetype, cputype, !NonVerbose);
|
||||
PrintLoadCommands(file, ncmds, filetype, cputype, !NonVerbose);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Reference in New Issue
Block a user