* MAINTAINERS: Add Paul Brook and Mark Mitchell as ARM (Symbian)
[deliverable/binutils-gdb.git] / ld / emultempl / hppaelf.em
index c44b01a7b8aa729ce955978c06f999c16a122aa8..2b03fbe679b180655a43a7845518bbf98a118fc2 100644 (file)
@@ -1,5 +1,5 @@
 # This shell script emits a C file. -*- C -*-
-#   Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002
+#   Copyright 1991, 1993, 1994, 1997, 1999, 2000, 2001, 2002, 2003
 #   Free Software Foundation, Inc.
 #
 # This file is part of GLD, the Gnu Linker.
@@ -27,14 +27,6 @@ cat >>e${EMULATION_NAME}.c <<EOF
 #include "ldctor.h"
 #include "elf32-hppa.h"
 
-static void hppaelf_after_parse PARAMS((void));
-static void hppaelf_create_output_section_statements PARAMS ((void));
-static asection *hppaelf_add_stub_section
-  PARAMS ((const char *, asection *));
-static void hppaelf_layout_sections_again PARAMS ((void));
-static void gld${EMULATION_NAME}_finish PARAMS ((void));
-static void build_section_lists PARAMS ((lang_statement_union_type *));
-
 
 /* Fake input file for stubs.  */
 static lang_input_statement_type *stub_file;
@@ -56,24 +48,33 @@ static bfd_signed_vma group_size = 1;
    and adds millicode library to the list of input files.  */
 
 static void
-hppaelf_after_parse ()
+hppaelf_after_parse (void)
 {
-  if (link_info.relocateable)
+  if (link_info.relocatable)
     lang_add_unique (".text");
-#if 0 /* enable this once we split millicode stuff from libgcc */
-  else
-    lang_add_input_file ("milli",
-                        lang_input_file_is_l_enum,
-                        NULL);
-#endif
+
+  /* Enable this once we split millicode stuff from libgcc:
+     lang_add_input_file ("milli",
+                         lang_input_file_is_l_enum,
+                         NULL);
+  */
 }
 
 /* This is called before the input files are opened.  We create a new
    fake input file to hold the stub sections.  */
 
 static void
