bfd/
[deliverable/binutils-gdb.git] / ld / emultempl / ppc64elf.em
index 1518dac15fd6f51f248cc91f47fe3ff248abcafc..a11f300cea350d7258cb9737ea5a8fb5dcdbebe3 100644 (file)
@@ -1,5 +1,5 @@
 # This shell script emits a C file. -*- C -*-
-# Copyright 2002, 2003, 2004, 2005, 2007, 2008
+# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 # Free Software Foundation, Inc.
 #
 # This file is part of the GNU Binutils.
@@ -47,6 +47,7 @@ static int dotsyms = 1;
 
 /* Whether to run tls optimization.  */
 static int no_tls_opt = 0;
+static int no_tls_get_addr_opt = 0;
 
 /* Whether to run opd optimization.  */
 static int no_opd_opt = 0;
@@ -58,7 +59,7 @@ static int no_toc_opt = 0;
 static int no_multi_toc = 0;
 
 /* Whether to emit symbols for stubs.  */
-static int emit_stub_syms = 0;
+static int emit_stub_syms = -1;
 
 static asection *toc_section = 0;
 
@@ -106,7 +107,8 @@ ppc_before_allocation (void)
                                  non_overlapping_opd))
        einfo ("%X%P: can not edit %s %E\n", "opd");
 
