[PATCH] D48810: [llvm-objdump] Add --file-headers (-f) option
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 3 02:29:32 PDT 2018
jhenderson added a comment.
I was going to ask for a documentation update, but it turns out that there is no documentation for llvm-objdump outside the help text...!
It looks to me like GNU objdump also prints some flags when -f is used. Is this something you plan to add later?
================
Comment at: lib/Object/COFFObjectFile.cpp:916
+ return PE32Header->AddressOfEntryPoint;
+ return errorCodeToError(object_error::parse_failed);
+}
----------------
It looks like GNU objdump prints 0 rather than failing in this case.
================
Comment at: test/tools/llvm-objdump/file-headers.test:1
+# RUN: llvm-objdump -f %p/Inputs/common-symbol-elf | FileCheck %s
+
----------------
I must admit that I'm surprised we're not using yaml2obj to test here. I am not familiar with llvm-objdump, and I see that using pre-canned binaries is normal for its tests, but how do you feel about using yaml2obj instead?
Assuming you'd prefer to use pre-canned binaries, is it normal in the tests to use files that aren't specifically for that test?
There should also probably be separate elf and coff test cases.
================
Comment at: tools/llvm-objdump/llvm-objdump.cpp:2287
Disassemble = true;
- if (!Disassemble
- && !Relocations
- && !DynamicRelocations
- && !SectionHeaders
- && !SectionContents
- && !SymbolTable
- && !UnwindInfo
- && !PrivateHeaders
- && !FirstPrivateHeader
- && !ExportsTrie
- && !Rebase
- && !Bind
- && !LazyBind
- && !WeakBind
- && !RawClangAST
- && !(UniversalHeaders && MachOOpt)
- && !(ArchiveHeaders && MachOOpt)
- && !(IndirectSymbols && MachOOpt)
- && !(DataInCode && MachOOpt)
- && !(LinkOptHints && MachOOpt)
- && !(InfoPlist && MachOOpt)
- && !(DylibsUsed && MachOOpt)
- && !(DylibId && MachOOpt)
- && !(ObjcMetaData && MachOOpt)
- && !(FilterSections.size() != 0 && MachOOpt)
- && !PrintFaultMaps
- && DwarfDumpType == DIDT_Null) {
+ if (!Disassemble && !Relocations && !DynamicRelocations && !SectionHeaders &&
+ !SectionContents && !SymbolTable && !UnwindInfo && !PrivateHeaders &&
----------------
Assuming this is what clang-format does, I suppose that this is right, but it definitely does make it a lot harder to follow :-(
Repository:
rL LLVM
https://reviews.llvm.org/D48810
More information about the llvm-commits
mailing list