From: Daniel Jacobowitz Date: Wed, 6 Nov 2002 04:32:04 +0000 (+0000) Subject: * elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of X-Git-Tag: binutils-2_13_1~10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4207593d5f801371c7947e1064d01d857bbfa1b3;p=thirdparty%2Fbinutils-gdb.git * elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of dynamic relocs against section symbols for the output section vma. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 37652df3ce8..1e98cf5fb8b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2002-11-06 David O'Brien + Alan Modra + + * elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of + dynamic relocs against section symbols for the output section vma. + 2002-10-31 David O'Brien * elf-eh-frame.c (_bfd_elf_discard_section_eh_frame): Don't mix diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 920b481bf80..1ca03dcb854 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -2181,11 +2181,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, } else { + outrel.r_addend = relocation + rel->r_addend; if (r_type == R_SPARC_64) - { - outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE); - outrel.r_addend = relocation + rel->r_addend; - } + outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE); else { long indx; @@ -2215,6 +2213,13 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, osec = sec->output_section; indx = elf_section_data (osec)->dynindx; + /* We are turning this relocation into one + against a section symbol, so subtract out + the output section's address but not the + offset of the input section in the output + section. */ + outrel.r_addend -= osec->vma; + /* FIXME: we really should be able to link non-pic shared libraries. */ if (indx == 0) @@ -2233,7 +2238,6 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section, ELF64_R_TYPE_INFO ( ELF64_R_TYPE_DATA (rel->r_info), r_type)); - outrel.r_addend = relocation + rel->r_addend; } }