diff --git a/test/tools/llvm-objdump/X86/macho-dylib.test b/test/tools/llvm-objdump/X86/macho-dylib.test index 0e31b8b930e..fd6ca80c58b 100644 --- a/test/tools/llvm-objdump/X86/macho-dylib.test +++ b/test/tools/llvm-objdump/X86/macho-dylib.test @@ -1,6 +1,10 @@ RUN: llvm-objdump -m -dylibs-used %p/Inputs/hello.exe.macho-x86_64 | FileCheck %s -check-prefix=USED RUN: llvm-objdump -m -dylib-id %p/Inputs/dylibLoadKinds.macho-x86_64 | FileCheck %s -check-prefix=ID +RUN: llvm-objdump -m -dylib-id -no-leading-headers %p/Inputs/dylibLoadKinds.macho-x86_64 | FileCheck %s -check-prefix=IDNOHEADERS USED: /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1) ID: /usr/lib/foo.dylib + +IDNOHEADERS-NOT: dylibLoadKinds.macho-x86_64: +IDNOHEADERS: /usr/lib/foo.dylib diff --git a/tools/llvm-objdump/MachODump.cpp b/tools/llvm-objdump/MachODump.cpp index 4e5241c5c50..b196170d4f7 100644 --- a/tools/llvm-objdump/MachODump.cpp +++ b/tools/llvm-objdump/MachODump.cpp @@ -71,6 +71,9 @@ static cl::opt FullLeadingAddr("full-leading-addr", static cl::opt NoLeadingAddr("no-leading-addr", cl::desc("Print no leading address")); +static cl::opt NoLeadingHeaders("no-leading-headers", + cl::desc("Print no leading headers")); + cl::opt llvm::UniversalHeaders("universal-headers", cl::desc("Print Mach-O universal headers " "(requires -macho)")); @@ -1190,12 +1193,14 @@ static void ProcessMachO(StringRef Name, MachOObjectFile *MachOOF, if (Disassemble || PrivateHeaders || ExportsTrie || Rebase || Bind || SymbolTable || LazyBind || WeakBind || IndirectSymbols || DataInCode || LinkOptHints || DylibsUsed || DylibId || ObjcMetaData || (FilterSections.size() != 0)) { - outs() << Name; - if (!ArchiveMemberName.empty()) - outs() << '(' << ArchiveMemberName << ')'; - if (!ArchitectureName.empty()) - outs() << " (architecture " << ArchitectureName << ")"; - outs() << ":\n"; + if (!NoLeadingHeaders) { + outs() << Name; + if (!ArchiveMemberName.empty()) + outs() << '(' << ArchiveMemberName << ')'; + if (!ArchitectureName.empty()) + outs() << " (architecture " << ArchitectureName << ")"; + outs() << ":\n"; + } } // To use the report_error() form with an ArchiveName and FileName set // these up based on what is passed for Name and ArchiveMemberName.