* ld.texinfo, ld.1: Document -Bstatic, -Bdynamic, -Bshared, and

-shared.

Mon Jul 10 13:29:43 1995  Eric Youngdale  <eric@aib.com>

	* ldmain.c (main): Set link_info.symbolic to false.
	* lexsup.c (parse_args): Handle -Bsymbolic.
This commit is contained in:
Ian Lance Taylor 1995-07-10 17:41:13 +00:00
parent 951fe66d62
commit 4551e108a0
5 changed files with 86 additions and 11 deletions

View File

@ -1,3 +1,13 @@
Mon Jul 10 13:38:28 1995 Ian Lance Taylor <ian@cygnus.com>
* ld.texinfo, ld.1: Document -Bstatic, -Bdynamic, -Bshared, and
-shared.
Mon Jul 10 13:29:43 1995 Eric Youngdale <eric@aib.com>
* ldmain.c (main): Set link_info.symbolic to false.
* lexsup.c (parse_args): Handle -Bsymbolic.
Wed Jul 5 00:12:11 1995 Fred Fish (fnf@cygnus.com)
* ldmain.c (HAVE_SBRK): Define for everything except

28
ld/ld.1
View File

@ -28,6 +28,8 @@ ld \- the GNU linker
.I input-format\c
\&\|]
.RB "[\|" \-Bstatic "\|]"
.RB "[\|" \-Bdynamic "\|]"
.RB "[\|" \-Bsymbolic "\|]"
.RB "[\|" "\-c\ "\c
.I commandfile\c
\&\|]
@ -82,6 +84,7 @@ ld \- the GNU linker
.RB "[\|" \-r | \-Ur "\|]"
.RB "[\|" \-S "\|]"
.RB "[\|" \-s "\|]"
.RB "[\|" \-shared "\|]"
.RB "[\|" \-sort\-common "\|]"
.RB "[\|" \-split\-by\-reloc\ "\c
.I count\c
@ -354,10 +357,22 @@ format from a script, using the command \c
.TP
.B \-Bstatic
This flag is accepted for command-line compatibility with the SunOS linker,
but has no effect on \c
.B ld\c
\&.
Do not link against shared libraries. This is only meaningful on
platforms for which shared libraries are supported.
.TP
.B \-Bdynamic
Link against dynamic libraries. This is only meaningful on platforms
for which shared libraries are supported. This option is normally the
default on such platforms.
.TP
.B \-Bsymbolic
When creating a shared library, bind references to global symbols to
the definition within the shared library, if any. Normally, it is
possible for a program linked against a shared library to override the
definition within the shared library. This option is only meaningful
on ELF platforms which support shared libraries.
.TP
.BI "\-c " "commandfile"\c
@ -704,6 +719,11 @@ Omits debugger symbol information (but not all symbols) from the output file.
.B \-s
Omits all symbol information from the output file.
.TP
.B \-shared
Create a shared library. This is currently only supported on ELF
platforms.
.TP
.B \-sort\-common
Normally, when

View File

