[llvm] 1642667 - [llvm-objdump --macho] Rename --dyld_info to --dyld-info

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 17 09:58:39 PDT 2022


Author: Nico Weber
Date: 2022-08-17T12:58:29-04:00
New Revision: 164266739298b39d3eac8d79ad12d1d654e2825e

URL: https://github.com/llvm/llvm-project/commit/164266739298b39d3eac8d79ad12d1d654e2825e
DIFF: https://github.com/llvm/llvm-project/commit/164266739298b39d3eac8d79ad12d1d654e2825e.diff

LOG: [llvm-objdump --macho] Rename --dyld_info to --dyld-info

llvm-objdump takes foo-bar style flags, while llvm-otool takes foo_bar style
flags.  dyld_info was the only exception to that.

Add a -dyld_info flag to llvm-otool instead.

(Both in llvm-objdump and llvm-otool, the flag doesn't really do anything
yet.)

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

Added: 
    llvm/test/tools/llvm-objdump/MachO/dyld-info.test

Modified: 
    llvm/docs/CommandGuide/llvm-objdump.rst
    llvm/docs/CommandGuide/llvm-otool.rst
    llvm/test/Object/AArch64/chained-fixups-header.test
    llvm/tools/llvm-objdump/ObjdumpOpts.td
    llvm/tools/llvm-objdump/OtoolOpts.td
    llvm/tools/llvm-objdump/llvm-objdump.cpp

Removed: 
    llvm/test/tools/llvm-objdump/MachO/dyld_info.test


################################################################################
diff  --git a/llvm/docs/CommandGuide/llvm-objdump.rst b/llvm/docs/CommandGuide/llvm-objdump.rst
index 19b33391a9493..9f3fba4bf0df9 100644
--- a/llvm/docs/CommandGuide/llvm-objdump.rst
+++ b/llvm/docs/CommandGuide/llvm-objdump.rst
@@ -316,7 +316,7 @@ MACH-O ONLY OPTIONS AND COMMANDS
 
   Print chained fixup information.
 
-.. option:: --dyld_info
+.. option:: --dyld-info
 
   Print bind and rebase information used by dyld to resolve external
   references in a final linked binary.

diff  --git a/llvm/docs/CommandGuide/llvm-otool.rst b/llvm/docs/CommandGuide/llvm-otool.rst
index f2ed563b6303d..5a517a2c8ecee 100644
--- a/llvm/docs/CommandGuide/llvm-otool.rst
+++ b/llvm/docs/CommandGuide/llvm-otool.rst
@@ -31,6 +31,10 @@ OPTIONS
 
  Print linker optimization hints.
 
+.. option:: -dyld_info
+
+  Print bind and rebase information.
+
 .. option:: -D
 
  Print shared library id.

diff  --git a/llvm/test/Object/AArch64/chained-fixups-header.test b/llvm/test/Object/AArch64/chained-fixups-header.test
index 9eebd15384d21..5bdf07a56d360 100644
--- a/llvm/test/Object/AArch64/chained-fixups-header.test
+++ b/llvm/test/Object/AArch64/chained-fixups-header.test
@@ -1,24 +1,24 @@
 REQUIRES: host-byteorder-little-endian
 RUN: cat %p/../Inputs/MachO/chained-fixups.yaml \
 RUN:   | sed 's/__LINKEDIT:      00000000/__LINKEDIT:      AB000000/' \
-RUN:   | yaml2obj | not llvm-objdump --macho --dyld_info - 2>&1 \
+RUN:   | yaml2obj | not llvm-objdump --macho --dyld-info - 2>&1 \
 RUN:   | FileCheck %s --check-prefix=HEADER1
 HEADER1: truncated or malformed object (bad chained fixups: unknown version: 171)
 
 RUN: cat %p/../Inputs/MachO/chained-fixups.yaml \
 RUN:   | sed 's/1000000010000000/1000000AB0000000/' \
-RUN:   | yaml2obj | not llvm-objdump --macho --dyld_info - 2>&1 \
+RUN:   | yaml2obj | not llvm-objdump --macho --dyld-info - 2>&1 \
 RUN:   | FileCheck %s --check-prefix=HEADER2
 HEADER2: truncated or malformed object (bad chained fixups: unknown imports format: 171)
 
 RUN: cat %p/../Inputs/MachO/chained-fixups.yaml \
 RUN:   | sed 's/20000000/01000000/' \
-RUN:   | yaml2obj | not llvm-objdump --macho --dyld_info - 2>&1 \
+RUN:   | yaml2obj | not llvm-objdump --macho --dyld-info - 2>&1 \
 RUN:   | FileCheck %s --check-prefix=HEADER3
 HEADER3: truncated or malformed object (bad chained fixups: image starts offset 1 overlaps with chained fixups header)
 
 RUN: cat %p/../Inputs/MachO/chained-fixups.yaml \
 RUN:   | sed 's/20000000/FF000000/' \
