aboutsummaryrefslogtreecommitdiff
path: root/ld/ld.texinfo
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-09-13 20:42:47 +0000
committerIan Lance Taylor <ian@airs.com>1994-09-13 20:42:47 +0000
commit0b3499f6721808b2f676a8caf8744002447c00b2 (patch)
tree54cd88586ebe8f2d7f23ab1f7e67ca13170c854e /ld/ld.texinfo
parent204ba9e37eb78aebc70aec88d2a55b7893166f79 (diff)
downloadgdb-0b3499f6721808b2f676a8caf8744002447c00b2.zip
gdb-0b3499f6721808b2f676a8caf8744002447c00b2.tar.gz
gdb-0b3499f6721808b2f676a8caf8744002447c00b2.tar.bz2
* ldlang.c (load_symbols): Check for archive before object. Use
bfd_check_format_matches, and, if ambiguous, print a list of matching formats. If file format is not recognized, treat file as a linker script. * ldgram.y (yyerror): If assuming an object file is a script, mention that. Tweak the format of the error messages. * ldlex.l (lex_warn_invalid): If assuming an object is a script, guess that this is not actually a script, and just report that the file format was not recognized. * ld.texinfo (Options): Admit that -( may be used more than once. Add note that unrecognized object files are now treated as linker scripts. * ldfile.c (ldfile_input_filename): Make const. (ldfile_assumed_script): New variable. (try_open): Change arguments types to const. (ldfile_find_command_file): Likewise. (ldfile_open_command_file): Likewise. Also, set lineno to 1. * ldfile.h: Update declarations for ldfile.c changes. * ldlex.l: Include <ctype.h>. (file_name_stack): Change to be const char *. (lineno_stack): New static variable. (<<EOF>>): Set lineno as well as ldfile_input_filename. (lex_push_file): Make name argument const. Initialize lineno_stack entry. (lex_redirect): Initialize lineno_stack entry. (lex_warn_invalid): Handle non printable characters nicely. * ldlex.h (lex_push_file): Declare second argument as const. * ldgram.y (ifile_p1): Recognize GROUP. * ldlex.l: Recognize GROUP. * ld.texinfo (Option Commands): Document GROUP.
Diffstat (limited to 'ld/ld.texinfo')
-rw-r--r--ld/ld.texinfo50
1 files changed, 45 insertions, 5 deletions
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index e9a2fb7..b33094a 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -177,8 +177,8 @@ ld [ -o @var{output} ] @var{objfile}@dots{}
[ -Map @var{mapfile} ] [ -m @var{emulation} ] [ -N | -n ]
[ -noinhibit-exec ] [ -oformat @var{output-format} ]
[ -R @var{filename} ] [ -relax ] [ -retain-symbols-file @var{filename} ]
- [ -r | -Ur ] [ -rpath @var{dir} ] [ -S ] [ -s ] [ -sort-common ]
- [ -stats ] [ -T @var{commandfile} ]
+ [ -r | -Ur ] [ -rpath @var{dir} ] [ -S ] [ -s ] [ -soname @var{name} ]
+ [ -sort-common ] [ -stats ] [ -T @var{commandfile} ]
[ -Ttext @var{org} ] [ -Tdata @var{org} ]
[ -Tbss @var{org} ] [ -t ] [ -traditional-format ]
[ -u @var{symbol}] [-V] [-v] [ -version ]
@@ -211,11 +211,13 @@ option.
@ifclear SingleFormat
The exceptions---which may meaningfully be used more than once---are
@samp{-A}, @samp{-b} (or its synonym @samp{-format}), @samp{-defsym},
-@samp{-L}, @samp{-l}, @samp{-R}, and @samp{-u}.
+@samp{-L}, @samp{-l}, @samp{-R}, @samp{-u}, and @samp{-(} (or its
+synonym @samp{--start-group})..
@end ifclear
@ifset SingleFormat
The exceptions---which may meaningfully be used more than once---are
-@samp{-A}, @samp{-defsym}, @samp{-L}, @samp{-l}, @samp{-R}, and @samp{-u}.
+@samp{-A}, @samp{-defsym}, @samp{-L}, @samp{-l}, @samp{-R}, @samp{-u},
+and @samp{-(} (or its synonym @samp{--start-group}).
@end ifset
@cindex object files
@@ -230,6 +232,14 @@ and the script command language. If @emph{no} binary input files at all
are specified, the linker does not produce any output, and issues the
message @samp{No input files}.
+If the linker can not recognize the format of an object file, it will
+assume that it is a linker script. A script specified in this way
+augments the main linker script used for the link (either the default
+linker script or the one specified by using @samp{-T}). This feature
+permits the linker to link against a file which appears to be an object
+or an archive, but actually merely defines some symbol values, or uses
+@code{INPUT} or @code{GROUP} to load other objects. @xref{Commands}.
+
For options whose names are a single letter,
option arguments must either follow the option letter without intervening
whitespace, or be given as separate arguments immediately following the
@@ -579,6 +589,17 @@ Omit debugger symbol information (but not all symbols) from the output file.
@item -s
Omit all symbol information from the output file.
+@ifset GENERIC
+@item -soname @var{name}
+@cindex runtime library name
+@kindex -soname
+When creating an ELF shared object, set the internal DT_SONAME field to
+the specified name. When an executable is linked with a shared object
+which has a DT_SONAME field, then when the executable is run the dynamic
+linker will attempt to load the shared object specified by the DT_SONAME
+field rather than the using the file name given to the linker.
+@end ifset
+
@item -sort-common
Normally, when @code{ld} places the global common symbols in the
appropriate output sections, it sorts them by size. First come all the
@@ -1211,7 +1232,17 @@ SECTIONS @{ @dots{}
@kindex Non constant expression
@noindent
will cause the error message ``@code{Non constant expression for initial
-address}''.
+address}''.
+
+@cindex provide
+In some cases, it is desirable for a linker script to define a symbol
+only if it is referenced, and only if it is not defined by any object
+included in the link. For example, traditional linkers defined the
+symbol @samp{etext}. However, ANSI C requires that the user be able to
+use @samp{etext} as a function name without encountering an error.
+The @code{PROVIDE} keyword may be used to define a symbol, such as
+@samp{etext}, only if it is referenced but not defined. The syntax is
+@code{PROVIDE(@var{symbol} = @var{expression})}.
@node Arithmetic Functions
@subsection Arithmetic Functions
@@ -2019,6 +2050,15 @@ search path, just as for files you specify on the command line.
See the description of @samp{-L} in @ref{Options,,Command Line
Options}.
+@kindex GROUP ( @var{files} )
+@cindex grouping input files
+@item GROUP ( @var{file}, @var{file}, @dots{} )
+@itemx GROUP ( @var{file} @var{file} @dots{} )
+This command is like @code{INPUT}, except that the named files should
+all be archives, and they are searched repeatedly until no new undefined
+references are created. See the description of @samp{-(} in
+@ref{Options,,Command Line Options}.
+
@ignore
@item MAP ( @var{name} )
@kindex MAP ( @var{name} )