summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man1/ld.1
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 10:51:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-17 10:51:52 +0000
commit4ad94864781f48b1a4b77f9cfb934622bf756ba1 (patch)
tree3900955c1886e6d2570fea7125ee1f01bafe876d /upstream/fedora-rawhide/man1/ld.1
parentAdding upstream version 4.22.0. (diff)
downloadmanpages-l10n-4ad94864781f48b1a4b77f9cfb934622bf756ba1.tar.xz
manpages-l10n-4ad94864781f48b1a4b77f9cfb934622bf756ba1.zip
Adding upstream version 4.23.0.upstream/4.23.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'upstream/fedora-rawhide/man1/ld.1')
-rw-r--r--upstream/fedora-rawhide/man1/ld.1109
1 files changed, 84 insertions, 25 deletions
diff --git a/upstream/fedora-rawhide/man1/ld.1 b/upstream/fedora-rawhide/man1/ld.1
index eae5f105..70f22945 100644
--- a/upstream/fedora-rawhide/man1/ld.1
+++ b/upstream/fedora-rawhide/man1/ld.1
@@ -55,7 +55,7 @@
.\" ========================================================================
.\"
.IX Title "LD 1"
-.TH LD 1 2024-02-22 binutils-2.42.50 "GNU Development Tools"
+.TH LD 1 2024-05-13 binutils-2.42.50 "GNU Development Tools"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -934,12 +934,22 @@ a linker bug report.
.PD
Use \fIscriptfile\fR as the linker script. This script replaces
\&\fBld\fR's default linker script (rather than adding to it),
-unless the script contains \f(CW\*(C`INSERT\*(C'\fR, so
-\&\fIcommandfile\fR must specify everything necessary to describe the
-output file. If \fIscriptfile\fR does not exist in
-the current directory, \f(CW\*(C`ld\*(C'\fR looks for it in the directories
-specified by any preceding \fB\-L\fR options. Multiple \fB\-T\fR
-options accumulate.
+unless the script contains \f(CW\*(C`INSERT\*(C'\fR, so \fIcommandfile\fR must
+specify everything necessary to describe the output file.
+.Sp
+If \fIscriptfile\fR does not exist in the current directory, \f(CW\*(C`ld\*(C'\fR
+looks for it in the directories specified by any preceding \fB\-L\fR
+options.
+.Sp
+Command line options that appear before the \fB\-T\fR option can
+affect the script, but command line options that appear after it do
+not.
+.Sp
+Multiple \fB\-T\fR options will accumulate if they are augmenting the
+current script, otherwise the last, non-augmenting, \fB\-T\fR option
+will be used.
+.Sp
+There are other ways of specifying linker scripts. See
.IP "\fB\-dT\fR \fIscriptfile\fR" 4
.IX Item "-dT scriptfile"
.PD 0
@@ -2089,12 +2099,13 @@ the i386 PE and ELF targetted ports of the linker.
.IP \fB\-\-pic\-executable\fR 4
.IX Item "--pic-executable"
.PD
-Create a position independent executable. This is currently only supported on
-ELF platforms. Position independent executables are similar to shared
-libraries in that they are relocated by the dynamic linker to the virtual
-address the OS chooses for them (which can vary between invocations). Like
-normal dynamically linked executables they can be executed and symbols
-defined in the executable cannot be overridden by shared libraries.
+Create a position independent executable. This is currently only
+supported on ELF platforms. Position independent executables are
+relocated by the dynamic linker to the virtual address the OS chooses
+for them, which can vary between invocations. They are marked ET_DYN
+in the ELF file header, but differ from shared libraries in a number
+of ways. In particular, defined symbols in a PIE by default can not
+be overridden by another object as they can be in a shared library.
.IP \fB\-no\-pie\fR 4
.IX Item "-no-pie"
Create a position dependent executable. This is the default.
@@ -2180,11 +2191,11 @@ of the input files.
When the linker encounters such a dependency when doing a non-shared,
non-relocatable link, it will automatically try to locate the required
shared library and include it in the link, if it is not included
-explicitly. In such a case, the \fB\-rpath\-link\fR option
-specifies the first set of directories to search. The
-\&\fB\-rpath\-link\fR option may specify a sequence of directory names
-either by specifying a list of names separated by colons, or by
-appearing multiple times.
+explicitly. In such a case, several directories are searched as
+described below. The \fB\-rpath\-link\fR option specifies the first
+set of directories to search. This option may specify a sequence of
+directory names either by providing a list of names separated by
+colons, or by appearing multiple times.
.Sp
The tokens \fR\f(CI$ORIGIN\fR\fI\fR and \fI\fR\f(CI$LIB\fR\fI\fR can appear in these search
directories. They will be replaced by the full path to the directory
@@ -2196,13 +2207,18 @@ The alternative form of these tokens \- \fI${ORIGIN}\fR and
\&\fI${LIB}\fR can also be used. The token \fR\f(CI$PLATFORM\fR\fI\fR is not
supported.
.Sp
-This option should be used with caution as it overrides the search path
-that may have been hard compiled into a shared library. In such a case it
-is possible to use unintentionally a different search path than the
-runtime linker would do.
-.Sp
-The linker uses the following search paths to locate required shared
-libraries:
+The \fB\-\-rpath\-link\fR option should be used with caution as it
+overrides the search path that may have been hard compiled into a
+shared library. In such a case it is possible to unintentionally use
+a different search path than the runtime linker would have used.
+.Sp
+When additional shared libraries are required, the linker will search
+directories in the order listed below in order to find them. Note
+however that this only applies to additional libraries needed to
+satisfy already included shared libraries. It does \fInot\fR
+apply to libraries that are included via the \fB\-l\fR command line
+option. Searches for \fB\-l\fR libraries are only conducted in
+directories specified by the \fB\-L\fR option
.RS 4
.IP 1. 4
Any directories specified by \fB\-rpath\-link\fR options.
@@ -2266,6 +2282,49 @@ of the first.
If the required shared library is not found, the linker will issue a
warning and continue with the link.
.RE
+.IP \fB\-\-section\-ordering\-file=\fR\fIscript\fR 4
+.IX Item "--section-ordering-file=script"
+This option is used to augment the current linker script with
+additional mapping of input sections to output sections. This file
+must use the same syntax for \f(CW\*(C`SECTIONS\*(C'\fR as is used in normal
+linker scripts, but it should not do anything other than place input
+sections into output sections. \f(CW@pxref\fR{SECTIONS}
+.Sp
+A second constraint on the section ordering script is that it can only
+reference output sections that are already defined by whichever linker
+script is currently in use. (Ie the default linker script or a script
+specified on the command line). The benefit of the section ordering
+script however is that the input sections are mapped to the start of
+the output sections, so that they can ensure the ordering of sections
+in the output section. For example, imagine that the default linker
+script looks like this:
+.Sp
+.Vb 4
+\& SECTIONS {
+\& .text : { *(.text.hot) ; *(.text .text.*) }
+\& .data : { *(.data.big) ; *(.data .data.*) }
+\& }
+.Ve
+.Sp
+Then if a section ordering file like this is used:
+.Sp
+.Vb 2
+\& .text : { *(.text.first) ; *(.text.z*) }
+\& .data : { foo.o(.data.first) ; *(.data.small) }
+.Ve
+.Sp
+This would be equivalent to a linker script like this:
+.Sp
+.Vb 4
+\& SECTIONS {
+\& .text : { *(.text.first) ; *(.text.z*) ; *(.text.hot) ; *(.text .text.*) }
+\& .data : { foo.o(.data.first) ; *(.data.small) ; *(.data.big) ; *(.data .data.*) }
+\& }
+.Ve
+.Sp
+The advantage of the section ordering file is that it can be used to
+order those sections that matter to the user without having to worry
+about any other sections, or memory regions, or anything else.
.IP \fB\-shared\fR 4
.IX Item "-shared"
.PD 0