-hppaelf_create_output_section_statements ()
+hppaelf_create_output_section_statements (void)
 {
+  extern const bfd_target bfd_elf32_hppa_linux_vec;
+  extern const bfd_target bfd_elf32_hppa_nbsd_vec;
+  extern const bfd_target bfd_elf32_hppa_vec;
+
+  if (link_info.hash->creator != &bfd_elf32_hppa_linux_vec
+      && link_info.hash->creator != &bfd_elf32_hppa_nbsd_vec
+      && link_info.hash->creator != &bfd_elf32_hppa_vec)
+    return;
+
   stub_file = lang_add_input_file ("linker stubs",
                                   lang_input_file_is_fake_enum,
                                   NULL);
@@ -99,13 +100,8 @@ struct hook_stub_info
 
 /* Traverse the linker tree to find the spot where the stub goes.  */
 
-static bfd_boolean hook_in_stub
-  PARAMS ((struct hook_stub_info *, lang_statement_union_type **));
-
 static bfd_boolean
-hook_in_stub (info, lp)
-     struct hook_stub_info *info;
-     lang_statement_union_type **lp;
+hook_in_stub (struct hook_stub_info *info, lang_statement_union_type **lp)
 {
   lang_statement_union_type *l;
   bfd_boolean ret;
@@ -177,9 +173,7 @@ hook_in_stub (info, lp)
    immediately before INPUT_SECTION.  */
 
 static asection *
-hppaelf_add_stub_section (stub_sec_name, input_section)
-     const char *stub_sec_name;
-     asection *input_section;
+hppaelf_add_stub_section (const char *stub_sec_name, asection *input_section)
 {
   asection *stub_sec;
   flagword flags;
@@ -220,7 +214,7 @@ hppaelf_add_stub_section (stub_sec_name, input_section)
 /* Another call-back for elf32_hppa_size_stubs.  */
 
 static void
-hppaelf_layout_sections_again ()
+hppaelf_layout_sections_again (void)
 {
   /* If we have changed sizes of the stub sections, then we need
      to recalculate all the section offsets.  This may mean we need to
@@ -231,7 +225,7 @@ hppaelf_layout_sections_again ()
 
   /* Resize the sections.  */
   lang_size_sections (stat_ptr->head, abs_output_section,
-                     &stat_ptr->head, 0, (bfd_vma) 0, NULL);
+                     &stat_ptr->head, 0, (bfd_vma) 0, NULL, TRUE);
 
   /* Redo special stuff.  */
   ldemul_after_allocation ();
@@ -243,11 +237,11 @@ hppaelf_layout_sections_again ()
 
 
 static void
-build_section_lists (statement)
-     lang_statement_union_type *statement;
+build_section_lists (lang_statement_union_type *statement)
 {
   if (statement->header.type == lang_input_section_enum
       && !statement->input_section.ifile->just_syms_flag
+      && (statement->input_section.section->flags & SEC_EXCLUDE) == 0
       && statement->input_section.section->output_section != NULL
       && statement->input_section.section->output_section->owner == output_bfd)
     {
@@ -261,18 +255,18 @@ build_section_lists (statement)
    to build linker stubs.  */
 
 static void
-gld${EMULATION_NAME}_finish ()
+gld${EMULATION_NAME}_finish (void)
 {
-  /* bfd_elf32_discard_info just plays with debugging sections,
+  /* bfd_elf_discard_info just plays with debugging sections,
      ie. doesn't affect any code, so we can delay resizing the
      sections.  It's likely we'll resize everything in the process of
      adding stubs.  */
-  if (bfd_elf${ELFSIZE}_discard_info (output_bfd, &link_info))
+  if (bfd_elf_discard_info (output_bfd, &link_info))
     need_laying_out = 1;
 
   /* If generating a relocatable output file, then we don't
      have to examine the relocs.  */
-  if (! link_info.relocateable)
+  if (stub_file != NULL && !link_info.relocatable)
     {
       int ret = elf32_hppa_setup_section_lists (output_bfd, &link_info);
 
@@ -304,7 +298,7 @@ gld${EMULATION_NAME}_finish ()
   if (need_laying_out)
     hppaelf_layout_sections_again ();
 
-  if (! link_info.relocateable)
+  if (! link_info.relocatable)
     {
       /* Set the global data pointer.  */
       if (! elf32_hppa_set_gp (output_bfd, &link_info))
@@ -314,7 +308,7 @@ gld${EMULATION_NAME}_finish ()
        }
 
       /* Now build the linker stubs.  */
-      if (stub_file->the_bfd->sections != NULL)
+      if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
        {
          if (! elf32_hppa_build_stubs (&link_info))
            einfo ("%X%P: can not build stubs: %E\n");
@@ -326,23 +320,16 @@ gld${EMULATION_NAME}_finish ()
 /* Avoid processing the fake stub_file in vercheck, stat_needed and
    check_needed routines.  */
 
-static void hppa_for_each_input_file_wrapper
-  PARAMS ((lang_input_statement_type *));
-static void hppa_lang_for_each_input_file
-  PARAMS ((void (*) (lang_input_statement_type *)));
-
-static void (*real_func) PARAMS ((lang_input_statement_type *));
+static void (*real_func) (lang_input_statement_type *);
 
-static void hppa_for_each_input_file_wrapper (l)
-     lang_input_statement_type *l;
+static void hppa_for_each_input_file_wrapper (lang_input_statement_type *l)
 {
   if (l != stub_file)
     (*real_func) (l);
 }
 
 static void
-hppa_lang_for_each_input_file (func)
-     void (*func) PARAMS ((lang_input_statement_type *));
+hppa_lang_for_each_input_file (void (*func) (lang_input_statement_type *))
 {
   real_func = func;
   lang_for_each_input_file (&hppa_for_each_input_file_wrapper);
@@ -360,12 +347,8 @@ PARSE_AND_LIST_PROLOGUE='
 #define OPTION_STUBGROUP_SIZE          (OPTION_MULTI_SUBSPACE + 1)
 '
 
-# The options are repeated below so that no abbreviations are allowed.
-# Otherwise -s matches stub-group-size
 PARSE_AND_LIST_LONGOPTS='
   { "multi-subspace", no_argument, NULL, OPTION_MULTI_SUBSPACE },
-  { "multi-subspace", no_argument, NULL, OPTION_MULTI_SUBSPACE },
-  { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
   { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
 '
 
This page took 0.026844 seconds and 4 git commands to generate.