-RUN:   | yaml2obj | not llvm-objdump --macho --dyld_info - 2>&1 \
+RUN:   | yaml2obj | not llvm-objdump --macho --dyld-info - 2>&1 \
 RUN:   | FileCheck %s --check-prefix=HEADER4
 HEADER4: truncated or malformed object (bad chained fixups: image starts end 33031 extends past end 32856)

diff  --git a/llvm/test/tools/llvm-objdump/MachO/dyld-info.test b/llvm/test/tools/llvm-objdump/MachO/dyld-info.test
new file mode 100644
index 0000000000000..85e94688ae87f
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/MachO/dyld-info.test
@@ -0,0 +1,9 @@
+RUN: llvm-objdump --macho --dyld-info %p/Inputs/bind.macho-x86_64 \
+RUN:   | FileCheck %s --match-full-lines --strict-whitespace \
+RUN:     --implicit-check-not={{.}}
+RUN: llvm-otool -dyld_info %p/Inputs/bind.macho-x86_64 \
+RUN:   | FileCheck %s --match-full-lines --strict-whitespace \
+RUN:     --implicit-check-not={{.}}
+
+CHECK:{{.*}}bind.macho-x86_64:
+CHECK:dyld information:

diff  --git a/llvm/test/tools/llvm-objdump/MachO/dyld_info.test b/llvm/test/tools/llvm-objdump/MachO/dyld_info.test
deleted file mode 100644
index 2af76077cd757..0000000000000
--- a/llvm/test/tools/llvm-objdump/MachO/dyld_info.test
+++ /dev/null
@@ -1,6 +0,0 @@
-RUN: llvm-objdump --macho --dyld_info %p/Inputs/bind.macho-x86_64 \
-RUN:   | FileCheck %s --match-full-lines --strict-whitespace \
-RUN:     --implicit-check-not={{.}}
-
-CHECK:{{.*}}bind.macho-x86_64:
-CHECK:dyld information:

diff  --git a/llvm/tools/llvm-objdump/ObjdumpOpts.td b/llvm/tools/llvm-objdump/ObjdumpOpts.td
index acfdf0010131e..b912dc3692161 100644
--- a/llvm/tools/llvm-objdump/ObjdumpOpts.td
+++ b/llvm/tools/llvm-objdump/ObjdumpOpts.td
@@ -303,7 +303,7 @@ def chained_fixups : Flag<["--"], "chained-fixups">,
   HelpText<"Print chained fixup information (requires --macho)">,
   Group<grp_mach_o>;
 
-def dyld_info : Flag<["--"], "dyld_info">,
+def dyld_info : Flag<["--"], "dyld-info">,
   HelpText<"Print bind and rebase information used by dyld to resolve "
            "external references in a final linked binary "
            "(requires --macho)">,

diff  --git a/llvm/tools/llvm-objdump/OtoolOpts.td b/llvm/tools/llvm-objdump/OtoolOpts.td
index 71ac541d06289..dc7a5b445cffe 100644
--- a/llvm/tools/llvm-objdump/OtoolOpts.td
+++ b/llvm/tools/llvm-objdump/OtoolOpts.td
@@ -39,12 +39,13 @@ def X : Flag<["-"], "X">, HelpText<"omit leading addresses or headers">;
 
 def chained_fixups : Flag<["-"], "chained_fixups">,
   HelpText<"print chained fixup information">;
+def dyld_info : Flag<["-"], "dyld_info">,
+  HelpText<"print bind and rebase information">;
 
 // Not (yet?) implemented:
 // def a : Flag<["-"], "a">, HelpText<"print archive header">;
 // -c print argument strings of a core file
 // -m don't use archive(member) syntax
-// -dyld_info
 // -dyld_opcodes
 // -addr_slide=arg
 // -function_offsets

diff  --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index f7b48148273c8..7eb730ebe941d 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -2788,6 +2788,7 @@ static void parseOtoolOptions(const llvm::opt::InputArgList &InputArgs) {
   LeadingAddr = LeadingHeaders = !InputArgs.hasArg(OTOOL_X);
 
   ChainedFixups = InputArgs.hasArg(OTOOL_chained_fixups);
+  DyldInfo = InputArgs.hasArg(OTOOL_dyld_info);
 
   InputFilenames = InputArgs.getAllArgValues(OTOOL_INPUT);
   if (InputFilenames.empty())


        


More information about the llvm-commits mailing list