@ -167,7 +167,8 @@ line:
@c FIXME! -relax only avail h8/300, i960. Conditionals screwed in examples.
@smallexample
ld [ -o @var{output} ] @var{objfile}@dots{}
[ -A@var{architecture} ] [ -b @var{input-format} ] [ -Bstatic ]
[ -A@var{architecture} ] [ -b @var{input-format} ]
[ -Bstatic ] [ -Bdynamic ] [ -Bsymbolic ]
[ -c @var{MRI-commandfile} ] [ -d | -dc | -dp ]
[ -defsym @var{symbol}=@var{expression} ]
[ -dynamic-linker @var{file} ] [ -embedded-relocs ]
@ -175,16 +176,16 @@ ld [ -o @var{output} ] @var{objfile}@dots{}
[ -format @var{input-format} ] [ -g ] [ -G @var{size} ] [ -help ]
[ -i ] [ -l@var{archive} ] [ -L@var{searchdir} ] [ -M ]
[ -Map @var{mapfile} ] [ -m @var{emulation} ] [ -N | -n ]
[ -noinhibit-exec ] [ -oformat @var{output-format} ]
[ -noinhibit-exec ] [ -no-keep-memory ] [ -oformat @var{output-format} ]
[ -R @var{filename} ] [ -relax ] [ -retain-symbols-file @var{filename} ]
[ -r | -Ur ] [ -rpath @var{dir} ] [ -S ] [ -s ] [ -soname @var{name} ]
[ -sort-common ] [ -stats ] [ -T @var{commandfile} ]
[ -shared ] [ -sort-common ] [ -stats ] [ -T @var{commandfile} ]
[ -Ttext @var{org} ] [ -Tdata @var{org} ]
[ -Tbss @var{org} ] [ -t ] [ -traditional-format ]
[ -u @var{symbol}] [-V] [-v] [ -verbose] [ -version ]
[ -warn-common ] [ -warn-once ] [ -y @var{symbol} ] [ -X ] [-x ]
[ -( [ archives ] -) ] [ --start-group [ archives ] --end-group ]
[ -split-by-reloc @var{count} ] [-split-by-file]
[ -split-by-reloc @var{count} ] [ -split-by-file ] [ --whole-archive ]
@end smallexample
This plethora of command-line options may seem intimidating, but in
@ -308,8 +309,22 @@ Commands}.
@kindex -Bstatic
@item -Bstatic
Do not link against shared libraries. This option is accepted for
command-line compatibility with the SunOS linker.
Do not link against shared libraries. This is only meaningful on
platforms for which shared libraries are supported.
@kindex -Bdynamic
@item -Bdynamic
Link against dynamic libraries. This is only meaningful on platforms
for which shared libraries are supported. This option is normally the
default on such platforms.
@kindex -Bsymbolic
@item -Bsymbolic
When creating a shared library, bind references to global symbols to the
definition within the shared library, if any. Normally, it is possible
for a program linked against a shared library to override the definition
within the shared library. This option is only meaningful on ELF
platforms which support shared libraries.
@kindex -c @var{MRI-cmdfile}
@cindex compatibility, MRI
@ -488,6 +503,15 @@ Normally, the linker will not produce an output file if it encounters
errors during the link process; it exits without writing an output file
when it issues any error whatsoever.
@item -no-keep-memory
@cindex memory usage
@kindex -no-keep-memory
@code{ld} normally optimizes for speed over memory usage by caching the
symbol tables of input files in memory. This option tells @code{ld} to
instead optimize for memory usage, by rereading the symbol tables as
necessary. This may be required if @code{ld} runs out of memory space
while linking a large executable.
@item -o @var{output}
@kindex -o @var{output}
@cindex naming the output file
@ -610,7 +634,14 @@ 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 -shared
@cindex shared libraries
@kindex -shared
Create a shared library. This is currently only supported on ELF
platforms.
@item -sort-common
@kindex -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
one byte symbols, then all the two bytes, then all the four bytes, and
@ -816,6 +847,14 @@ encountered in a different order.
Only warn once for each undefined symbol, rather than once per module
which refers to it.
@kindex --whole-archive
@cindex including an entire archive
For each archive mentioned on the command line, include every object
file in the archive in the link, rather than searching the archive for
the required object files. This is normally used to turn an archive
file into a shared library, forcing every object to be included in the
resulting shared library.
@kindex -X
@cindex local symbols, deleting
@cindex L, deleting symbols beginning

View File

@ -180,6 +180,7 @@ main (argc, argv)
link_info.callbacks = &link_callbacks;
link_info.relocateable = false;
link_info.shared = false;
link_info.symbolic = false;
link_info.strip = strip_none;
link_info.discard = discard_none;
link_info.lprefix_len = 1;

View File

@ -93,7 +93,8 @@ parse_args (argc, argv)
#define OPTION_STACK (OPTION_SORT_COMMON + 1) /*WINDOWS_NT*/
#define OPTION_STATS (OPTION_STACK + 1)
#define OPTION_SUBSYSTEM (OPTION_STATS + 1) /* WINDOWS_NT */
#define OPTION_TBSS (OPTION_SUBSYSTEM + 1)
#define OPTION_SYMBOLIC (OPTION_SUBSYSTEM + 1)
#define OPTION_TBSS (OPTION_SYMBOLIC + 1)
#define OPTION_TDATA (OPTION_TBSS + 1)
#define OPTION_TTEXT (OPTION_TDATA + 1)
#define OPTION_TRADITIONAL_FORMAT (OPTION_TTEXT + 1)
@ -109,6 +110,7 @@ parse_args (argc, argv)
static struct option longopts[] = {
{"Bdynamic", no_argument, NULL, OPTION_CALL_SHARED},
{"Bstatic", no_argument, NULL, OPTION_NON_SHARED},
{"Bsymbolic", no_argument, NULL, OPTION_SYMBOLIC},
{"call_shared", no_argument, NULL, OPTION_CALL_SHARED},
{"dc", no_argument, NULL, 'd'},
{"defsym", required_argument, NULL, OPTION_DEFSYM},
@ -394,6 +396,9 @@ parse_args (argc, argv)
case OPTION_SUBSYSTEM: /* WINDOWS_NT */
set_subsystem (optarg);
break;
case OPTION_SYMBOLIC:
link_info.symbolic = true;
break;
case 't':
trace_files = true;
break;