From c5614fa4606bc57532bebea972ce43bb434b6084 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 4 Nov 2004 11:55:13 +0000 Subject: bfd/ * elf64-ppc.h (ppc64_elf_edit_toc): Declare. * elf64-ppc.c (struct ppc_link_hash_entry ): Update comment. (struct adjust_toc_info): New. (adjust_toc_syms, ppc64_elf_edit_toc): New functions. ld/ * emultempl/ppc64elf.em (no_tls_opt): Rename from notlsopt. (no_opd_opt, no_toc_opt): New static vars. (ppc_before_allocation): Don't edit opt if no_opd_opt. Call ppc64_elf_edit_toc. (OPTION_NO_OPD_OPT, OPTION_NO_TOC_OPT): Define. (PARSE_AND_LIST_LONGOPTS): Add no-opd-optimize and no-toc-optimize. (PARSE_AND_LIST_OPTIONS): Describe new options. (PARSE_AND_LIST_ARGS_CASES): Handle them. --- ld/ChangeLog | 13 ++++++++++++- ld/emultempl/ppc64elf.em | 45 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 7 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index c88752f..cfaeacc 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,9 +1,20 @@ +2004-11-04 Alan Modra + + * emultempl/ppc64elf.em (no_tls_opt): Rename from notlsopt. + (no_opd_opt, no_toc_opt): New static vars. + (ppc_before_allocation): Don't edit opt if no_opd_opt. Call + ppc64_elf_edit_toc. + (OPTION_NO_OPD_OPT, OPTION_NO_TOC_OPT): Define. + (PARSE_AND_LIST_LONGOPTS): Add no-opd-optimize and no-toc-optimize. + (PARSE_AND_LIST_OPTIONS): Describe new options. + (PARSE_AND_LIST_ARGS_CASES): Handle them. + 2004-10-27 Nick Clifton * emultempl/alphaelf.em (alpha_after_parse): Add extra, NULL, parameter to invocation of lang_section_start. * emultempl/aix.em (_handle_option): Likewise. - + * Makefile.am (eelf64alpha.c, eelf64alpha_fbsd.c, eelf64alpha_nbsd.c): Add dependency upon emultempl/alphaelf.em. * Makefile.in: Regenerate. diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 8699a82..3713fd3 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -44,7 +44,13 @@ static bfd_signed_vma group_size = 1; static int dotsyms = 1; /* Whether to run tls optimization. */ -static int notlsopt = 0; +static int no_tls_opt = 0; + +/* Whether to run opd optimization. */ +static int no_opd_opt = 0; + +/* Whether to run toc optimization. */ +static int no_toc_opt = 0; /* Whether to emit symbols for stubs. */ static int emit_stub_syms = 0; @@ -92,13 +98,14 @@ ppc_before_allocation (void) { if (stub_file != NULL) { - if (!ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd)) + if (!no_opd_opt + && !ppc64_elf_edit_opd (output_bfd, &link_info, non_overlapping_opd)) { - einfo ("%X%P: can not edit opd %E\n"); + einfo ("%X%P: can not edit %s %E\n", "opd"); return; } - if (ppc64_elf_tls_setup (output_bfd, &link_info) && !notlsopt) + if (ppc64_elf_tls_setup (output_bfd, &link_info) && !no_tls_opt) { /* Size the sections. This is premature, but we want to know the TLS segment layout so that certain optimizations can be done. */ @@ -115,6 +122,14 @@ ppc_before_allocation (void) elf_tdata (output_bfd)->program_header_size = 0; lang_reset_memory_regions (); } + + if (!no_toc_opt + && !link_info.relocatable + && !ppc64_elf_edit_toc (output_bfd, &link_info)) + { + einfo ("%X%P: can not edit %s %E\n", "toc"); + return; + } } gld${EMULATION_NAME}_before_allocation (); @@ -467,7 +482,9 @@ PARSE_AND_LIST_PROLOGUE=' #define OPTION_DOTSYMS (OPTION_STUBSYMS + 1) #define OPTION_NO_DOTSYMS (OPTION_DOTSYMS + 1) #define OPTION_NO_TLS_OPT (OPTION_NO_DOTSYMS + 1) -#define OPTION_NON_OVERLAPPING_OPD (OPTION_NO_TLS_OPT + 1) +#define OPTION_NO_OPD_OPT (OPTION_NO_TLS_OPT + 1) +#define OPTION_NO_TOC_OPT (OPTION_NO_OPD_OPT + 1) +#define OPTION_NON_OVERLAPPING_OPD (OPTION_NO_TOC_OPT + 1) ' PARSE_AND_LIST_LONGOPTS=' @@ -476,6 +493,8 @@ PARSE_AND_LIST_LONGOPTS=' { "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-opd-optimize", no_argument, NULL, OPTION_NO_OPD_OPT }, + { "no-toc-optimize", no_argument, NULL, OPTION_NO_TOC_OPT }, { "non-overlapping-opd", no_argument, NULL, OPTION_NON_OVERLAPPING_OPD }, ' @@ -505,6 +524,12 @@ PARSE_AND_LIST_OPTIONS=' --no-tls-optimize Don'\''t try to optimize TLS accesses.\n" )); fprintf (file, _("\ + --no-opd-optimize Don'\''t optimize the OPD section.\n" + )); + fprintf (file, _("\ + --no-toc-optimize Don'\''t optimize the TOC section.\n" + )); + fprintf (file, _("\ --non-overlapping-opd Canonicalize .opd, so that there are no overlapping\n\ .opd entries.\n" )); @@ -533,7 +558,15 @@ PARSE_AND_LIST_ARGS_CASES=' break; case OPTION_NO_TLS_OPT: - notlsopt = 1; + no_tls_opt = 1; + break; + + case OPTION_NO_OPD_OPT: + no_opd_opt = 1; + break; + + case OPTION_NO_TOC_OPT: + no_toc_opt = 1; break; case OPTION_NON_OVERLAPPING_OPD: -- cgit v1.1