[PATCH] D35477: [ELF] - Print options aliases in --help

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 07:49:39 PDT 2017


I didn't mean to test the entire --help output. Only an example to show
that we use the same help text for aliases. So I think just

 +# HELP-NEXT:  --filter=<value>        Set DT_FILTER field to the specified name
 +# HELP-NEXT:  --filter <value>        Set DT_FILTER field to the specified name

would do, no?

Cheers,
Rafael

George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar updated this revision to Diff 108051.
> grimar added a comment.
>
> - Uploaded correct diff now.
>
>
> https://reviews.llvm.org/D35477
>
> Files:
>   ELF/DriverUtils.cpp
>   test/ELF/help.s
>
> Index: test/ELF/help.s
> ===================================================================
> --- test/ELF/help.s
> +++ test/ELF/help.s
> @@ -0,0 +1,208 @@
> +# RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s
> +# HELP:      OPTIONS:
> +# HELP-NEXT:  --allow-multiple-definition
> +# HELP-NEXT:                          Allow multiple definitions
> +# HELP-NEXT:  --as-needed             Only set DT_NEEDED for shared libraries if used
> +# HELP-NEXT:  --auxiliary <value>     Set DT_AUXILIARY field to the specified name
> +# HELP-NEXT:  --Bdynamic              Link against shared libraries
> +# HELP-NEXT:  --Bshareable            Build a shared object
> +# HELP-NEXT:  --Bstatic               Do not link against shared libraries
> +# HELP-NEXT:  --Bsymbolic-functions   Bind defined function symbols locally
> +# HELP-NEXT:  --Bsymbolic             Bind defined symbols locally
> +# HELP-NEXT:  --build-id=<value>      Generate build ID note
> +# HELP-NEXT:  --build-id              Generate build ID note
> +# HELP-NEXT:  --b <value>             Change the input format of the inputs following this option
> +# HELP-NEXT:  --call_shared           Link against shared libraries
> +# HELP-NEXT:  --color-diagnostics=<value>
> +# HELP-NEXT:                          Use colors in diagnostics
> +# HELP-NEXT:  --color-diagnostics     Use colors in diagnostics
> +# HELP-NEXT:  --compress-debug-sections=<value>
> +# HELP-NEXT:                          Compress DWARF debug sections
> +# HELP-NEXT:  --compress-debug-sections <value>
> +# HELP-NEXT:                          Compress DWARF debug sections
> +# HELP-NEXT:  --dc                    Assign space to common symbols
> +# HELP-NEXT:  --define-common         Assign space to common symbols
> +# HELP-NEXT:  --defsym=<value>        Define a symbol alias
> +# HELP-NEXT:  --defsym <value>        Define a symbol alias
> +# HELP-NEXT:  --demangle              Demangle symbol names
> +# HELP-NEXT:  --disable-new-dtags     Disable new dynamic tags
> +# HELP-NEXT:  --discard-all           Delete all local symbols
> +# HELP-NEXT:  --discard-locals        Delete temporary local symbols
> +# HELP-NEXT:  --discard-none          Keep all symbols in the symbol table
> +# HELP-NEXT:  --dn                    Do not link against shared libraries
> +# HELP-NEXT:  --dp                    Assign space to common symbols
> +# HELP-NEXT:  --dynamic-linker <value>
> +# HELP-NEXT:                          Which dynamic linker to use
> +# HELP-NEXT:  --dynamic-list=<value>  Read a list of dynamic symbols
> +# HELP-NEXT:  --dynamic-list <value>  Read a list of dynamic symbols
> +# HELP-NEXT:  --dy                    Link against shared libraries
> +# HELP-NEXT:  -d                      Assign space to common symbols
> +# HELP-NEXT:  --eh-frame-hdr          Request creation of .eh_frame_hdr section and PT_GNU_EH_FRAME segment header
> +# HELP-NEXT:  --emit-relocs           Generate relocations in output
> +# HELP-NEXT:  --enable-new-dtags      Enable new dynamic tags
> +# HELP-NEXT:  --end-lib               End a grouping of objects that should be treated as if they were together in an archive
> +# HELP-NEXT:  --entry=<entry>         Name of entry point symbol
> +# HELP-NEXT:  --entry <entry>         Name of entry point symbol
> +# HELP-NEXT:  --error-limit=<value>   Maximum number of errors to emit before stopping (0 = no limit)
> +# HELP-NEXT:  --error-limit <value>   Maximum number of errors to emit before stopping (0 = no limit)
> +# HELP-NEXT:  --error-unresolved-symbols
> +# HELP-NEXT:                          Report unresolved symbols as errors
> +# HELP-NEXT:  --exclude-libs=<value>  Exclude static libraries from automatic export
> +# HELP-NEXT:  --exclude-libs <value>  Exclude static libraries from automatic export
> +# HELP-NEXT:  --export-dynamic-symbol=<value>
> +# HELP-NEXT:                          Put a symbol in the dynamic symbol table
> +# HELP-NEXT:  --export-dynamic-symbol <value>
> +# HELP-NEXT:                          Put a symbol in the dynamic symbol table
> +# HELP-NEXT:  --export-dynamic        Put symbols in the dynamic symbol table
> +# HELP-NEXT:  -E                      Put symbols in the dynamic symbol table
> +# HELP-NEXT:  -e <value>              Name of entry point symbol
> +# HELP-NEXT:  --fatal-warnings        Treat warnings as errors
> +# HELP-NEXT:  --filter=<value>        Set DT_FILTER field to the specified name
> +# HELP-NEXT:  --filter <value>        Set DT_FILTER field to the specified name
> +# HELP-NEXT:  --fini=<symbol>         Specify a finalizer function
> +# HELP-NEXT:  --fini <symbol>         Specify a finalizer function
> +# HELP-NEXT:  --format=<input-format> Change the input format of the inputs following this option
> +# HELP-NEXT:  --format <input-format> Change the input format of the inputs following this option
> +# HELP-NEXT:  --full-shutdown         Perform a full shutdown instead of calling _exit
> +# HELP-NEXT:  -F <value>              Set DT_FILTER field to the specified name
> +# HELP-NEXT:  -f <value>              Set DT_AUXILIARY field to the specified name
> +# HELP-NEXT:  --gc-sections           Enable garbage collection of unused sections
> +# HELP-NEXT:  --gdb-index             Generate .gdb_index section
> +# HELP-NEXT:  --hash-style=<value>    Specify hash style (sysv, gnu or both)
> +# HELP-NEXT:  --hash-style <value>    Specify hash style (sysv, gnu or both)
> +# HELP-NEXT:  --help                  Print option help
> +# HELP-NEXT:  -h <value>              Set DT_SONAME
> +# HELP-NEXT:  --icf=all               Enable identical code folding
> +# HELP-NEXT:  --image-base=<value>    Set the base address
> +# HELP-NEXT:  --image-base <value>    Set the base address
> +# HELP-NEXT:  --init=<symbol>         Specify an initializer function
> +# HELP-NEXT:  --init <symbol>         Specify an initializer function
> +# HELP-NEXT:  --library-path=<dir>    Add a directory to the library search path
> +# HELP-NEXT:  --library-path <dir>    Add a directory to the library search path
> +# HELP-NEXT:  --library=<libName>     Root name of library to use
> +# HELP-NEXT:  --library <libName>     Root name of library to use
> +# HELP-NEXT:  --lto-aa-pipeline=<value>
> +# HELP-NEXT:                          AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes
> +# HELP-NEXT:  --lto-newpm-passes=<value>
> +# HELP-NEXT:                          Passes to run during LTO
> +# HELP-NEXT:  --lto-O<opt-level>      Optimization level for LTO
> +# HELP-NEXT:  --lto-partitions=<value>
> +# HELP-NEXT:                          Number of LTO codegen partitions
> +# HELP-NEXT:  -L <value>              Add a directory to the library search path
> +# HELP-NEXT:  -l <value>              Root name of library to use
> +# HELP-NEXT:  --Map=<value>           Print a link map to the specified file
> +# HELP-NEXT:  --Map <value>           Print a link map to the specified file
> +# HELP-NEXT:  -M                      Print a link map to the standard output
> +# HELP-NEXT:  -m <value>              Set target emulation
> +# HELP-NEXT:  --no-as-needed          Always DT_NEEDED for shared libraries
> +# HELP-NEXT:  --no-color-diagnostics  Do not use colors in diagnostics
> +# HELP-NEXT:  --no-define-common      Do not assign space to common symbols
> +# HELP-NEXT:  --no-demangle           Do not demangle symbol names
> +# HELP-NEXT:  --no-dynamic-linker     Inhibit output of .interp section
> +# HELP-NEXT:  --no-gc-sections        Disable garbage collection of unused sections
> +# HELP-NEXT:  --no-gnu-unique         Disable STB_GNU_UNIQUE symbol binding
> +# HELP-NEXT:  --no-rosegment          Do not put read-only non-executable sections in their own segment
> +# HELP-NEXT:  --no-threads            Do not run the linker multi-threaded
> +# HELP-NEXT:  --no-undefined-version  Report version scripts that refer undefined symbols
> +# HELP-NEXT:  --no-undefined          Report unresolved symbols even if the linker is creating a shared library
> +# HELP-NEXT:  --no-whole-archive      Restores the default behavior of loading archive members
> +# HELP-NEXT:  --noinhibit-exec        Retain the executable output file whenever it is still usable
> +# HELP-NEXT:  --non_shared            Do not link against shared libraries
> +# HELP-NEXT:  --nopie                 Do not create a position independent executable
> +# HELP-NEXT:  --nostdlib              Only search directories specified on the command line
> +# HELP-NEXT:  -N                      Set the text and data sections to be readable and writable
> +# HELP-NEXT:  --oformat <format>      Specify the binary format for the output object file
> +# HELP-NEXT:  --omagic                Set the text and data sections to be readable and writable
> +# HELP-NEXT:  --opt-remarks-filename <value>
> +# HELP-NEXT:                          YAML output file for optimization remarks
> +# HELP-NEXT:  --opt-remarks-with-hotness
> +# HELP-NEXT:                          Include hotness informations in the optimization remarks file
> +# HELP-NEXT:  --output=<value>        Path to file to write output
> +# HELP-NEXT:  --output <value>        Path to file to write output
> +# HELP-NEXT:  -O<value>               Optimize output file size
> +# HELP-NEXT:  -o <path>               Path to file to write output
> +# HELP-NEXT:  --pic-executable        Create a position independent executable
> +# HELP-NEXT:  --pie                   Create a position independent executable
> +# HELP-NEXT:  --print-gc-sections     List removed unused sections
> +# HELP-NEXT:  --print-map             Print a link map to the standard output
> +# HELP-NEXT:  -q                      Generate relocations in output
> +# HELP-NEXT:  --relocatable           Create relocatable object file
> +# HELP-NEXT:  --reproduce=<value>     Dump linker invocation and input files for debugging
> +# HELP-NEXT:  --reproduce <value>     Dump linker invocation and input files for debugging
> +# HELP-NEXT:  --retain-symbols-file=<file>
> +# HELP-NEXT:                          Retain only the symbols listed in the file
> +# HELP-NEXT:  --retain-symbols-file <file>
> +# HELP-NEXT:                          Retain only the symbols listed in the file
> +# HELP-NEXT:  --rpath=<value>         Add a DT_RUNPATH to the output
> +# HELP-NEXT:  --rpath <value>         Add a DT_RUNPATH to the output
> +# HELP-NEXT:  --rsp-quoting=<value>   Quoting style for response files. Values supported: windows|posix
> +# HELP-NEXT:  --rsp-quoting <value>   Quoting style for response files. Values supported: windows|posix
> +# HELP-NEXT:  -R <value>              Add a DT_RUNPATH to the output
> +# HELP-NEXT:  -r                      Create relocatable object file
> +# HELP-NEXT:  --script=<value>        Read linker script
> +# HELP-NEXT:  --script <value>        Read linker script
> +# HELP-NEXT:  --section-start <address>
> +# HELP-NEXT:                          Set address of section
> +# HELP-NEXT:  --shared                Build a shared object
> +# HELP-NEXT:  --soname=<value>        Set DT_SONAME
> +# HELP-NEXT:  --soname <value>        Set DT_SONAME
> +# HELP-NEXT:  --sort-section=<value>  Specifies sections sorting rule when linkerscript is used
> +# HELP-NEXT:  --sort-section <value>  Specifies sections sorting rule when linkerscript is used
> +# HELP-NEXT:  --start-lib             Start a grouping of objects that should be treated as if they were together in an archive
> +# HELP-NEXT:  --static                Do not link against shared libraries
> +# HELP-NEXT:  --strip-all             Strip all symbols
> +# HELP-NEXT:  --strip-debug           Strip debugging information
> +# HELP-NEXT:  --symbol-ordering-file <value>
> +# HELP-NEXT:                          Layout sections in the order specified by symbol file
> +# HELP-NEXT:  --sysroot=<value>       Set the system root
> +# HELP-NEXT:  --sysroot <value>       Set the system root
> +# HELP-NEXT:  -S                      Strip debugging information
> +# HELP-NEXT:  -s                      Strip all symbols
> +# HELP-NEXT:  --target1-abs           Interpret R_ARM_TARGET1 as R_ARM_ABS32
> +# HELP-NEXT:  --target1-rel           Interpret R_ARM_TARGET1 as R_ARM_REL32
> +# HELP-NEXT:  --target2=<type>        Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel
> +# HELP-NEXT:  --target2 <type>        Interpret R_ARM_TARGET2 as <type>, where <type> is one of rel, abs, or got-rel
> +# HELP-NEXT:  --Tbss=<value>          Same as --section-start with .bss as the sectionname
> +# HELP-NEXT:  --Tbss <value>          Same as --section-start with .bss as the sectionname
> +# HELP-NEXT:  --Tdata=<value>         Same as --section-start with .data as the sectionname
> +# HELP-NEXT:  --Tdata <value>         Same as --section-start with .data as the sectionname
> +# HELP-NEXT:  --thinlto-cache-dir=<value>
> +# HELP-NEXT:                          Path to ThinLTO cached object file directory
> +# HELP-NEXT:  --thinlto-cache-policy <value>
> +# HELP-NEXT:                          Pruning policy for the ThinLTO cache
> +# HELP-NEXT:  --thinlto-jobs=<value>  Number of ThinLTO jobs
> +# HELP-NEXT:  --threads               Run the linker multi-threaded
> +# HELP-NEXT:  --trace-symbol=<value>  Trace references to symbols
> +# HELP-NEXT:  --trace-symbol <value>  Trace references to symbols
> +# HELP-NEXT:  --trace                 Print the names of the input files
> +# HELP-NEXT:  --Ttext-segment=<value> Same as --section-start with .text as the sectionname
> +# HELP-NEXT:  --Ttext-segment <value> Same as --section-start with .text as the sectionname
> +# HELP-NEXT:  --Ttext=<value>         Same as --section-start with .text as the sectionname
> +# HELP-NEXT:  --Ttext <value>         Same as --section-start with .text as the sectionname
> +# HELP-NEXT:  -T <value>              Read linker script
> +# HELP-NEXT:  -t                      Print the names of the input files
> +# HELP-NEXT:  --undefined=<value>     Force undefined symbol during linking
> +# HELP-NEXT:  --undefined <value>     Force undefined symbol during linking
> +# HELP-NEXT:  --unresolved-symbols=<value>
> +# HELP-NEXT:                          Determine how to handle unresolved symbols
> +# HELP-NEXT:  --unresolved-symbols <value>
> +# HELP-NEXT:                          Determine how to handle unresolved symbols
> +# HELP-NEXT:  -u <value>              Force undefined symbol during linking
> +# HELP-NEXT:  --verbose               Verbose mode
> +# HELP-NEXT:  --version-script=<value>
> +# HELP-NEXT:                          Read a version script
> +# HELP-NEXT:  --version-script <value>
> +# HELP-NEXT:                          Read a version script
> +# HELP-NEXT:  --version               Display the version number and exit
> +# HELP-NEXT:  -V                      Display the version number and exit
> +# HELP-NEXT:  -v                      Display the version number
> +# HELP-NEXT:  --warn-common           Warn about duplicate common symbols
> +# HELP-NEXT:  --warn-unresolved-symbols
> +# HELP-NEXT:                          Report unresolved symbols as warnings
> +# HELP-NEXT:  --whole-archive         Force load of all members in a static library
> +# HELP-NEXT:  --wrap=<symbol>         Use wrapper functions for symbol
> +# HELP-NEXT:  --wrap <symbol>         Use wrapper functions for symbol
> +# HELP-NEXT:  -X                      Delete temporary local symbols
> +# HELP-NEXT:  -x                      Delete all local symbols
> +# HELP-NEXT:  -y <value>              Trace references to symbols
> +# HELP-NEXT:  -z <option>             Linker option extensions
> Index: ELF/DriverUtils.cpp
> ===================================================================
> --- ELF/DriverUtils.cpp
> +++ ELF/DriverUtils.cpp
> @@ -116,7 +116,8 @@
>  
>  void elf::printHelp(const char *Argv0) {
>    ELFOptTable Table;
> -  Table.PrintHelp(outs(), Argv0, "lld", false);
> +  Table.PrintHelp(outs(), Argv0, "lld", false /*ShowHidden*/,
> +                  true /*InferHelpText*/);
>    outs() << "\n";
>  
>    // Scripts generated by Libtool versions up to at least 2.4.6 (the most


More information about the llvm-commits mailing list