aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-sparc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-11-05 22:59:23 +0000
committerAlan Modra <amodra@gmail.com>2002-11-05 22:59:23 +0000
commitdad628168eb07eb97715c9cabd03222035535c6b (patch)
treec5d6098d40336283fa4f2cb5bbc4fd30f28f3d26 /bfd/elf64-sparc.c
parent7d5b6fdd3bcba79509e2d2dcc04f49a85534670b (diff)
downloadgdb-dad628168eb07eb97715c9cabd03222035535c6b.zip
gdb-dad628168eb07eb97715c9cabd03222035535c6b.tar.gz
gdb-dad628168eb07eb97715c9cabd03222035535c6b.tar.bz2
* elf64-sparc.c (sparc64_elf_relocate_section): Adjust addend of
dynamic relocs against section symbols for the output section vma.
Diffstat (limited to 'bfd/elf64-sparc.c')
-rw-r--r--bfd/elf64-sparc.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index f79d76c..e3a120b 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -2164,11 +2164,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;
@@ -2198,6 +2196,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)
@@ -2216,7 +2221,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;
}
}