From 68f8ff14d1fb0bd1254ca950188a8aadc8104de4 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 10 Jul 2003 00:38:19 +0000 Subject: [PATCH] * emulparams/elf64ppc.sh (OTHER_GOT_SECTIONS): Don't define. (GOT): Define. * emultempl/ppc64elf.em (stub_added): New static var. (ppc_create_output_section_statements): Call ppc64_elf_init_stub_bfd. (ppc_add_stub_section): Set stub_added. (gld${EMULATION_NAME}_finish): Look for .got rather than .toc. Adjust ppc64_elf_size_stubs call and test for stubs. * scripttempl/elf.sc (GOT): Define and use. --- ld/ChangeLog | 11 +++++++++++ ld/emulparams/elf64ppc.sh | 4 ++-- ld/emultempl/ppc64elf.em | 8 +++++--- ld/scripttempl/elf.sc | 3 ++- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index 7dc68c6835c..0a643fa958e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,14 @@ +2003-07-10 Alan Modra + + * emulparams/elf64ppc.sh (OTHER_GOT_SECTIONS): Don't define. + (GOT): Define. + * emultempl/ppc64elf.em (stub_added): New static var. + (ppc_create_output_section_statements): Call ppc64_elf_init_stub_bfd. + (ppc_add_stub_section): Set stub_added. + (gld${EMULATION_NAME}_finish): Look for .got rather than .toc. Adjust + ppc64_elf_size_stubs call and test for stubs. + * scripttempl/elf.sc (GOT): Define and use. + 2003-07-08 J"orn Rennecke * emultempl/sh64elf.em (sh64_elf_${EMULATION_NAME}_after_allocation): diff --git a/ld/emulparams/elf64ppc.sh b/ld/emulparams/elf64ppc.sh index 5f812f6c65b..e1d9e1d32f1 100644 --- a/ld/emulparams/elf64ppc.sh +++ b/ld/emulparams/elf64ppc.sh @@ -18,8 +18,8 @@ OTHER_BSS_SYMBOLS=" .tocbss ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.tocbss)}" OTHER_PLT_RELOC_SECTIONS=" .rela.tocbss ${RELOCATING-0} : { *(.rela.tocbss) }" -OTHER_GOT_SECTIONS=" - .toc ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.toc) }" +GOT=" + .got ${RELOCATING-0}${RELOCATING+ALIGN(8)} : { *(.got .toc) }" OTHER_GOT_RELOC_SECTIONS=" .rela.toc ${RELOCATING-0} : { *(.rela.toc) }" OTHER_READWRITE_SECTIONS=" diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em index dfe7932bc04..b1b3f9ef07a 100644 --- a/ld/emultempl/ppc64elf.em +++ b/ld/emultempl/ppc64elf.em @@ -29,6 +29,7 @@ cat >>e${EMULATION_NAME}.c <the_bfd, &link_info); } static void @@ -232,6 +234,7 @@ ppc_add_stub_section (const char *stub_sec_name, asection *input_section) if (info.add.head == NULL) goto err_ret; + stub_added = 1; if (hook_in_stub (&info, &os->children.head)) return stub_sec; @@ -330,7 +333,7 @@ gld${EMULATION_NAME}_finish (void) return; } - toc_section = bfd_get_section_by_name (output_bfd, ".toc"); + toc_section = bfd_get_section_by_name (output_bfd, ".got"); if (toc_section != NULL) lang_for_each_statement (build_toc_list); @@ -340,7 +343,6 @@ gld${EMULATION_NAME}_finish (void) /* Call into the BFD backend to do the real work. */ if (!ppc64_elf_size_stubs (output_bfd, - stub_file->the_bfd, &link_info, group_size, &ppc_add_stub_section, @@ -355,7 +357,7 @@ gld${EMULATION_NAME}_finish (void) if (need_laying_out) ppc_layout_sections_again (); - if (stub_file != NULL && stub_file->the_bfd->sections != NULL) + if (stub_added) { char *msg = NULL; char *line, *endline; diff --git a/ld/scripttempl/elf.sc b/ld/scripttempl/elf.sc index 0c1f5c62966..a63ef94a22e 100644 --- a/ld/scripttempl/elf.sc +++ b/ld/scripttempl/elf.sc @@ -82,6 +82,7 @@ if test -n "${COMMONPAGESIZE}"; then fi INTERP=".interp ${RELOCATING-0} : { *(.interp) }" PLT=".plt ${RELOCATING-0} : { *(.plt) }" +test -z "$GOT" && GOT=".got ${RELOCATING-0} : { *(.got.plt) *(.got) }" DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }" RODATA=".rodata ${RELOCATING-0} : { *(.rodata${RELOCATING+ .rodata.* .gnu.linkonce.r.*}) }" STACKNOTE="/DISCARD/ : { *(.note.GNU-stack) }" @@ -325,7 +326,7 @@ cat <