[llvm] r364306 - [docs][llvm-readobj] Improve llvm-readobj documentation

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 06:12:38 PDT 2019


Author: jhenderson
Date: Tue Jun 25 06:12:38 2019
New Revision: 364306

URL: http://llvm.org/viewvc/llvm-project?rev=364306&view=rev
Log:
[docs][llvm-readobj] Improve llvm-readobj documentation

There were a number of issues with the llvm-readobj documentation. The
following points were raised in https://bugs.llvm.org/show_bug.cgi?id=42255,
and have been fixed in this patch:

 1. The description section claimed "The tool and its output is
    primarily designed for use in FileCheck-based tests" which is not
    really the case any more.
 2. The documentation used single-dash long options for option names,
    but references in the help text to other options exclusively used
    double-dashes. Fixed by standardising on double-dashes for all
    long-form options.
 3. The majority of options available and in the help text were not
    present in the documentation. This patch adds them.
 4. Several aliases, both long and short, were missing, e.g. --relocs.

Additionally, this patch improves the documentation by:

 1. Splitting the options into categories based on the file format they
    are specific to.
 2. Updating the Exit Status section to correctly mention that errors
    lead to a non-zero exit code.
 3. Adding a See Also section referencing other similar LLVM tools.
 4. Improving/correcting some of the descriptions of options that did
    not quite match up with what llvm-readobj does.

Reviewed by: peter.smith, MaskRay, mtrent

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

Modified:
    llvm/trunk/docs/CommandGuide/llvm-readobj.rst

Modified: llvm/trunk/docs/CommandGuide/llvm-readobj.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/llvm-readobj.rst?rev=364306&r1=364305&r2=364306&view=diff
==============================================================================
--- llvm/trunk/docs/CommandGuide/llvm-readobj.rst (original)
+++ llvm/trunk/docs/CommandGuide/llvm-readobj.rst Tue Jun 25 06:12:38 2019
@@ -10,89 +10,270 @@ DESCRIPTION
 -----------
 
 The :program:`llvm-readobj` tool displays low-level format-specific information
-about one or more object files. The tool and its output is primarily designed
-for use in FileCheck-based tests.
-
-OPTIONS
--------
+about one or more object files.
 
 If ``input`` is "``-``" or omitted, :program:`llvm-readobj` reads from standard
 input. Otherwise, it will read from the specified ``filenames``.
 
-.. option:: -help
+GENERAL AND MULTI-FORMAT OPTIONS
+--------------------------------
+
+These options are applicable to more than one file format, or are unrelated to
+file formats.
+
+.. option:: --all
+
+ Equivalent to specifying all the main display options relevant to the file
+ format.
+
+.. option:: --addrsig
+
+ Display the address-significance table.
 
- Print a summary of command line options.
+.. option:: --color
 
-.. option:: -version
+ Use colors in the output for warnings and errors.
 
- Display the version of this program
+.. option:: --expand-relocs
 
-.. option:: -file-headers, -h
+ When used with :option:`--relocations`, display each relocation in an expanded
+ multi-line format.
+
+.. option:: --file-headers, -h
 
  Display file headers.
 
-.. option:: -sections, -s
+.. option:: --headers, -e
 
- Display all sections.
+ Equivalent to setting: :option:`--file-headers`, :option:`--program-headers`,
+ and :option:`--sections`.
 
-.. option:: -section-data, -sd
+.. option:: --help
 
- When used with ``-sections``, display section data for each section shown.
+ Display a summary of command line options.
 
-.. option:: -section-relocations, -sr
+.. option:: --help-list
 
- When used with ``-sections``, display relocations for each section shown.
+ Display an uncategorized summary of command line options.
 
-.. option:: -section-symbols, -st
+.. option:: --hex-dump=<section[,section,...]>, -x
 
- When used with ``-sections``, display symbols for each section shown.
+ Display the specified section(s) as hexadecimal bytes. ``section`` may be a
+ section index or section name.
 
-.. option:: -relocations, -r
+.. option:: --needed-libs
+
+ Display the needed libraries.
+
+.. option:: --relocations, --relocs, -r
 
  Display the relocation entries in the file.
 
-.. option:: -symbols, -t
+.. option:: --sections, --section-headers, -s, -S
 
- Display the symbol table.
+ Display all sections.
 
-.. option:: -dyn-symbols
+.. option:: --section-data, --sd
 
- Display the dynamic symbol table (only for ELF object files).
+ When used with :option:`--sections`, display section data for each section shown.
 
-.. option:: -unwind, -u
+.. option:: --section-relocations, --sr
 
- Display unwind information.
+ When used with :option:`--sections`, display relocations for each section shown.
 
-.. option:: -expand-relocs
+.. option:: --section-symbols, --st
 
- When used with ``-relocations``, display each relocation in an expanded
- multi-line format.
+ When used with :option:`--sections`, display symbols for each section shown.
 
-.. option:: -dynamic-table
+.. option:: --stackmap
 
