Revert the last change to emultempl/elf32.em
[deliverable/binutils-gdb.git] / ld / emultempl / sunos.em
index 6367c3c80344e0128bf8ecb5dfb49be770c7b48f..be6375a5dd119a6f0e2a8950efe1b93f9296271d 100644 (file)
@@ -9,8 +9,7 @@ fragment <<EOF
 /* This file is is generated by a shell script.  DO NOT EDIT! */
 
 /* SunOS emulation code for ${EMULATION_NAME}
-   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1991-2017 Free Software Foundation, Inc.
    Written by Steve Chamberlain <sac@cygnus.com>
    SunOS shared library support by Ian Lance Taylor <ian@cygnus.com>
 
@@ -85,7 +84,7 @@ static void
 gld${EMULATION_NAME}_before_parse (void)
 {
   ldfile_set_output_arch ("${OUTPUT_ARCH}", bfd_arch_`echo ${ARCH} | sed -e 's/:.*//'`);
-  config.dynamic_link = TRUE;
+  input_flags.dynamic = TRUE;
   config.has_shared = TRUE;
 }
 
@@ -156,9 +155,9 @@ gld${EMULATION_NAME}_find_so (lang_input_statement_type *inp)
   char *alc;
   struct stat st;
 
-  if (! inp->search_dirs_flag
-      || ! inp->is_archive
-      || ! inp->dynamic)
+  if (! inp->flags.search_dirs
+      || ! inp->flags.maybe_archive
+      || ! inp->flags.dynamic)
     return;
 
   ASSERT (CONST_STRNEQ (inp->local_sym_name, "-l"));
@@ -188,7 +187,7 @@ gld${EMULATION_NAME}_find_so (lang_input_statement_type *inp)
 
   /* Turn off the search_dirs_flag to prevent ldfile_open_file from
      searching for this file again.  */
-  inp->search_dirs_flag = FALSE;
+  inp->flags.search_dirs = FALSE;
 
   free (found);
 
@@ -366,8 +365,10 @@ gld${EMULATION_NAME}_after_open (void)
 {
   struct bfd_link_needed_list *needed, *l;
 
+  after_open_default ();
+
   /* We only need to worry about this when doing a final link.  */
-  if (link_info.relocatable || link_info.shared)
+  if (bfd_link_relocatable (&link_info) || bfd_link_pic (&link_info))
     return;
 
   /* Get the list of files which appear in ld_need entries in dynamic
@@ -426,7 +427,7 @@ gld${EMULATION_NAME}_after_open (void)
            {
              /* We've found the needed dynamic object.  */
              if (! bfd_link_add_symbols (abfd, &link_info))
-               einfo ("%F%B: could not read symbols: %E\n", abfd);
+               einfo ("%F%B: error adding symbols: %E\n", abfd);
            }
          else
            {
@@ -573,7 +574,7 @@ gld${EMULATION_NAME}_try_needed (const char *dir, const char *name)
 
   /* Add this file into the symbol table.  */
   if (! bfd_link_add_symbols (abfd, &link_info))
-    einfo ("%F%B: could not read symbols: %E\n", abfd);
+    einfo ("%F%B: error adding symbols: %E\n", abfd);
 
   return TRUE;
 }
@@ -668,7 +669,9 @@ gld${EMULATION_NAME}_before_allocation (void)
   /* The SunOS native linker creates a shared library whenever there
      are any undefined symbols in a link, unless -e is used.  This is
      pretty weird, but we are compatible.  */
-  if (! link_info.shared && ! link_info.relocatable && ! entry_from_cmdline)
+  if (! bfd_link_pic (&link_info)
+      && !bfd_link_relocatable (&link_info)
+      && ! entry_from_cmdline)
     {
       struct bfd_link_hash_entry *h;
 
@@ -685,20 +688,20 @@ gld${EMULATION_NAME}_before_allocation (void)
              lang_for_each_statement (gld${EMULATION_NAME}_find_assignment);
              if (! found_assign)
                {
-                 link_info.shared = TRUE;
+                 link_info.type = type_dll;
                  break;
                }
            }
        }
     }
 
-  if (link_info.shared)
+  if (bfd_link_pic (&link_info))
     {
       lang_output_section_statement_type *os;
 
       /* Set the .text section to start at 0x20, not 0x2020.  FIXME:
         This is too magical.  */
-      os = lang_output_section_statement_lookup (".text");
+      os = lang_output_section_statement_lookup (".text", 0, TRUE);
       if (os->addr_tree == NULL)
        os->addr_tree = exp_intop (0x20);
     }
@@ -709,7 +712,7 @@ gld${EMULATION_NAME}_before_allocation (void)
      one.  We need to create the symbol before calling
      size_dynamic_sections, although we can't set the value until
      afterward.  */
-  if (! link_info.relocatable)
+  if (!bfd_link_relocatable (&link_info))
     {
       hdyn = bfd_link_hash_lookup (link_info.hash, "__DYNAMIC", TRUE, FALSE,
                                   FALSE);
@@ -802,7 +805,7 @@ gld${EMULATION_NAME}_before_allocation (void)
   /* We must assign a value to __DYNAMIC.  It should be zero if we are
      not doing a dynamic link, or the start of the .dynamic section if
      we are doing one.  */
-  if (! link_info.relocatable)
+  if (!bfd_link_relocatable (&link_info))
     {
       hdyn->type = bfd_link_hash_defined;
       hdyn->u.def.value = 0;
@@ -889,7 +892,7 @@ gld${EMULATION_NAME}_count_need (lang_input_statement_type *inp)
     {
       ++need_entries;
       need_size += NEED_ENTRY_SIZE;
-      if (! inp->is_archive)
+      if (! inp->flags.maybe_archive)
        need_size += strlen (inp->filename) + 1;
       else
        {
@@ -917,7 +920,7 @@ gld${EMULATION_NAME}_set_need (lang_input_statement_type *inp)
         referential locality.  */
       bfd_put_32 (link_info.output_bfd, need_pnames - need_contents,
                  need_pinfo);
-      if (! inp->is_archive)
+      if (! inp->flags.maybe_archive)
        {
          bfd_put_32 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 4);
          bfd_put_16 (link_info.output_bfd, (bfd_vma) 0, need_pinfo + 8);
@@ -957,7 +960,7 @@ static char *
 gld${EMULATION_NAME}_get_script (int *isfile)
 EOF
 
-if test -n "$COMPILE_IN"
+if test x"$COMPILE_IN" = xyes
 then
 # Scripts compiled in.
 
@@ -968,11 +971,11 @@ fragment <<EOF
 {
   *isfile = 0;
 
-  if (link_info.relocatable && config.build_constructors)
+  if (bfd_link_relocatable (&link_info) && config.build_constructors)
     return
 EOF
 sed $sc ldscripts/${EMULATION_NAME}.xu                     >> e${EMULATION_NAME}.c
-echo '  ; else if (link_info.relocatable) return'         >> e${EMULATION_NAME}.c
+echo '  ; else if (bfd_link_relocatable (&link_info)) return' >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xr                     >> e${EMULATION_NAME}.c
 echo '  ; else if (!config.text_read_only) return'         >> e${EMULATION_NAME}.c
 sed $sc ldscripts/${EMULATION_NAME}.xbn                    >> e${EMULATION_NAME}.c
@@ -989,9 +992,9 @@ fragment <<EOF
 {
   *isfile = 1;
 
-  if (link_info.relocatable && config.build_constructors)
+  if (bfd_link_relocatable (&link_info) && config.build_constructors)
     return "ldscripts/${EMULATION_NAME}.xu";
-  else if (link_info.relocatable)
+  else if (bfd_link_relocatable (&link_info))
     return "ldscripts/${EMULATION_NAME}.xr";
   else if (!config.text_read_only)
     return "ldscripts/${EMULATION_NAME}.xbn";
@@ -1032,6 +1035,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
   NULL,        /* list options */
   NULL,        /* recognized file */
   NULL,        /* find_potential_libraries */
-  NULL /* new_vers_pattern */
+  NULL,        /* new_vers_pattern */
+  NULL /* extra_map_file_text */
 };
 EOF
This page took 0.032002 seconds and 4 git commands to generate.