]> granicus.if.org Git - llvm/commitdiff
[llvm-readobj] Accept -S as an alias for --sections
authorPetr Hosek <phosek@chromium.org>
Tue, 18 Jul 2017 23:35:22 +0000 (23:35 +0000)
committerPetr Hosek <phosek@chromium.org>
Tue, 18 Jul 2017 23:35:22 +0000 (23:35 +0000)
In GNU readelf, the short option for --sections is upper-case -S.

Note that GNU uses lower-case -s to mean --symbols, while LLVM
uses -s to mean --sections and -t to mean --symbols (-t has yet a
different meaning in GNU). So command-line uses with -S can now
be compatible, but uses with -s or -t are still incompatible.

Patch by Roland McGrath

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308392 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-readobj/gnu-sections.test
tools/llvm-readobj/llvm-readobj.cpp

index fb90ce44d10f91e68f4a412eb1d3620cc8b22f51..34bcaabf68e12e1721211bfed27b06326bf86b71 100644 (file)
@@ -1,6 +1,6 @@
 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: llvm-readobj -S %p/Inputs/relocs.obj.elf-x86_64 --elf-output-style=GNU \
 RUN:   | FileCheck %s -check-prefix ELF64
 
 ELF32:    Section Headers:
index 51991a3f067ba7de763493858e1a48a2f65d160e..0a76368883a728ab2e12a888c1f67c0d87261936 100644 (file)
@@ -57,12 +57,16 @@ namespace opts {
     cl::desc("Alias for --file-headers"),
     cl::aliasopt(FileHeaders));
 
-  // -sections, -s
+  // -sections, -s, -S
+  // Note: In GNU readelf, -s means --symbols!
   cl::opt<bool> Sections("sections",
     cl::desc("Display all sections."));
   cl::alias SectionsShort("s",
     cl::desc("Alias for --sections"),
     cl::aliasopt(Sections));
+  cl::alias SectionsShortUpper("S",
+    cl::desc("Alias for --sections"),
+    cl::aliasopt(Sections));
 
   // -section-relocations, -sr
   cl::opt<bool> SectionRelocations("section-relocations",