This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

An ELF DT patch


Hi, Nick,

This patch implements some new DT tags from the new gABI and Solaris 8.
glibc would like at least to use DF_1_NODELETE. Can I check it in?

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
--
Index: bfd/ChangeLog.linux
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.

Index: bfd/elf32-arm.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-arm.h,v
retrieving revision 1.6
diff -u -p -r1.6 elf32-arm.h
--- bfd/elf32-arm.h	2000/06/25 15:46:46	1.6
+++ bfd/elf32-arm.h	2000/07/19 18:33:51
@@ -2991,6 +2991,7 @@ elf32_arm_size_dynamic_sections (output_
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf32-i370.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-i370.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf32-i370.c
--- bfd/elf32-i370.c	2000/05/30 19:34:26	1.6
+++ bfd/elf32-i370.c	2000/07/19 18:34:04
@@ -959,6 +959,7 @@ i370_elf_size_dynamic_sections (output_b
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf32-i386.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-i386.c,v
retrieving revision 1.15
diff -u -p -r1.15 elf32-i386.c
--- bfd/elf32-i386.c	2000/06/13 19:25:29	1.15
+++ bfd/elf32-i386.c	2000/07/19 18:34:10
@@ -1238,6 +1238,7 @@ elf_i386_size_dynamic_sections (output_b
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-m68k.c,v
retrieving revision 1.6
diff -u -p -r1.6 elf32-m68k.c
--- bfd/elf32-m68k.c	2000/05/30 19:34:26	1.6
+++ bfd/elf32-m68k.c	2000/07/19 18:34:15
@@ -1307,6 +1307,7 @@ elf_m68k_size_dynamic_sections (output_b
 	{
 	  if (!bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf32-mips.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-mips.c,v
retrieving revision 1.12
diff -u -p -r1.12 elf32-mips.c
--- bfd/elf32-mips.c	2000/07/19 00:14:49	1.12
+++ bfd/elf32-mips.c	2000/07/19 18:34:31
@@ -8319,6 +8319,7 @@ _bfd_mips_elf_size_dynamic_sections (out
 	{
 	  if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
 
       if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_PLTGOT, 0))
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-ppc.c,v
retrieving revision 1.7
diff -u -p -r1.7 elf32-ppc.c
--- bfd/elf32-ppc.c	2000/05/30 19:34:26	1.7
+++ bfd/elf32-ppc.c	2000/07/19 18:34:39
@@ -2044,6 +2044,7 @@ ppc_elf_size_dynamic_sections (output_bf
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf32-sparc.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf32-sparc.c,v
retrieving revision 1.7
diff -u -p -r1.7 elf32-sparc.c
--- bfd/elf32-sparc.c	2000/05/30 19:34:26	1.7
+++ bfd/elf32-sparc.c	2000/07/19 18:34:47
@@ -1056,6 +1056,7 @@ elf32_sparc_size_dynamic_sections (outpu
 	{
 	  if (! bfd_elf32_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf64-alpha.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf64-alpha.c
--- bfd/elf64-alpha.c	2000/07/09 23:42:05	1.14
+++ bfd/elf64-alpha.c	2000/07/19 18:34:55
@@ -3312,6 +3312,7 @@ elf64_alpha_size_dynamic_sections (outpu
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf64-hppa.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf64-hppa.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 elf64-hppa.c
--- bfd/elf64-hppa.c	2000/07/13 15:56:12	1.1.1.3
+++ bfd/elf64-hppa.c	2000/07/19 18:35:10
@@ -1789,6 +1789,7 @@ elf64_hppa_size_dynamic_sections (output
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf64-ia64.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf64-ia64.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 elf64-ia64.c
--- bfd/elf64-ia64.c	2000/06/20 17:24:55	1.1.1.3
+++ bfd/elf64-ia64.c	2000/07/19 18:35:16
@@ -2517,6 +2517,7 @@ elf64_ia64_size_dynamic_sections (output
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
     }
 
Index: bfd/elf64-sparc.c
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elf64-sparc.c,v
retrieving revision 1.7
diff -u -p -r1.7 elf64-sparc.c
--- bfd/elf64-sparc.c	2000/05/30 19:34:26	1.7
+++ bfd/elf64-sparc.c	2000/07/19 18:35:22
@@ -1803,6 +1803,7 @@ sparc64_elf_size_dynamic_sections (outpu
 	{
 	  if (! bfd_elf64_add_dynamic_entry (info, DT_TEXTREL, 0))
 	    return false;
+	  info->flags |= DF_TEXTREL;
 	}
 
       /* Add dynamic STT_REGISTER symbols and corresponding DT_SPARC_REGISTER
Index: bfd/elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.34
diff -u -p -r1.34 elflink.h
--- bfd/elflink.h	2000/07/19 00:30:54	1.34
+++ bfd/elflink.h	2000/07/19 18:39:00
@@ -2837,6 +2837,7 @@ NAME(bfd_elf,size_dynamic_sections) (out
 	{
 	  if (! elf_add_dynamic_entry (info, DT_SYMBOLIC, 0))
 	    return false;
+	  info->flags |= DF_SYMBOLIC;
 	}
 
       if (rpath != NULL)
@@ -2846,7 +2847,8 @@ NAME(bfd_elf,size_dynamic_sections) (out
 	  indx = _bfd_stringtab_add (elf_hash_table (info)->dynstr, rpath,
 				     true, true);
 	  if (indx == (bfd_size_type) -1
-	      || ! elf_add_dynamic_entry (info, DT_RPATH, indx))
+	      || ! elf_add_dynamic_entry (info, DT_RPATH, indx)
+	      || ! elf_add_dynamic_entry (info, DT_RUNPATH, indx))
 	    return false;
 	}
 
@@ -3133,6 +3135,22 @@ NAME(bfd_elf,size_dynamic_sections) (out
 	    return false;
 
 	  elf_tdata (output_bfd)->cverdefs = cdefs;
+	}
+
+      if (info->flags)
+	{
+	  if (! elf_add_dynamic_entry (info, DT_FLAGS, info->flags))
+	    return false;
+	}
+
+      if (info->flags_1)
+	{
+	  if (! info->shared)
+	    info->flags_1 &= ~ (DF_1_INITFIRST
+				| DF_1_NODELETE
+				| DF_1_NOOPEN);
+	  if (! elf_add_dynamic_entry (info, DT_FLAGS_1, info->flags_1))
+	    return false;
 	}
 
       /* Work out the size of the version reference section.  */
Index: include/ChangeLog.linux
2000-07-18  H.J. Lu  (hjl@gnu.org)

	* (bfd_link_info): Add flags and flags_1.

Index: include/bfdlink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/include/bfdlink.h,v
retrieving revision 1.7
diff -u -p -r1.7 bfdlink.h
--- include/bfdlink.h	2000/05/18 22:10:35	1.7
+++ include/bfdlink.h	2000/07/19 03:19:57
@@ -246,6 +246,12 @@ struct bfd_link_info
   /* The function to call when the executable or shared object is
      unloaded.  */
   const char *fini_function;
+
+  /* May be used to set DT_FLAGS for ELF. */
+  bfd_vma flags;
+
+  /* May be used to set DT_FLAGS_1 for ELF. */
+  bfd_vma flags_1;
 };
 
 /* This structures holds a set of callback functions.  These are
Index: ld/ChangeLog.linux
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.

	* emulparams/elf64alpha.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.
	(PARSE_AND_LIST_EPILOGUE): 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.

Index: ld/ld.texinfo
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ld.texinfo,v
retrieving revision 1.4
diff -u -p -r1.4 ld.texinfo
--- ld/ld.texinfo	2000/06/20 17:47:43	1.4
+++ ld/ld.texinfo	2000/07/19 19:10:17
@@ -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
Index: ld/ldmain.c
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/ldmain.c,v
retrieving revision 1.13
diff -u -p -r1.13 ldmain.c
--- ld/ldmain.c	2000/07/13 16:00:36	1.13
+++ ld/ldmain.c	2000/07/19 03:26:51
@@ -238,6 +238,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 ("");
 
Index: ld/lexsup.c
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/lexsup.c,v
retrieving revision 1.17
diff -u -p -r1.17 lexsup.c
--- ld/lexsup.c	2000/07/09 23:42:05	1.17
+++ ld/lexsup.c	2000/07/19 01:48:46
@@ -241,8 +241,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, ')'},
@@ -1015,11 +1017,13 @@ the GNU General Public License.  This pr
 	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; 
Index: ld/emulparams/elf32mcore.sh
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emulparams/elf32mcore.sh,v
retrieving revision 1.1.1.4
diff -u -p -r1.1.1.4 elf32mcore.sh
--- ld/emulparams/elf32mcore.sh	2000/03/12 17:33:15	1.1.1.4
+++ ld/emulparams/elf32mcore.sh	2000/07/19 20:53:05
@@ -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;
+PARSE_AND_LIST_OPTIONS='
+  fprintf (file, _("  --base_file <basefile>\n"));
+  fprintf (file, _("\t\t\tGenerate a base file for relocatable DLLs\n"));
+'
 
-  optc   = getopt_long_only (argc, argv, "-", longopts, & longind);
-  opterr = prevopterr;
-
-  switch (optc)
-    {
-    default:
-      if (wanterror)
-	xexit (1);
-      optind =  prevoptind;
-      return 0;
-
+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;
-}
-
 '
Index: ld/emulparams/elf64alpha.sh
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emulparams/elf64alpha.sh,v
retrieving revision 1.3
diff -u -p -r1.3 elf64alpha.sh
--- ld/emulparams/elf64alpha.sh	2000/03/12 17:40:14	1.3
+++ ld/emulparams/elf64alpha.sh	2000/07/19 20:49:58
@@ -16,62 +16,27 @@ OTHER_READONLY_SECTIONS='.reginfo : { *(
 
 # 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_TASO		300
 /* Set the start address as in the Tru64 ld */
 #define ALPHA_TEXT_START_32BIT	0x12000000
 
 static int elf64alpha_32bit = 0;
 
-#include "getopt.h"
-
-static struct option longopts[] =
-{
-  {"taso", no_argument, NULL, OPTION_TASO},
-  {NULL, no_argument, NULL, 0}
-};
-
-static void
-gld_elf64alpha_list_options (file)
-     FILE * file;
-{
-  fprintf (file, _(
-"  -taso                       Load executable in the lower 31-bit addressable
-                                virtual address range.\n"));
-}
-
 struct ld_emulation_xfer_struct ld_elf64alpha_emulation;
 static void gld_elf64alpha_finish();
+'
 
-static int
-gld_elf64alpha_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_LONGOPTS='
+  {"taso", no_argument, NULL, OPTION_TASO},
+'
 
+PARSE_AND_LIST_OPTIONS='
+  fprintf (file, _("  -taso\t\t\tLoad executable in the lower 31-bit addressable\n"));
+  fprintf (file, _("\t\t\t  virtual address range\n"));
+'
+
+PARSE_AND_LIST_ARGS_CASES='
     case EOF:
       if (elf64alpha_32bit && !link_info.shared && !link_info.relocateable)
       {
@@ -85,11 +50,9 @@ gld_elf64alpha_parse_args (argc, argv)
     case OPTION_TASO:
       elf64alpha_32bit = 1;
       break;
-    }
-  
-  return 1;
-}
+'
 
+PARSE_AND_LIST_EPILOGUE='
 #include "elf/internal.h"
 #include "elf/alpha.h"
 #include "elf-bfd.h"
@@ -98,4 +61,5 @@ static void
 gld_elf64alpha_finish()
 {
   elf_elfheader (output_bfd)->e_flags |= EF_ALPHA_32BIT;
-}'
+}
+'
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /work/cvs/gnu/binutils/ld/emultempl/elf32.em,v
retrieving revision 1.18
diff -u -p -r1.18 elf32.em
--- ld/emultempl/elf32.em	2000/07/19 00:15:32	1.18
+++ ld/emultempl/elf32.em	2000/07/19 21:12:58
@@ -45,6 +45,7 @@ Foundation, Inc., 59 Temple Place - Suit
 #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
@@ -1190,20 +1191,167 @@ cat >>e${EMULATION_NAME}.c <<EOF
 }
 EOF
 
-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
 #define gld_${EMULATION_NAME}_list_options NULL
 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]