2000-07-19 H.J. Lu <hjl@gnu.org>
* emulparams/elf32mcore.sh (PARSE_AND_LIST_ARGS): Removed. (PARSE_AND_LIST_PROLOGUE): New. (PARSE_AND_LIST_LONGOPTS): Likewise. (PARSE_AND_LIST_OPTIONS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Likewise. * ldmain.c (main): Clear link_info.flags and link_info.flags_1. * lexsup.c (ld_options): Comment out 'z'. (parse_args): Likewise. * emultempl/elf32.em: Include "elf/common.h". (gld_${EMULATION_NAME}_parse_args): Defined. Handle some -z options. (gld_${EMULATION_NAME}_list_options): Likewise. * ld.texinfo: Add documentation for the recognized -z options.
This commit is contained in:
parent
9bfcb6d689
commit
e0ee487bb5
6 changed files with 201 additions and 52 deletions
20
ld/ChangeLog
20
ld/ChangeLog
|
@ -1,3 +1,23 @@
|
|||
2000-07-19 H.J. Lu <hjl@gnu.org>
|
||||
|
||||
* elf32-arm.h (elf32_arm_size_dynamic_sections): Also set
|
||||
DF_TEXTREL if DT_TEXTREL is set.
|
||||
* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
|
||||
* elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
|
||||
* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
|
||||
* elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
|
||||
* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
|
||||
* elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
|
||||
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
|
||||
* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
|
||||
* elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise.
|
||||
* elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.
|
||||
|
||||
* bfd/elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also
|
||||
set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if
|
||||
DT_RPATH is set.
|
||||
Set the DT_FLAGS and DT_FLAGS_1 entries if necessary.
|
||||
|
||||
2000-07-19 H.J. Lu <hjl@gnu.org>
|
||||
|
||||
* emultempl/elf32.em (gld${EMULATION_NAME}_try_needed): Call
|
||||
|
|
|
@ -33,54 +33,20 @@ GENERATE_SHLIB_SCRIPT=yes
|
|||
|
||||
# This code gets inserted into the generic elf32.sc linker script
|
||||
# and allows us to define our own command line switches.
|
||||
PARSE_AND_LIST_ARGS='
|
||||
|
||||
PARSE_AND_LIST_PROLOGUE='
|
||||
#define OPTION_BASE_FILE 300
|
||||
'
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
static struct option longopts[] =
|
||||
{
|
||||
PARSE_AND_LIST_LONGOPTS='
|
||||
{"base-file", required_argument, NULL, OPTION_BASE_FILE},
|
||||
{NULL, no_argument, NULL, 0}
|
||||
};
|
||||
'
|
||||
|
||||
static void
|
||||
gld_elf32mcore_list_options (file)
|
||||
FILE * file;
|
||||
{
|
||||
fprintf (file, _(" --base_file <basefile> Generate a base file for relocatable DLLs\n"));
|
||||
}
|
||||
|
||||
static int
|
||||
gld_elf32mcore_parse_args (argc, argv)
|
||||
int argc;
|
||||
char ** argv;
|
||||
{
|
||||
int longind;
|
||||
int optc;
|
||||
int prevoptind = optind;
|
||||
int prevopterr = opterr;
|
||||
int wanterror;
|
||||
static int lastoptind = -1;
|
||||
|
||||
if (lastoptind != optind)
|
||||
opterr = 0;
|
||||
|
||||
wanterror = opterr;
|
||||
lastoptind = optind;
|
||||
|
||||
optc = getopt_long_only (argc, argv, "-", longopts, & longind);
|
||||
opterr = prevopterr;
|
||||
|
||||
switch (optc)
|
||||
{
|
||||
default:
|
||||
if (wanterror)
|
||||
xexit (1);
|
||||
optind = prevoptind;
|
||||
return 0;
|
||||
PARSE_AND_LIST_OPTIONS='
|
||||
fprintf (file, _(" --base_file <basefile>\n"));
|
||||
fprintf (file, _("\t\t\tGenerate a base file for relocatable DLLs\n"));
|
||||
'
|
||||
|
||||
PARSE_AND_LIST_ARGS_CASES='
|
||||
case OPTION_BASE_FILE:
|
||||
link_info.base_file = (PTR) fopen (optarg, FOPEN_WB);
|
||||
if (link_info.base_file == NULL)
|
||||
|
@ -91,9 +57,4 @@ gld_elf32mcore_parse_args (argc, argv)
|
|||
xexit (1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
'
|
||||
|
|
|
@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||
#include "ldfile.h"
|
||||
#include "ldemul.h"
|
||||
#include "ldgram.h"
|
||||
#include "elf/common.h"
|
||||
|
||||
static void gld${EMULATION_NAME}_before_parse PARAMS ((void));
|
||||
static boolean gld${EMULATION_NAME}_open_dynamic_archive
|
||||
|
@ -1184,14 +1185,15 @@ EOF
|
|||
|
||||
fi
|
||||
|
||||
if test -n "$PARSE_AND_LIST_ARGS" ; then
|
||||
if test -n "$PARSE_AND_LIST_ARGS_CASES" || test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
|
||||
NEED_PARSE_AND_LIST=yes
|
||||
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
static int gld_${EMULATION_NAME}_parse_args PARAMS ((int, char **));
|
||||
static void gld_${EMULATION_NAME}_list_options PARAMS ((FILE * file));
|
||||
|
||||
$PARSE_AND_LIST_ARGS
|
||||
EOF
|
||||
else
|
||||
NEED_PARSE_AND_LIST=no
|
||||
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
#define gld_${EMULATION_NAME}_parse_args NULL
|
||||
|
@ -1200,6 +1202,152 @@ EOF
|
|||
|
||||
fi
|
||||
|
||||
if test -n "$PARSE_AND_LIST_PROLOGUE" ; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
$PARSE_AND_LIST_PROLOGUE
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test "$NEED_PARSE_AND_LIST" = yes; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
|
||||
#include "getopt.h"
|
||||
|
||||
static struct option longopts[] =
|
||||
{
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
{NULL, required_argument, NULL, 'z'},
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test -n "$PARSE_AND_LIST_LONGOPTS" ; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
$PARSE_AND_LIST_LONGOPTS
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test "$NEED_PARSE_AND_LIST" = yes; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
{NULL, no_argument, NULL, 0}
|
||||
};
|
||||
|
||||
static int
|
||||
gld_${EMULATION_NAME}_parse_args (argc, argv)
|
||||
int argc;
|
||||
char ** argv;
|
||||
{
|
||||
int longind, optc;
|
||||
int prevoptind = optind;
|
||||
int prevopterr = opterr;
|
||||
int wanterror;
|
||||
static int lastoptind = -1;
|
||||
|
||||
if (lastoptind != optind)
|
||||
opterr = 0;
|
||||
|
||||
wanterror = opterr;
|
||||
optc = getopt_long_only (argc, argv, "-z:", longopts, &longind);
|
||||
opterr = prevopterr;
|
||||
|
||||
switch (optc)
|
||||
{
|
||||
default:
|
||||
if (wanterror)
|
||||
xexit (1);
|
||||
optind = prevoptind;
|
||||
return 0;
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
case 'z':
|
||||
if (strcmp (optarg, "initfirst") == 0)
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_INITFIRST;
|
||||
else if (strcmp (optarg, "interpose") == 0)
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_INTERPOSE;
|
||||
else if (strcmp (optarg, "loadfltr") == 0)
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_LOADFLTR;
|
||||
else if (strcmp (optarg, "nodefaultlib") == 0)
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_NODEFLIB;
|
||||
else if (strcmp (optarg, "nodelete") == 0)
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_NODELETE;
|
||||
else if (strcmp (optarg, "nodlopen") == 0)
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_NOOPEN;
|
||||
else if (strcmp (optarg, "nodump") == 0)
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_NODUMP;
|
||||
else if (strcmp (optarg, "now") == 0)
|
||||
{
|
||||
link_info.flags |= (bfd_vma) DF_BIND_NOW;
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_NOW;
|
||||
}
|
||||
else if (strcmp (optarg, "origin") == 0)
|
||||
{
|
||||
link_info.flags |= (bfd_vma) DF_ORIGIN;
|
||||
link_info.flags_1 |= (bfd_vma) DF_1_ORIGIN;
|
||||
}
|
||||
/* What about the other Solaris -z options? FIXME. */
|
||||
break;
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test -n "$PARSE_AND_LIST_ARGS_CASES" ; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
$PARSE_AND_LIST_ARGS_CASES
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test "$NEED_PARSE_AND_LIST" = yes; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
gld_${EMULATION_NAME}_list_options (file)
|
||||
FILE * file;
|
||||
{
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test x"$GENERATE_SHLIB_SCRIPT" = xyes; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
fprintf (file, _(" -z initfirst\t\tMark DSO to be initialized first at rutime\n"));
|
||||
fprintf (file, _(" -z interpose\t\tMark object to interpose all DSOs but execuable\n"));
|
||||
fprintf (file, _(" -z loadfltr\t\tMark object requiring immediate process\n"));
|
||||
fprintf (file, _(" -z nodefaultlib\tMark object not to use default search paths\n"));
|
||||
fprintf (file, _(" -z nodelete\t\tMark DSO non-deletable at runtime\n"));
|
||||
fprintf (file, _(" -z nodlopen\t\tMark DSO not availale to dlopen\n"));
|
||||
fprintf (file, _(" -z nodump\t\tMark DSO not availale to dldump\n"));
|
||||
fprintf (file, _(" -z now\t\tMark object non-lazy runtime binding\n"));
|
||||
fprintf (file, _(" -z origin\t\tMark object requiring immediate \$ORIGIN processing\n"));
|
||||
fprintf (file, _("\t\t\t at runtime\n"));
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test -n "$PARSE_AND_LIST_OPTIONS" ; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
$PARSE_AND_LIST_OPTIONS
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test "$NEED_PARSE_AND_LIST" = yes; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test -n "$PARSE_AND_LIST_EPILOGUE" ; then
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
$PARSE_AND_LIST_EPILOGUE
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >>e${EMULATION_NAME}.c <<EOF
|
||||
|
||||
struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
|
|
|
@ -737,7 +737,21 @@ for Solaris compatibility.
|
|||
|
||||
@kindex -z @var{keyword}
|
||||
@item -z @var{keyword}
|
||||
This option is ignored for Solaris compatibility.
|
||||
The recognized keywords are @code{initfirst}, @code{interpose},
|
||||
@code{loadfltr}, @code{nodefaultlib}, @code{nodelete}, @code{nodlopen},
|
||||
@code{nodump}, @code{now} and @code{origin}. The other keywords are
|
||||
ignored for Solaris compatibility. @code{initfirst} marks the object
|
||||
to be initialized first at runtime before any other objects.
|
||||
@code{interpose} marks the object that its symbol table interposes
|
||||
before all symbols but the primary executable. @code{loadfltr} marks
|
||||
the object that its filtees be processed immediately at runtime.
|
||||
@code{nodefaultlib} marks the object that the search for dependencies
|
||||
of this object will ignore any default library search paths.
|
||||
@code{nodelete} marks the object shouldn't be unloaded at runtime.
|
||||
@code{nodlopen} marks the object not available to @code{dlopen}.
|
||||
@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.
|
||||
|
||||
@kindex -(
|
||||
@cindex groups of archives
|
||||
|
|
|
@ -237,6 +237,8 @@ main (argc, argv)
|
|||
and _fini symbols. We are compatible. */
|
||||
link_info.init_function = "_init";
|
||||
link_info.fini_function = "_fini";
|
||||
link_info.flags = (bfd_vma) 0;
|
||||
link_info.flags_1 = (bfd_vma) 0;
|
||||
|
||||
ldfile_add_arch ("");
|
||||
|
||||
|
|
|
@ -237,8 +237,10 @@ static const struct ld_option ld_options[] =
|
|||
'y', N_("SYMBOL"), N_("Trace mentions of SYMBOL"), TWO_DASHES },
|
||||
{ {NULL, required_argument, NULL, '\0'},
|
||||
'Y', N_("PATH"), N_("Default search path for Solaris compatibility"), ONE_DASH },
|
||||
#if 0
|
||||
{ {NULL, required_argument, NULL, '\0'},
|
||||
'z', N_("KEYWORD"), N_("Ignored for Solaris compatibility"), ONE_DASH },
|
||||
#endif
|
||||
{ {"start-group", no_argument, NULL, '('},
|
||||
'(', NULL, N_("Start a group"), TWO_DASHES },
|
||||
{ {"end-group", no_argument, NULL, ')'},
|
||||
|
@ -994,11 +996,13 @@ the GNU General Public License. This program has absolutely no warranty.\n"));
|
|||
case 'y':
|
||||
add_ysym (optarg);
|
||||
break;
|
||||
#if 0
|
||||
case 'z':
|
||||
/* We accept and ignore this option for Solaris
|
||||
compatibility. Actually, on Solaris, optarg is not
|
||||
ignored. Someday we should handle it correctly. FIXME. */
|
||||
break;
|
||||
#endif
|
||||
case OPTION_SPLIT_BY_RELOC:
|
||||
config.split_by_reloc = strtoul (optarg, NULL, 0);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue