From 6a587c4aae49f0831ff5523efdbf457fdf4afa39 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 14 Oct 1997 06:12:50 +0000 Subject: [PATCH] * elf64-alpha.c (elf64_alpha_calc_dynrel_sizes): Allow for RELATIVE relocs for symbols in shlibs that have been forced local. (elf64_alpha_relocate_section): Output RELATIVEs in .got for same. --- bfd/ChangeLog | 8 +++++++- bfd/elf64-alpha.c | 28 ++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e2259867ac..16ec19bfea 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,6 +1,12 @@ +Mon Oct 13 23:10:08 1997 Richard Henderson + + * elf64-alpha.c (elf64_alpha_calc_dynrel_sizes): Allow for RELATIVE + relocs for symbols in shlibs that have been forced local. + (elf64_alpha_relocate_section): Output RELATIVEs in .got for same. + Mon Oct 13 21:24:04 1997 Richard Henderson - * bfd/elf64-alpha.c (elf64_alpha_relocate_section): Use the + * elf64-alpha.c (elf64_alpha_relocate_section): Use the got_enties of the default symbol for the default versioned symbol. Patch from hjl@gnu.ai.mit.edu, modified not to use alloca in the loop. diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index 3de8dca8d7..cb8a5b815f 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -2308,8 +2308,10 @@ elf64_alpha_calc_dynrel_sizes (h, info) } /* If the symbol is dynamic, we'll need all the relocations in their - natural form. */ - if (alpha_elf_dynamic_symbol_p (&h->root, info)) + natural form. If it has been forced local, we'll need the same + number of RELATIVE relocations. */ + if (alpha_elf_dynamic_symbol_p (&h->root, info) + || (info->shared && h->root.dynindx == -1)) { struct alpha_elf_reloc_entry *relent; @@ -2808,8 +2810,26 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section, bfd_put_64 (output_bfd, relocation+addend, sgot->contents + gotent->got_offset); - /* The dynamic relocations for the .got entries are - done in finish_dynamic_symbol. */ + /* If the symbol has been forced local, output a + RELATIVE reloc, otherwise it will be handled in + finish_dynamic_symbol. */ + if (info->shared && h->root.dynindx == -1) + { + Elf_Internal_Rela outrel; + + BFD_ASSERT(srelgot != NULL); + + outrel.r_offset = (sgot->output_section->vma + + sgot->output_offset + + gotent->got_offset); + outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE); + outrel.r_addend = 0; + + bfd_elf64_swap_reloca_out (output_bfd, &outrel, + ((Elf64_External_Rela *) + srelgot->contents) + + srelgot->reloc_count++); + } gotent->flags |= ALPHA_ELF_GOT_ENTRY_RELOCS_DONE; }