* emultempl/elf32.em (OPTION_GROUP): New macro.

Add new option Bgroup to longopts.
	(gld*_parse_args): Handle GROUP_OPTION and recognize -z defs.
	(gld*_list_options): Add -Bgroup and -z defs.
	* ld.1: Document -Bgroup and -z defs.
	* ld.texinfo: Likewise.
This commit is contained in:
Ulrich Drepper
2001-03-17 21:24:26 +00:00
parent 249e3833ac
commit a1ab1d2aa3
4 changed files with 90 additions and 45 deletions

View File

@ -1,3 +1,12 @@
2001-03-17 Ulrich Drepper <drepper@redhat.com>
* emultempl/elf32.em (OPTION_GROUP): New macro.
Add new option Bgroup to longopts.
(gld*_parse_args): Handle GROUP_OPTION and recognize -z defs.
(gld*_list_options): Add -Bgroup and -z defs.
* ld.1: Document -Bgroup and -z defs.
* ld.texinfo: Likewise.
2001-03-07 Michael Meissner <meissner@redhat.com>
* scripttempl/elfd10v.sc (.rodata,.rodata1,.data1,.sdata): Deal

View File

@ -1334,6 +1334,7 @@ cat >>e${EMULATION_NAME}.c <<EOF
#define OPTION_DISABLE_NEW_DTAGS (400)
#define OPTION_ENABLE_NEW_DTAGS (OPTION_DISABLE_NEW_DTAGS + 1)
#define OPTION_GROUP (OPTION_ENABLE_NEW_DTAGS + 1)
static struct option longopts[] =
{
@ -1347,6 +1348,8 @@ cat >>e${EMULATION_NAME}.c <<EOF
{"disable-new-dtags", no_argument, NULL, OPTION_DISABLE_NEW_DTAGS},
{"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS},
{"enable-new-dtags", no_argument, NULL, OPTION_ENABLE_NEW_DTAGS},
{"Bgroup", no_argument, NULL, OPTION_GROUP},
{"Bgroup", no_argument, NULL, OPTION_GROUP},
EOF
fi
@ -1405,6 +1408,12 @@ cat >>e${EMULATION_NAME}.c <<EOF
link_info.new_dtags = true;
break;
case OPTION_GROUP:
link_info.flags_1 |= (bfd_vma) DF_1_GROUP;
/* Groups must be self-contained. */
link_info.no_undefined = true;
break;
case 'z':
if (strcmp (optarg, "initfirst") == 0)
link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST;
@ -1430,6 +1439,8 @@ cat >>e${EMULATION_NAME}.c <<EOF
link_info.flags |= (bfd_vma) DF_ORIGIN;
link_info.flags_1 |= (bfd_vma) DF_1_ORIGIN;
}
else if (strcmp (optarg, "defs") == 0)
link_info.no_undefined = true;
/* What about the other Solaris -z options? FIXME. */
break;
EOF
@ -1463,8 +1474,10 @@ EOF
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
cat >>e${EMULATION_NAME}.c <<EOF
fprintf (file, _(" -Bgroup\t\tSelects group name lookup rules for DSO\n"));
fprintf (file, _(" --disable-new-dtags\tDisable new dynamic tags\n"));
fprintf (file, _(" --enable-new-dtags\tEnable new dynamic tags\n"));
fprintf (file, _(" -z defs\t\tDisallows undefined symbols\n"));
fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at runtime\n"));
fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but executable\n"));
fprintf (file, _(" -z loadfltr\t\tMark object requiring immediate process\n"));

14
ld/ld.1
View File

@ -29,6 +29,7 @@ ld \- the GNU linker
.I input-format\c
\&\|]
.RB "[\|" \-Bstatic "\|]"
.RB "[\|" \-Bgroup "\|]"
.RB "[\|" \-Bdynamic "\|]"
.RB "[\|" \-Bsymbolic "\|]"
.RB "[\|" "\-c\ "\c
@ -406,6 +407,19 @@ 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 \-Bgroup
Set the \c
.B DF_1_GROUP
\c
flag in the \c
.B DT_FLAGS_1
\c
entry in the dynamic section. This causes the runtime linker to handle
lookups in this object and its dependencies to be performed only inside
the group. No undefined symbols are allowed. This option is only
meaningful on ELF platforms which support shared libraries.
.TP
.B \-Bsymbolic
When creating a shared library, bind references to global symbols to

View File

@ -767,6 +767,7 @@ of this object will ignore any default library search paths.
@code{nodump} marks the object can not be dumped by @code{dldump}.
@code{now} marks the object with the non-lazy runtime binding.
@code{origin} marks the object may contain $ORIGIN.
@code{defs} disallows undefined symbols.
@kindex -(
@cindex groups of archives
@ -805,6 +806,14 @@ for compatibility with various systems. You may use this option
multiple times on the command line: it affects library searching for
@code{-l} options which follow it.
@kindex -Bgroup
@item -Bgroup
Set the @code{DF_1_GROUP} flag in the @code{DT_FLAGS_1} entry in the dynamic
section. This causes the runtime linker to handle lookups in this
object and its dependencies to be performed only inside the group.
@code{--no-undefined} is implied. This option is only meaningful on ELF
platforms which support shared libraries.
@kindex -Bstatic
@kindex -dn
@kindex -non_shared
@ -945,9 +954,11 @@ necessary. This may be required if @code{ld} runs out of memory space
while linking a large executable.
@kindex --no-undefined
@kindex -z defs
@item --no-undefined
@itemx -z defs
Normally when creating a non-symbolic shared library, undefined symbols
are allowed and left to be resolved by the runtime loader. This option
are allowed and left to be resolved by the runtime loader. These options
disallows such undefined symbols.
@kindex --allow-shlib-undefined
@ -4899,5 +4910,3 @@ to permit their use in free software.
@contents
@bye