# 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.
/* 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;
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;
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
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");
+ }
}
}
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");
}
}
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");
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)
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 },
--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\
--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, _("\
emit_stub_syms = 1;
break;
+ case OPTION_NO_STUBSYMS:
+ emit_stub_syms = 0;
+ break;
+
case OPTION_DOTSYMS:
dotsyms = 1;
break;
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;