-      if (ppc64_elf_tls_setup (link_info.output_bfd, &link_info)
+      if (ppc64_elf_tls_setup (link_info.output_bfd, &link_info,
+                              no_tls_get_addr_opt)
          && !no_tls_opt)
        {
          /* Size the sections.  This is premature, but we want to know the
@@ -277,7 +279,10 @@ build_toc_list (lang_statement_union_type *statement)
       if (!((lang_input_statement_type *) i->owner->usrdata)->just_syms_flag
          && (i->flags & SEC_EXCLUDE) == 0
          && i->output_section == toc_section)
-       ppc64_elf_next_toc_section (&link_info, i);
+       {
+         if (!ppc64_elf_next_toc_section (&link_info, i))
+           einfo ("%X%P: linker script separates .got and .toc\n");
+       }
     }
 }
 
@@ -317,27 +322,34 @@ gld${EMULATION_NAME}_after_allocation (void)
      stubs.  */
   if (stub_file != NULL && !link_info.relocatable)
     {
-      int ret = ppc64_elf_setup_section_lists (link_info.output_bfd,
-                                              &link_info,
-                                              no_multi_toc);
+      int ret = ppc64_elf_setup_section_lists (&link_info,
+                                              &ppc_add_stub_section,
+                                              &ppc_layout_sections_again);
       if (ret < 0)
        einfo ("%X%P: can not size stub section: %E\n");
       else if (ret > 0)
        {
-         toc_section = bfd_get_section_by_name (link_info.output_bfd, ".got");
-         if (toc_section != NULL)
+         ppc64_elf_start_multitoc_partition (&link_info);
+
+         if (!no_multi_toc)
+           {
+             toc_section = bfd_get_section_by_name (link_info.output_bfd,
+                                                    ".got");
+             if (toc_section != NULL)
+               lang_for_each_statement (build_toc_list);
+           }
+
+         if (ppc64_elf_layout_multitoc (&link_info)
+             && !no_multi_toc
+             && toc_section != NULL)
            lang_for_each_statement (build_toc_list);
 
-         ppc64_elf_reinit_toc (link_info.output_bfd, &link_info);
+         ppc64_elf_finish_multitoc_partition (&link_info);
 
          lang_for_each_statement (build_section_lists);
 
          /* Call into the BFD backend to do the real work.  */
-         if (!ppc64_elf_size_stubs (link_info.output_bfd,
-                                    &link_info,
-                                    group_size,
-                                    &ppc_add_stub_section,
-                                    &ppc_layout_sections_again))
+         if (!ppc64_elf_size_stubs (&link_info, group_size))
            einfo ("%X%P: can not size stub section: %E\n");
        }
     }
@@ -376,7 +388,8 @@ gld${EMULATION_NAME}_finish (void)
       char *msg = NULL;
       char *line, *endline;
 
-      emit_stub_syms |= link_info.emitrelocations;
+      if (emit_stub_syms < 0)
+       emit_stub_syms = 1;
       if (!ppc64_elf_build_stubs (emit_stub_syms, &link_info,
                                  config.stats ? &msg : NULL))
        einfo ("%X%P: can not build stubs: %E\n");
@@ -485,10 +498,12 @@ fi
 PARSE_AND_LIST_PROLOGUE='
 #define OPTION_STUBGROUP_SIZE          301
 #define OPTION_STUBSYMS                        (OPTION_STUBGROUP_SIZE + 1)
-#define OPTION_DOTSYMS                 (OPTION_STUBSYMS + 1)
+#define OPTION_NO_STUBSYMS             (OPTION_STUBSYMS + 1)
+#define OPTION_DOTSYMS                 (OPTION_NO_STUBSYMS + 1)
 #define OPTION_NO_DOTSYMS              (OPTION_DOTSYMS + 1)
 #define OPTION_NO_TLS_OPT              (OPTION_NO_DOTSYMS + 1)
-#define OPTION_NO_OPD_OPT              (OPTION_NO_TLS_OPT + 1)
+#define OPTION_NO_TLS_GET_ADDR_OPT     (OPTION_NO_TLS_OPT + 1)
+#define OPTION_NO_OPD_OPT              (OPTION_NO_TLS_GET_ADDR_OPT + 1)
 #define OPTION_NO_TOC_OPT              (OPTION_NO_OPD_OPT + 1)
 #define OPTION_NO_MULTI_TOC            (OPTION_NO_TOC_OPT + 1)
 #define OPTION_NON_OVERLAPPING_OPD     (OPTION_NO_MULTI_TOC + 1)
@@ -497,9 +512,11 @@ PARSE_AND_LIST_PROLOGUE='
 PARSE_AND_LIST_LONGOPTS='
   { "stub-group-size", required_argument, NULL, OPTION_STUBGROUP_SIZE },
   { "emit-stub-syms", no_argument, NULL, OPTION_STUBSYMS },
+  { "no-emit-stub-syms", no_argument, NULL, OPTION_NO_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 },
+  { "no-tls-get-addr-optimize", no_argument, NULL, OPTION_NO_TLS_GET_ADDR_OPT },
   { "no-opd-optimize", no_argument, NULL, OPTION_NO_OPD_OPT },
   { "no-toc-optimize", no_argument, NULL, OPTION_NO_TOC_OPT },
   { "no-multi-toc", no_argument, NULL, OPTION_NO_MULTI_TOC },
@@ -521,6 +538,9 @@ PARSE_AND_LIST_OPTIONS='
   --emit-stub-syms            Label linker stubs with a symbol.\n"
                   ));
   fprintf (file, _("\
+  --no-emit-stub-syms         Don'\''t label linker stubs with a symbol.\n"
+                  ));
+  fprintf (file, _("\
   --dotsyms                   For every version pattern \"foo\" in a version\n\
                                 script, add \".foo\" so that function code\n\
                                 symbols are treated the same as function\n\
@@ -533,6 +553,9 @@ PARSE_AND_LIST_OPTIONS='
   --no-tls-optimize           Don'\''t try to optimize TLS accesses.\n"
                   ));
   fprintf (file, _("\
+  --no-tls-get-addr-optimize  Don'\''t use a special __tls_get_addr call.\n"
+                  ));
+  fprintf (file, _("\
   --no-opd-optimize           Don'\''t optimize the OPD section.\n"
                   ));
   fprintf (file, _("\
@@ -561,6 +584,10 @@ PARSE_AND_LIST_ARGS_CASES='
       emit_stub_syms = 1;
       break;
 
+    case OPTION_NO_STUBSYMS:
+      emit_stub_syms = 0;
+      break;
+
     case OPTION_DOTSYMS:
       dotsyms = 1;
       break;
@@ -573,6 +600,10 @@ PARSE_AND_LIST_ARGS_CASES='
       no_tls_opt = 1;
       break;
 
+    case OPTION_NO_TLS_GET_ADDR_OPT:
+      no_tls_get_addr_opt = 1;
+      break;
+
     case OPTION_NO_OPD_OPT:
       no_opd_opt = 1;
       break;
This page took 0.025232 seconds and 4 git commands to generate.