* emultempl/ppc64elf.em (emit_stub_syms, toc_section): New vars.
authorAlan Modra <amodra@gmail.com>
Sun, 8 Jun 2003 14:07:34 +0000 (14:07 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 8 Jun 2003 14:07:34 +0000 (14:07 +0000)
(build_toc_list): New function.
(gld${EMULATION_NAME}_finish): Call build_toc_list and
ppc64_elf_reinit_toc.  Adjust ppc64_elf_build_stubs call.
(OPTION_STUBSYMS): Define.
(PARSE_AND_LIST_LONGOPTS): Add emit-stub-syms.
(PARSE_AND_LIST_OPTIONS): Document.
(PARSE_AND_LIST_ARGS_CASES): Handle.

ld/ChangeLog
ld/emultempl/ppc64elf.em

index b89e09f53effab6a66125ec2a38e150c54410ee5..5d3dbcd3344ddc4349ac6799ac983461ad035386 100644 (file)
@@ -1,3 +1,14 @@
+2003-06-08  Alan Modra  <amodra@bigpond.net.au>
+
+       * emultempl/ppc64elf.em (emit_stub_syms, toc_section): New vars.
+       (build_toc_list): New function.
+       (gld${EMULATION_NAME}_finish): Call build_toc_list and
+       ppc64_elf_reinit_toc.  Adjust ppc64_elf_build_stubs call.
+       (OPTION_STUBSYMS): Define.
+       (PARSE_AND_LIST_LONGOPTS): Add emit-stub-syms.
+       (PARSE_AND_LIST_OPTIONS): Document.
+       (PARSE_AND_LIST_ARGS_CASES): Handle.
+
 2003-06-05  Roland McGrath  <roland@redhat.com>
 
        * emultempl/elf32.em (gld${EMULATION_NAME}_list_options): Remove
index 9f688a3d06ad6231290d5515e02e19a3de76144d..dd6d675390d125adbab6c221b87dbb6c8e3fe6f4 100644 (file)
@@ -44,6 +44,11 @@ static int dotsyms = 1;
 /* Whether to run tls optimization.  */
 static int notlsopt = 0;
 
+/* Whether to emit symbols for stubs.  */
+static int emit_stub_syms = 0;
+
+static asection *toc_section = 0;
+
 static void ppc_create_output_section_statements
   PARAMS ((void));
 static void ppc_after_open
@@ -56,6 +61,8 @@ static void ppc_layout_sections_again
   PARAMS ((void));
 static void gld${EMULATION_NAME}_after_allocation
   PARAMS ((void));
+static void build_toc_list
+  PARAMS ((lang_statement_union_type *));
 static void build_section_lists
   PARAMS ((lang_statement_union_type *));
 static struct bfd_elf_version_expr *gld${EMULATION_NAME}_new_vers_pattern
@@ -294,6 +301,19 @@ gld${EMULATION_NAME}_after_allocation ()
 }
 
 
+static void
+build_toc_list (statement)
+     lang_statement_union_type *statement;
+{
+  if (statement->header.type == lang_input_section_enum
+      && !statement->input_section.ifile->just_syms_flag
+      && statement->input_section.section->output_section == toc_section)
+    {
+      ppc64_elf_next_toc_section (&link_info, statement->input_section.section);
+    }
+}
+
+
 static void
 build_section_lists (statement)
      lang_statement_union_type *statement;
@@ -339,6 +359,12 @@ gld${EMULATION_NAME}_finish ()
              return;
            }
 
+         toc_section = bfd_get_section_by_name (output_bfd, ".toc");
+         if (toc_section != NULL)
+           lang_for_each_statement (build_toc_list);
+
+         ppc64_elf_reinit_toc (output_bfd, &link_info);
+
          lang_for_each_statement (build_section_lists);
 
          /* Call into the BFD backend to do the real work.  */
@@ -360,7 +386,7 @@ gld${EMULATION_NAME}_finish ()
 
   if (stub_file != NULL && stub_file->the_bfd->sections != NULL)
     {
-      if (!ppc64_elf_build_stubs (&link_info))
+      if (!ppc64_elf_build_stubs (emit_stub_syms, &link_info))
        einfo ("%X%P: can not build stubs: %E\n");
     }
 }
@@ -471,13 +497,15 @@ EOF
 #
 PARSE_AND_LIST_PROLOGUE='
 #define OPTION_STUBGROUP_SIZE          301
-#define OPTION_DOTSYMS                 (OPTION_STUBGROUP_SIZE + 1)
+#define OPTION_STUBSYMS                        (OPTION_STUBGROUP_SIZE + 1)
+#define OPTION_DOTSYMS                 (OPTION_STUBSYMS + 1)
 #define OPTION_NO_DOTSYMS              (OPTION_DOTSYMS + 1)
 #define OPTION_NO_TLS_OPT              (OPTION_NO_DOTSYMS + 1)
 '
 
 PARSE_AND_LIST_LONGOPTS='
   { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
+  { "emit-stub-syms", no_argument, NULL, OPTION_STUBSYMS },
   { "dotsyms", no_argument, NULL, OPTION_DOTSYMS },
   { "no-dotsyms", no_argument, NULL, OPTION_NO_DOTSYMS },
   { "no-tls-optimize", no_argument, NULL, OPTION_NO_TLS_OPT },
@@ -494,6 +522,9 @@ PARSE_AND_LIST_OPTIONS='
                           the linker should choose suitable defaults.\n"
                   ));
   fprintf (file, _("\
+  --emit-stub-syms      Label linker stubs with a symbol.\n"
+                  ));
+  fprintf (file, _("\
   --dotsyms             For every version pattern \"foo\" in a version script,\n\
                           add \".foo\" so that function code symbols are\n\
                           treated the same as function descriptor symbols.\n\
@@ -517,6 +548,10 @@ PARSE_AND_LIST_ARGS_CASES='
       }
       break;
 
+    case OPTION_STUBSYMS:
+      emit_stub_syms = 1;
+      break;
+
     case OPTION_DOTSYMS:
       dotsyms = 1;
       break;
This page took 0.030089 seconds and 4 git commands to generate.