mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[llvm-readobj] Make -s and -t match llvm-readelf
llvm-readobj is an internal testing tool for binary formats. Its output and command line options do not need to be stable. It isn't supposed to be part of a build process. llvm-readelf was created as a user-facing utility and its interface intends to be compatible with GNU readelf (unless there are good reasons not to). The two tools have mostly compatible options. -s and -t are noticeable exceptions due to history. I think the cost of keeping the inconsistency overweighs the little history-compatible benefit and hinders transition from cl::opt to OptTable, so let's change it. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D105055
This commit is contained in:
parent
b74e84fd4f
commit
07d4532a78
@ -95,7 +95,7 @@ file formats.
|
||||
|
||||
Display the relocation entries in the file.
|
||||
|
||||
.. option:: --sections, --section-headers, -s, -S
|
||||
.. option:: --sections, --section-headers, -S
|
||||
|
||||
Display all sections.
|
||||
|
||||
@ -123,7 +123,7 @@ file formats.
|
||||
Display the specified section(s) as a list of strings. ``section`` may be a
|
||||
section index or section name.
|
||||
|
||||
.. option:: --symbols, --syms, -t
|
||||
.. option:: --symbols, --syms, -s
|
||||
|
||||
Display the symbol table.
|
||||
|
||||
|
@ -164,6 +164,11 @@ Changes to the LLVM tools
|
||||
``--x86-asm-syntax`` is a deprecated internal option which will be removed in LLVM 14.0.0.
|
||||
(`D101695 <https://reviews.llvm.org/D101695>`_)
|
||||
|
||||
* The llvm-readobj short aliases ``-s`` (previously ``--sections``) and ``-t``
|
||||
(previously ``--syms``) have been changed to ``--syms`` and
|
||||
``--section-details`` respectively, to match llvm-readelf.
|
||||
(`D105055 <https://reviews.llvm.org/D105055>`_)
|
||||
|
||||
Changes to LLDB
|
||||
---------------------------------
|
||||
|
||||
|
@ -52,7 +52,7 @@ DynamicSymbols:
|
||||
## llvm-readobj does not support merged args, because it also supports some old
|
||||
## flags (-st, -sd, etc.), and it would be confusing if only some merged args
|
||||
## were supported.
|
||||
# RUN: not llvm-readobj -aeWhSrnudlVgIs %t.o 2>&1 | FileCheck %s --check-prefix=UNKNOWN
|
||||
# RUN: not llvm-readobj -aeWhSsrnudlVgIS %t.o 2>&1 | FileCheck %s --check-prefix=UNKNOWN
|
||||
|
||||
# CHECK-NOT: Unknown command line argument
|
||||
# UNKNOWN: for the --section-headers option: may only occur zero or one times!
|
||||
|
@ -10,16 +10,12 @@
|
||||
# RUN: llvm-readobj --sections %t64 > %t64.llvm.sections
|
||||
# RUN: llvm-readobj -S %t64 > %t64.llvm.upper.s
|
||||
# RUN: cmp %t64.llvm.sections %t64.llvm.upper.s
|
||||
# RUN: llvm-readobj -s %t64 > %t64.llvm.lower.s
|
||||
# RUN: cmp %t64.llvm.sections %t64.llvm.lower.s
|
||||
# RUN: llvm-readobj --section-headers %t64 > %t64.llvm.section-headers
|
||||
# RUN: cmp %t64.llvm.sections %t64.llvm.section-headers
|
||||
|
||||
# RUN: llvm-readobj --sections %t32 > %t32.llvm.sections
|
||||
# RUN: llvm-readobj -S %t32 > %t32.llvm.upper.s
|
||||
# RUN: cmp %t32.llvm.sections %t32.llvm.upper.s
|
||||
# RUN: llvm-readobj -s %t32 > %t32.llvm.lower.s
|
||||
# RUN: cmp %t32.llvm.sections %t32.llvm.lower.s
|
||||
# RUN: llvm-readobj --section-headers %t32 > %t32.llvm.section-headers
|
||||
# RUN: cmp %t32.llvm.sections %t32.llvm.section-headers
|
||||
|
||||
|
@ -70,17 +70,13 @@
|
||||
# RUN: llvm-readobj --symbols %t64 > %t.symbols
|
||||
# RUN: llvm-readobj --syms %t64 > %t.syms
|
||||
# RUN: cmp %t.symbols %t.syms
|
||||
# RUN: llvm-readobj -t %t64 > %t.t
|
||||
# RUN: cmp %t.symbols %t.t
|
||||
# RUN: llvm-readelf -s --elf-output-style=LLVM %t64 > %t.lowers
|
||||
# RUN: cmp %t.symbols %t.lowers
|
||||
# RUN: llvm-readobj -s %t64 | diff %t.symbols -
|
||||
# RUN: llvm-readelf -s --elf-output-style=LLVM %t64 | diff %t.symbols -
|
||||
|
||||
# RUN: llvm-readelf --symbols %t64 > %t.symbols.gnu
|
||||
# RUN: llvm-readelf --syms %t64 > %t.syms.gnu
|
||||
# RUN: cmp %t.symbols.gnu %t.syms.gnu
|
||||
|
||||
## -s is an llvm-readobj option to dump sections.
|
||||
# RUN: llvm-readobj -s --elf-output-style=GNU %t64 | FileCheck %s --implicit-check-not="Symbol table"
|
||||
# RUN: llvm-readelf -s %t64 | diff %t.symbols.gnu -
|
||||
|
||||
## Case 3: Test that both regular and dynamic symbols are dumped when `--symbols` and `--dyn-symbols`
|
||||
## are specified together. Note that the order is different for different styles.
|
||||
|
@ -54,8 +54,6 @@ HELP: OVERVIEW: LLVM Object Reader
|
||||
OBJ: llvm-readobj{{.*}} [options] <input object files>
|
||||
ELF: llvm-readelf{{.*}} [options] <input object files>
|
||||
HELP: OPTIONS:
|
||||
OBJ: -s - Alias for --section-headers
|
||||
OBJ: -t - Alias for --symbols
|
||||
ELF: -s - Alias for --symbols
|
||||
ELF: -t - Alias for --section-details
|
||||
HELP -s - Alias for --symbols
|
||||
HELP -t - Alias for --section-details
|
||||
HELP: @FILE
|
||||
|
@ -2,7 +2,7 @@
|
||||
## containing symbols with duplicate names (but different name suffixes).
|
||||
|
||||
# RUN: yaml2obj --docnum=1 %s -o %t1
|
||||
# RUN: llvm-readobj -t %t1 | FileCheck %s --check-prefix=CASE1
|
||||
# RUN: llvm-readobj --syms %t1 | FileCheck %s --check-prefix=CASE1
|
||||
|
||||
# CASE1: Name: localfoo (1)
|
||||
# CASE1: Name: localfoo (1)
|
||||
|
@ -142,6 +142,10 @@ namespace opts {
|
||||
// Also -t in llvm-readelf mode.
|
||||
cl::opt<bool> SectionDetails("section-details",
|
||||
cl::desc("Display the section details"));
|
||||
static cl::alias SectionDetailsShort("t",
|
||||
cl::desc("Alias for --section-details"),
|
||||
cl::aliasopt(SectionDetails),
|
||||
cl::NotHidden);
|
||||
|
||||
// --symbols
|
||||
// Also -s in llvm-readelf mode, or -t in llvm-readobj mode.
|
||||
@ -151,6 +155,9 @@ namespace opts {
|
||||
"symbol table when using GNU output style for ELF"));
|
||||
cl::alias SymbolsGNU("syms", cl::desc("Alias for --symbols"),
|
||||
cl::aliasopt(Symbols));
|
||||
static cl::alias SymbolsShort("s", cl::desc("Alias for --symbols"),
|
||||
cl::aliasopt(Symbols), cl::NotHidden,
|
||||
cl::Grouping);
|
||||
|
||||
// --dyn-symbols, --dyn-syms
|
||||
// Also --dt in llvm-readobj mode.
|
||||
@ -694,16 +701,6 @@ static void dumpInput(StringRef File, ScopedPrinter &Writer) {
|
||||
|
||||
/// Registers aliases that should only be allowed by readobj.
|
||||
static void registerReadobjAliases() {
|
||||
// -s has meant --sections for a very long time in llvm-readobj despite
|
||||
// meaning --symbols in readelf.
|
||||
static cl::alias SectionsShort("s", cl::desc("Alias for --section-headers"),
|
||||
cl::aliasopt(opts::SectionHeaders),
|
||||
cl::NotHidden);
|
||||
|
||||
// llvm-readelf reserves it for --section-details.
|
||||
static cl::alias SymbolsShort("t", cl::desc("Alias for --symbols"),
|
||||
cl::aliasopt(opts::Symbols), cl::NotHidden);
|
||||
|
||||
// The following two-letter aliases are only provided for readobj, as readelf
|
||||
// allows single-letter args to be grouped together.
|
||||
static cl::alias SectionRelocationsShort(
|
||||
@ -721,16 +718,6 @@ static void registerReadobjAliases() {
|
||||
|
||||
/// Registers aliases that should only be allowed by readelf.
|
||||
static void registerReadelfAliases() {
|
||||
// -s is here because for readobj it means --sections.
|
||||
static cl::alias SymbolsShort("s", cl::desc("Alias for --symbols"),
|
||||
cl::aliasopt(opts::Symbols), cl::NotHidden,
|
||||
cl::Grouping);
|
||||
|
||||
// -t is here because for readobj it is an alias for --symbols.
|
||||
static cl::alias SectionDetailsShort(
|
||||
"t", cl::desc("Alias for --section-details"),
|
||||
cl::aliasopt(opts::SectionDetails), cl::NotHidden);
|
||||
|
||||
// Allow all single letter flags to be grouped together.
|
||||
for (auto &OptEntry : cl::getRegisteredOptions()) {
|
||||
StringRef ArgName = OptEntry.getKey();
|
||||
|
Loading…
Reference in New Issue
Block a user