- Display the ELF .dynamic section table (only for ELF object files).
+ Display contents of the stackmap section.
 
-.. option:: -needed-libs
+.. option:: --string-dump=<section[,section,...]>, -p
 
- Display the needed libraries (only for ELF object files).
+ Display the specified section(s) as a list of strings. ``section`` may be a
+ section index or section name.
 
-.. option:: -program-headers
+.. option:: --symbols, --syms, -t
 
- Display the ELF program headers (only for ELF object files).
+ Display the symbol table.
 
-.. option:: -elf-section-groups, -g
+.. option:: --unwind, -u
 
- Display section groups (only for ELF object files).
+ Display unwind information.
 
-.. option:: -demangle, -C
+.. option:: --version
 
- Print demangled symbol names in the output.
+ Display the version of this program.
 
 .. option:: @<FILE>
 
  Read command-line options from response file `<FILE>`.
 
+ELF SPECIFIC OPTIONS
+--------------------
+
+The following options are implemented only for the ELF file format.
+
+.. option:: --arm-attributes
+
+ Display the ARM attributes section. Only applicable for ARM architectures.
+
+.. option:: --demangle, -C
+
+ Display demangled symbol names in the output.
+
+.. option:: --dyn-relocations
+
+ Display the dynamic relocation entries.
+
+.. option:: --dyn-symbols, --dyn-syms, --dt
+
+ Display the dynamic symbol table.
+
+.. option:: --dynamic-table, --dynamic, -d
+
+ Display the dynamic table.
+
+.. option:: --elf-cg-profile
+
+ Display the callgraph profile section.
+
+.. option:: --elf-hash-histogram, --histogram, -I
+
+ Display a bucket list histogram for dynamic symbol hash tables.
+
+.. option:: --elf-linker-options
+
+ Display the linker options section.
+
+.. option:: --elf-output-style=<value>
+
+ Specify the style to dump ELF information in. Valid options are ``LLVM`` and
+ ``GNU``. ``LLVM`` output (the default) is an expanded and structured format,
+ whilst ``GNU`` output mimics the equivalent GNU :program:`readelf` output.
+
+.. option:: --elf-section-groups, --section-groups, -g
+
+ Display section groups.
+
+.. option:: --gnu-hash-table
+
+ Display the GNU hash table for dynamic symbols.
+
+.. option:: --hash-symbols
+
+ Display the dynamic symbols derived from the hash table.
+
+.. option:: --hash-table
+
+ Display the hash table for dynamic symbols.
+
+.. option:: --notes, -n
+
+ Display all notes.
+
+.. option:: --program-headers, --segments, -l
+
+ Display the program headers.
+
+.. option:: --raw-relr
+
+ Do not decode relocations in RELR relocation sections when displaying them.
+
+.. option:: --section-mapping
+
+ Display the section to segment mapping.
+
+.. option:: --version-info, -V
+
+ Display version sections.
+
+MACH-O SPECIFIC OPTIONS
+-----------------------
+
+The following options are implemented only for the Mach-O file format.
+
+.. option:: --macho-data-in-code
+
+ Display the Data in Code command.
+
+.. option:: --macho-dsymtab
+
+ Display the Dsymtab command.
+
+.. option:: --macho-indirect-symbols
+
+ Display indirect symbols.
+
+.. option:: --macho-linker-options
+
+ Display the Mach-O-specific linker options.
+
+.. option:: --macho-segment
+
+ Display the Segment command.
+
+.. option:: --macho-version-min
+
+ Display the version min command.
+
+PE/COFF SPECIFIC OPTIONS
+------------------------
+
+The following options are implemented only for the PE/COFF file format.
+
+.. option:: --codeview
+
+ Display CodeView debug information.
+
+.. option:: --codeview-ghash
+
+ Enable global hashing for CodeView type stream de-duplication.
+
+.. option:: --codeview-merged-types
+
+ Display the merged CodeView type stream.
+
+.. option:: --codeview-subsection-bytes
+
+ Dump raw contents of CodeView debug sections and records.
+
+.. option:: --coff-basereloc
+
+ Display the .reloc section.
+
+.. option:: --coff-debug-directory
+
+ Display the debug directory.
+
+.. option:: --coff-directives
+
+ Display the .drectve section.
+
+.. option:: --coff-exports
+
+ Display the export table.
+
+.. option:: --coff-imports
+
+ Display the import table.
+
+.. option:: --coff-load-config
+
+ Display the load config.
+
+.. option:: --coff-resources
+
+ Display the .rsrc section.
+
 EXIT STATUS
 -----------
 
-:program:`llvm-readobj` returns 0.
+:program:`llvm-readobj` returns 0 under normal operation. It returns a non-zero
+exit code if there were any errors.
+
+SEE ALSO
+--------
+
+:manpage:`llvm-nm(1)`, :manpage:`llvm-objdump(1)`, :manpage:`llvm-readelf(1)`




More information about the llvm-commits mailing list