[llvm] r348859 - [llvm-readelf] Add -e/--headers support to readobj/elf
Sid Manning via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 11 08:15:03 PST 2018
Author: sidneym
Date: Tue Dec 11 08:15:03 2018
New Revision: 348859
URL: http://llvm.org/viewvc/llvm-project?rev=348859&view=rev
Log:
[llvm-readelf] Add -e/--headers support to readobj/elf
Differential Revision: https://reviews.llvm.org/D55298
Added:
llvm/trunk/test/tools/llvm-readobj/headers.test
Modified:
llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
Added: llvm/trunk/test/tools/llvm-readobj/headers.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/headers.test?rev=348859&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/headers.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/headers.test Tue Dec 11 08:15:03 2018
@@ -0,0 +1,5 @@
+RUN: llvm-readelf -e %p/Inputs/trivial.obj.elf-i386 > %t.e
+RUN: llvm-readelf --headers %p/Inputs/trivial.obj.elf-i386 > %t.headers
+RUN: llvm-readelf -h -l -S %p/Inputs/trivial.obj.elf-i386 > %t.hlS
+RUN: cmp %t.e %t.headers
+RUN: cmp %t.e %t.hlS
Modified: llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp?rev=348859&r1=348858&r2=348859&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/llvm-readobj.cpp Tue Dec 11 08:15:03 2018
@@ -57,6 +57,14 @@ namespace opts {
"--section-groups and --elf-hash-histogram."));
cl::alias AllShort("a", cl::desc("Alias for --all"), cl::aliasopt(All));
+ // --headers -e
+ cl::opt<bool>
+ Headers("headers",
+ cl::desc("Equivalent to setting: --file-headers, --program-headers, "
+ "--section-headers"));
+ cl::alias HeadersShort("e", cl::desc("Alias for --headers"),
+ cl::aliasopt(Headers));
+
// -wide, -W
cl::opt<bool>
WideOutput("wide", cl::desc("Ignored for compatibility with GNU readelf"),
@@ -666,6 +674,12 @@ int main(int argc, const char *argv[]) {
opts::HashHistogram = true;
}
+ if (opts::Headers) {
+ opts::FileHeaders = true;
+ opts::ProgramHeaders = true;
+ opts::SectionHeaders = true;
+ }
+
// Default to stdin if no filename is specified.
if (opts::InputFilenames.size() == 0)
opts::InputFilenames.push_back("-");
More information about the llvm-commits
mailing list