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 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 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= Generate build ID note +# HELP-NEXT: --build-id Generate build ID note +# HELP-NEXT: --b Change the input format of the inputs following this option +# HELP-NEXT: --call_shared Link against shared libraries +# HELP-NEXT: --color-diagnostics= +# HELP-NEXT: Use colors in diagnostics +# HELP-NEXT: --color-diagnostics Use colors in diagnostics +# HELP-NEXT: --compress-debug-sections= +# HELP-NEXT: Compress DWARF debug sections +# HELP-NEXT: --compress-debug-sections +# 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= Define a symbol alias +# HELP-NEXT: --defsym 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 +# HELP-NEXT: Which dynamic linker to use +# HELP-NEXT: --dynamic-list= Read a list of dynamic symbols +# HELP-NEXT: --dynamic-list 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= Name of entry point symbol +# HELP-NEXT: --entry Name of entry point symbol +# HELP-NEXT: --error-limit= Maximum number of errors to emit before stopping (0 = no limit) +# HELP-NEXT: --error-limit 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= Exclude static libraries from automatic export +# HELP-NEXT: --exclude-libs Exclude static libraries from automatic export +# HELP-NEXT: --export-dynamic-symbol= +# HELP-NEXT: Put a symbol in the dynamic symbol table +# HELP-NEXT: --export-dynamic-symbol +# 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 Name of entry point symbol +# HELP-NEXT: --fatal-warnings Treat warnings as errors +# HELP-NEXT: --filter= Set DT_FILTER field to the specified name +# HELP-NEXT: --filter Set DT_FILTER field to the specified name +# HELP-NEXT: --fini= Specify a finalizer function +# HELP-NEXT: --fini Specify a finalizer function +# HELP-NEXT: --format= Change the input format of the inputs following this option +# HELP-NEXT: --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 Set DT_FILTER field to the specified name +# HELP-NEXT: -f 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= Specify hash style (sysv, gnu or both) +# HELP-NEXT: --hash-style Specify hash style (sysv, gnu or both) +# HELP-NEXT: --help Print option help +# HELP-NEXT: -h Set DT_SONAME +# HELP-NEXT: --icf=all Enable identical code folding +# HELP-NEXT: --image-base= Set the base address +# HELP-NEXT: --image-base Set the base address +# HELP-NEXT: --init= Specify an initializer function +# HELP-NEXT: --init Specify an initializer function +# HELP-NEXT: --library-path= Add a directory to the library search path +# HELP-NEXT: --library-path Add a directory to the library search path +# HELP-NEXT: --library= Root name of library to use +# HELP-NEXT: --library Root name of library to use +# HELP-NEXT: --lto-aa-pipeline= +# HELP-NEXT: AA pipeline to run during LTO. Used in conjunction with -lto-newpm-passes +# HELP-NEXT: --lto-newpm-passes= +# HELP-NEXT: Passes to run during LTO +# HELP-NEXT: --lto-O Optimization level for LTO +# HELP-NEXT: --lto-partitions= +# HELP-NEXT: Number of LTO codegen partitions +# HELP-NEXT: -L Add a directory to the library search path +# HELP-NEXT: -l Root name of library to use +# HELP-NEXT: --Map= Print a link map to the specified file +# HELP-NEXT: --Map Print a link map to the specified file +# HELP-NEXT: -M Print a link map to the standard output +# HELP-NEXT: -m 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 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 +# 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= Path to file to write output +# HELP-NEXT: --output Path to file to write output +# HELP-NEXT: -O Optimize output file size +# HELP-NEXT: -o 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= Dump linker invocation and input files for debugging +# HELP-NEXT: --reproduce Dump linker invocation and input files for debugging +# HELP-NEXT: --retain-symbols-file= +# HELP-NEXT: Retain only the symbols listed in the file +# HELP-NEXT: --retain-symbols-file +# HELP-NEXT: Retain only the symbols listed in the file +# HELP-NEXT: --rpath= Add a DT_RUNPATH to the output +# HELP-NEXT: --rpath Add a DT_RUNPATH to the output +# HELP-NEXT: --rsp-quoting= Quoting style for response files. Values supported: windows|posix +# HELP-NEXT: --rsp-quoting Quoting style for response files. Values supported: windows|posix +# HELP-NEXT: -R Add a DT_RUNPATH to the output +# HELP-NEXT: -r Create relocatable object file +# HELP-NEXT: --script= Read linker script +# HELP-NEXT: --script Read linker script +# HELP-NEXT: --section-start
+# HELP-NEXT: Set address of section +# HELP-NEXT: --shared Build a shared object +# HELP-NEXT: --soname= Set DT_SONAME +# HELP-NEXT: --soname Set DT_SONAME +# HELP-NEXT: --sort-section= Specifies sections sorting rule when linkerscript is used +# HELP-NEXT: --sort-section 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 +# HELP-NEXT: Layout sections in the order specified by symbol file +# HELP-NEXT: --sysroot= Set the system root +# HELP-NEXT: --sysroot 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= Interpret R_ARM_TARGET2 as , where is one of rel, abs, or got-rel +# HELP-NEXT: --target2 Interpret R_ARM_TARGET2 as , where is one of rel, abs, or got-rel +# HELP-NEXT: --Tbss= Same as --section-start with .bss as the sectionname +# HELP-NEXT: --Tbss Same as --section-start with .bss as the sectionname +# HELP-NEXT: --Tdata= Same as --section-start with .data as the sectionname +# HELP-NEXT: --Tdata Same as --section-start with .data as the sectionname +# HELP-NEXT: --thinlto-cache-dir= +# HELP-NEXT: Path to ThinLTO cached object file directory +# HELP-NEXT: --thinlto-cache-policy +# HELP-NEXT: Pruning policy for the ThinLTO cache +# HELP-NEXT: --thinlto-jobs= Number of ThinLTO jobs +# HELP-NEXT: --threads Run the linker multi-threaded +# HELP-NEXT: --trace-symbol= Trace references to symbols +# HELP-NEXT: --trace-symbol Trace references to symbols +# HELP-NEXT: --trace Print the names of the input files +# HELP-NEXT: --Ttext-segment= Same as --section-start with .text as the sectionname +# HELP-NEXT: --Ttext-segment Same as --section-start with .text as the sectionname +# HELP-NEXT: --Ttext= Same as --section-start with .text as the sectionname +# HELP-NEXT: --Ttext Same as --section-start with .text as the sectionname +# HELP-NEXT: -T Read linker script +# HELP-NEXT: -t Print the names of the input files +# HELP-NEXT: --undefined= Force undefined symbol during linking +# HELP-NEXT: --undefined Force undefined symbol during linking +# HELP-NEXT: --unresolved-symbols= +# HELP-NEXT: Determine how to handle unresolved symbols +# HELP-NEXT: --unresolved-symbols +# HELP-NEXT: Determine how to handle unresolved symbols +# HELP-NEXT: -u Force undefined symbol during linking +# HELP-NEXT: --verbose Verbose mode +# HELP-NEXT: --version-script= +# HELP-NEXT: Read a version script +# HELP-NEXT: --version-script +# 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= Use wrapper functions for symbol +# HELP-NEXT: --wrap Use wrapper functions for symbol +# HELP-NEXT: -X Delete temporary local symbols +# HELP-NEXT: -x Delete all local symbols +# HELP-NEXT: -y Trace references to symbols +# HELP-NEXT: -z