Index: ELF/Options.td =================================================================== --- ELF/Options.td +++ ELF/Options.td @@ -58,8 +58,8 @@ "Do not allow multiple definitions (default)">; defm apply_dynamic_relocs: B<"apply-dynamic-relocs", - "Apply dynamic relocations to place", - "Do not apply dynamic relocations to place">; + "Apply link-time values for dynamic relocations", + "Do not apply link-time values for dynamic relocations (default)">; defm as_needed: B<"as-needed", "Only set DT_NEEDED for shared libraries if used", Index: docs/ld.lld.1 =================================================================== --- docs/ld.lld.1 +++ docs/ld.lld.1 @@ -30,22 +30,24 @@ .It Fl -allow-multiple-definition Do not error if a symbol is defined multiple times. The first definition will be used. +.It Fl -apply-dynamic-relocs +Apply link-time values for dynamic relocations. .It Fl -as-needed Only set .Dv DT_NEEDED for shared libraries if used. -.It Fl -auxiliary Ns = Ns Ar value +.It Fl -auxiliary Ar value Set the .Dv DT_AUXILIARY field to the specified name. -.It Fl -Bdynamic +.It Fl -Bdynamic , Fl -dy Link against shared libraries. -.It Fl -Bstatic +.It Fl -Bstatic , Fl -static , Fl -dn Do not link against shared libraries. -.It Fl -Bsymbolic-functions -Bind defined function symbols locally. .It Fl -Bsymbolic Bind defined symbols locally. +.It Fl -Bsymbolic-functions +Bind defined function symbols locally. .It Fl -build-id Ns = Ns Ar value Generate a build ID note. .Ar value @@ -72,7 +74,7 @@ is not intended to be cryptographically secure. .It Fl -build-id Synonym for -.Fl -build-id Ns = Ns Cm fast . +.Fl -build-id= Ns Cm fast . .It Fl -color-diagnostics Ns = Ns Ar value Use colors in diagnostics. .Ar value @@ -85,39 +87,42 @@ enables color if and only if output is to a terminal. .It Fl -color-diagnostics Alias for -.Fl -color-diagnostics Ns = Ns Cm auto . -.It Fl -compress-debug-sections Ns = Ns Ar value +.Fl -color-diagnostics= Ns Cm auto . +.It Fl -compress-debug-sections Ar value Compress DWARF debug sections. .Ar value may be .Cm none or .Cm zlib . +.It Fl -cref +Output cross reference table. .It Fl -define-common +.It Fl d Assign space to common symbols. -.It Fl -defsym Ns = Ns Ar symbol Ns = Ns Ar expression +.It Fl -defsym Ar symbol Ns = Ns Ar expression Define a symbol alias. .Ar expression may be another symbol or a linker script expression. For example, -.Ql --defsym=foo=bar +.Fl -defsym Cm foo= Ns Cm bar or -.Ql --defsym=foo=bar+0x100 . +.Fl -defsym Cm foo= Ns Cm bar+0x100 . .It Fl -demangle Demangle symbol names. .It Fl -disable-new-dtags Disable new dynamic tags. -.It Fl -discard-all +.It Fl -discard-all , Fl x Delete all local symbols. -.It Fl -discard-locals +.It Fl -discard-locals , Fl X Delete temporary local symbols. .It Fl -discard-none Keep all symbols in the symbol table. -.It Fl -dynamic-linker Ns = Ns Ar value +.It Fl -dynamic-linker Ar value Specify the dynamic linker to be used for a dynamically linked executable. This is recorded in an ELF segment of type .Dv PT_INTERP . -.It Fl -dynamic-list Ns = Ns Ar file +.It Fl -dynamic-list Ar file Read a list of dynamic symbols from .Ar file . .It Fl -eh-frame-hdr @@ -127,36 +132,36 @@ .Dv PT_GNU_EH_FRAME segment header. .It Fl -emit-relocs +.It Fl q Generate relocations in the output. -.It Fl -enable-new-dtags -Enable new dynamic tags. .It Fl -end-lib End a grouping of objects that should be treated as if they were together in an archive. -.It Fl -entry Ns = Ns Ar entry +.It Fl -entry Ar entry Name of entry point symbol. -.It Fl -error-limit Ns = Ns Ar value +.It Fl -error-limit Ar value Maximum number of errors to emit before stopping. A value of zero indicates that there is no limit. .It Fl -error-unresolved-symbols Report unresolved symbols as errors. -.It Fl -exclude-libs Ns = Ns Ar value +.It Fl -exclude-libs Ar value Exclude static libraries from automatic export. -.It Fl -export-dynamic-symbol Ns = Ns Ar symbol +.It Fl -export-dynamic-symbol Ar symbol Include .Ar symbol in the dynamic symbol table. .It Fl -export-dynamic +.It Fl E Put symbols in the dynamic symbol table. .It Fl -fatal-warnings Treat warnings as errors. -.It Fl -filter Ns = Ns Ar value +.It Fl -filter Ar value , Fl F Ar value Set the .Dv DT_FILTER field to the specified value. -.It Fl -fini Ns = Ns Ar symbol +.It Fl -fini Ar symbol Specify a finalizer function. -.It Fl -format Ns = Ns Ar input-format +.It Fl -format Ar input-format , Fl b Ar input-format Specify the format of the inputs following this option. .Ar input-format may be one of @@ -173,7 +178,7 @@ Generate .Li .gdb_index section. -.It Fl -hash-style Ns = Ns Ar value +.It Fl -hash-style Ar value Specify hash style. .Ar value may be @@ -187,15 +192,21 @@ Print a help message. .It Fl -icf Ns = Ns Cm all Enable identical code folding. -.It Fl -icf Ns = Ns Cm safe -Enable safe identical code folding. .It Fl -icf Ns = Ns Cm none Disable identical code folding. -.It Fl -image-base Ns = Ns Ar value +.It Fl -icf Ns = Ns Cm safe +Enable safe identical code folding. +.It Fl -image-base Ar value Set the base address to .Ar value . -.It Fl -init Ns = Ns Ar symbol +.It Fl -init Ar symbol Specify an initializer function. +.It Fl -keep-unique Ar symbol +Do not fold this symbol during ICF. +.It Fl L Ar dir , Fl -library-path Ar dir +Add a directory to the library search path. +.It Fl l Ar libName, Fl -library Ar libName +Root name of library to use. .It Fl -lto-aa-pipeline Ns = Ns Ar value AA pipeline to run during LTO. Used in conjunction with @@ -206,11 +217,7 @@ Optimization level for LTO. .It Fl -lto-partitions Ns = Ns Ar value Number of LTO codegen partitions. -.It Fl L Ar dir -Add a directory to the library search path. -.It Fl l Ar libName -Root name of library to use. -.It Fl -Map Ns = Ns Ar file +.It Fl -Map Ar file , Fl M Ar file Print a link map to .Ar file . .It Fl m Ar value @@ -229,8 +236,6 @@ Inhibit output of an .Li .interp section. -.It Fl -no-gc-sections -Disable garbage collection of unused sections. .It Fl -no-gnu-unique Disable STB_GNU_UNIQUE symbol binding. .It Fl -no-rosegment @@ -245,11 +250,9 @@ Restores the default behavior of loading archive members. .It Fl -noinhibit-exec Retain the executable output file whenever it is still usable. -.It Fl -no-pie -Do not create a position independent executable. .It Fl -nostdlib Only search directories specified on the command line. -.It Fl -oformat Ns = Ns Ar format +.It Fl -oformat Ar format Specify the format for the output object file. The only supported .Ar format @@ -257,6 +260,7 @@ .Cm binary , which produces output with no ELF header. .It Fl -omagic +.It Fl N Set the text and data sections to be readable and writable. .It Fl -opt-remarks-filename Ar file Write optimization remarks in YAML format to @@ -267,7 +271,6 @@ Optimize output file size. .Ar value may be: -.Pp .Bl -tag -width 2n -compact .It Cm 0 Disable string merging. @@ -276,7 +279,6 @@ .It Cm 2 Enable string tail merging. .El -.Pp .Fl O Ns Cm 1 is the default. .It Fl o Ar path @@ -300,47 +302,47 @@ .It Fl -pop-state Undo the effect of .Fl -push-state. -.It Fl -relocatable +.It Fl -relocatable , Fl r Create relocatable object file. -.It Fl -reproduce Ns = Ns Ar value +.It Fl -reproduce Ar value Dump linker invocation and input files for debugging. -.It Fl -retain-symbols-file Ns = Ns Ar file +.It Fl -retain-symbols-file Ar file Retain only the symbols listed in the file. -.It Fl -rpath Ns = Ns Ar value +.It Fl -rpath Ar value , Fl R Ar value Add a .Dv DT_RUNPATH to the output. -.It Fl -rsp-quoting Ns = Ns Ar value +.It Fl -rsp-quoting Ar value Quoting style for response files. The supported values are .Cm windows and .Cm posix . -.It Fl -script Ns = Ns Ar file +.It Fl -script Ar file , Fl T Ar file Read linker script from .Ar file . -.It Fl -section-start Ns = Ar section Ns = Ns Ar address +.It Fl -section-start Ar section Ns = Ns Ar address Set address of section. -.It Fl -shared +.It Fl -shared , Fl -Bsharable Build a shared object. -.It Fl -soname Ns = Ns Ar value +.It Fl -soname Ar value , Fl h Ar value Set .Dv DT_SONAME to .Ar value . -.It Fl -sort-section Ns = Ns Ar value +.It Fl -sort-section Ar value Specifies sections sorting rule when linkerscript is used. .It Fl -start-lib Start a grouping of objects that should be treated as if they were together in an archive. -.It Fl -strip-all +.It Fl -strip-all , Fl s Strip all symbols. -.It Fl -strip-debug +.It Fl -strip-debug , Fl S Strip debugging information. -.It Fl -symbol-ordering-file Ns = Ns Ar file +.It Fl -symbol-ordering-file Ar file Lay out sections in the order specified by .Ar file . -.It Fl -sysroot Ns = Ns Ar value +.It Fl -sysroot Ar value Set the system root. .It Fl -target1-abs Interpret @@ -352,7 +354,7 @@ .Dv R_ARM_TARGET1 as .Dv R_ARM_REL32 . -.It Fl -target2 Ns = Ns Ar type +.It Fl -target2 Ar type Interpret .Dv R_ARM_TARGET2 as @@ -364,13 +366,13 @@ .Cm abs , or .Cm got-rel . -.It Fl -Tbss Ns = Ns Ar value +.It Fl -Tbss Ar value Same as .Fl -section-start with .Li .bss as the sectionname. -.It Fl -Tdata Ns = Ns Ar value +.It Fl -Tdata Ar value Same as .Fl -section-start with @@ -378,40 +380,41 @@ as the sectionname. .It Fl -thinlto-cache-dir Ns = Ns Ar value Path to ThinLTO cached object file directory. -.It Fl -thinlto-cache-policy Ns = Ns Ar value +.It Fl -thinlto-cache-policy Ar value Pruning policy for the ThinLTO cache. .It Fl -thinlto-jobs Ns = Ns Ar value Number of ThinLTO jobs. .It Fl -threads Run the linker multi-threaded. This option is enabled by default. -.It Fl -trace-symbol Ns = Ns Ar symbol -Trace references to -.Ar symbol . .It Fl -trace Print the names of the input files. -.It Fl -Ttext Ns = Ns Ar value +.It Fl -trace-symbol Ar symbol , Fl y Ar symbol +Trace references to +.Ar symbol . +.It Fl -Ttext Ar value Same as .Fl -section-start with .Li .text as the sectionname. -.It Fl -undefined Ns = Ns Ar symbol +.It Fl -undefined Ar symbol +.It Fl u Ar symbol Force .Ar symbol to be an undefined symbol during linking. -.It Fl -unresolved-symbols Ns = Ns Ar value +.It Fl -unresolved-symbols Ar value Determine how to handle unresolved symbols. -.It Fl -verbose -Verbose mode. -.It Fl -version-script Ns = Ns Ar file -Read version script from -.Ar file . -.It Fl V , Fl -version -Display the version number and exit. .It Fl v Display the version number and proceed with linking if object files are specified. +.It Fl -verbose +Verbose mode. +.It Fl -version , Fl V +Display the version number and exit. +.It Fl -version-script Ar file +Read version script from +.Ar file . .It Fl -warn-backrefs Warn about reverse or cyclic dependencies to or between static archives. This can be used to ensure linker invocation remains compatible with @@ -422,7 +425,7 @@ Report unresolved symbols as warnings. .It Fl -whole-archive Force load of all members in a static library. -.It Fl -wrap Ns = Ns Ar symbol +.It Fl -wrap Ar symbol Use wrapper functions for symbol. .It Fl z Ar option Linker option extensions. @@ -432,6 +435,10 @@ Stack permissions are recorded in the .Dv PT_GNU_STACK segment. +.It Cm initfirst +Sets the +.Dv DF_1_INITFIRST +flag to indicate the module should be initialized first. .It Cm muldefs Do not error if a symbol is defined multiple times. The first definition will be used.