diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2000-07-20 03:25:10 +0000 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2000-07-20 03:25:10 +0000 |
commit | e0ee487bb566f047bbc43dee18e81bab14cba096 (patch) | |
tree | 9d48cd80dcbe6c6a26c5b72750605cbd0c5893d8 /ld/emultempl/elf32.em | |
parent | 9bfcb6d6894b9224f4b8f55c4f6f14dea93e28ad (diff) | |
download | gdb-e0ee487bb566f047bbc43dee18e81bab14cba096.zip gdb-e0ee487bb566f047bbc43dee18e81bab14cba096.tar.gz gdb-e0ee487bb566f047bbc43dee18e81bab14cba096.tar.bz2 |
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.
Diffstat (limited to 'ld/emultempl/elf32.em')
-rw-r--r-- | ld/emultempl/elf32.em | 154 |
1 files changed, 151 insertions, 3 deletions
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 3cdb856..0e4464d 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -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 = |