From: Alan Modra Date: Sun, 8 Jun 2003 14:07:34 +0000 (+0000) Subject: * emultempl/ppc64elf.em (emit_stub_syms, toc_section): New vars. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0b9a4d73a80fc35f12f3e081adf52f293947c3f0;p=binutils-gdb.git * 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. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index b89e09f53ef..5d3dbcd3344 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2003-06-08 Alan Modra + + * 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 * emultempl/elf32.em (gld${EMULATION_NAME}_list_options): Remove diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index 9f688a3d06a..dd6d675390d 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -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;