[llvm-readobj] Accept (and ignore) --wide (-W) command-line switch

Accept and ignore --wide/-W. In GNU readelf this switch is
necessary to get the output format that's consistent between
32-bit and 64-bit targets. llvm-readobj always produces that
output format.

Patch by Roland McGrath

Differential Revision: https://reviews.llvm.org/D33873

llvm-svn: 308396
This commit is contained in:
Petr Hosek 2017-07-18 23:58:15 +00:00
parent bf60f68c2c
commit ef54b49d16
2 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,12 @@ RUN: llvm-readobj -s %p/Inputs/relocs.obj.elf-i386 --elf-output-style=GNU \
RUN: | FileCheck %s -check-prefix ELF32
RUN: llvm-readobj -S %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
RUN: | FileCheck %s -check-prefix ELF64
RUN: llvm-readobj --wide --sections \
RUN: %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
RUN: | FileCheck %s -check-prefix ELF64
RUN: llvm-readobj -W --sections \
RUN: %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
RUN: | FileCheck %s -check-prefix ELF64
ELF32: Section Headers:
ELF32-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al

View File

@ -50,6 +50,13 @@ namespace opts {
cl::desc("<input object files>"),
cl::ZeroOrMore);
// -wide, -W
cl::opt<bool> WideOutput("wide",
cl::desc("Ignored for compatibility with GNU readelf"));
cl::alias WideOutputShort("W",
cl::desc("Alias for --wide"),
cl::aliasopt(WideOutput));
// -file-headers, -h
cl::opt<bool> FileHeaders("file-headers",
cl::desc("Display file headers "));
@ -544,6 +551,8 @@ int main(int argc, const char *argv[]) {
// Register the target printer for --version.
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
opts::WideOutput.setHiddenFlag(cl::Hidden);
cl::ParseCommandLineOptions(argc, argv, "LLVM Object Reader\n");
// Default to stdin if no filename is specified.