* elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE

addend into r_addend, not *r_offset.
	(elf32_sparc_finish_dynamic_symbol): Likewise.
	* elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at
	R_SPARC_RELATIVE's r_offset.
This commit is contained in:
Jakub Jelinek 2002-09-24 15:54:22 +00:00
parent 109987229e
commit 6b3ac70943
3 changed files with 23 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2002-09-24 Jakub Jelinek <jakub@redhat.com>
* elf32-sparc.c (elf32_sparc_relocate_section): Put R_SPARC_RELATIVE
addend into r_addend, not *r_offset.
(elf32_sparc_finish_dynamic_symbol): Likewise.
* elf64-sparc.c (sparc64_elf_finish_dynamic_symbol): Clear xword at
R_SPARC_RELATIVE's r_offset.
2002-09-23 Nathan Tallent <eraxxon@alumni.rice.edu> 2002-09-23 Nathan Tallent <eraxxon@alumni.rice.edu>
* dwarf2.c (decode_line_info): Update to correctly decode * dwarf2.c (decode_line_info): Update to correctly decode

View file

@ -1281,7 +1281,6 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
off &= ~1; off &= ~1;
else else
{ {
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
if (info->shared) if (info->shared)
{ {
@ -1297,7 +1296,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
+ sgot->output_offset + sgot->output_offset
+ off); + off);
outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); outrel.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
outrel.r_addend = 0; outrel.r_addend = relocation;
relocation = 0;
bfd_elf32_swap_reloca_out (output_bfd, &outrel, bfd_elf32_swap_reloca_out (output_bfd, &outrel,
(((Elf32_External_Rela *) (((Elf32_External_Rela *)
srelgot->contents) srelgot->contents)
@ -1305,6 +1305,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
++srelgot->reloc_count; ++srelgot->reloc_count;
} }
bfd_put_32 (output_bfd, relocation, sgot->contents + off);
local_got_offsets[r_symndx] |= 1; local_got_offsets[r_symndx] |= 1;
} }
} }
@ -1810,14 +1811,21 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
if (info->shared if (info->shared
&& (info->symbolic || h->dynindx == -1) && (info->symbolic || h->dynindx == -1)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE); {
asection *sec = h->root.u.def.section;
rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
rela.r_addend = (h->root.u.def.value
+ sec->output_section->vma
+ sec->output_offset);
}
else else
{ {
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
rela.r_addend = 0;
} }
rela.r_addend = 0; bfd_put_32 (output_bfd, (bfd_vma) 0,
sgot->contents + (h->got.offset &~ (bfd_vma) 1));
bfd_elf32_swap_reloca_out (output_bfd, &rela, bfd_elf32_swap_reloca_out (output_bfd, &rela,
((Elf32_External_Rela *) srela->contents ((Elf32_External_Rela *) srela->contents
+ srela->reloc_count)); + srela->reloc_count));

View file

@ -2727,11 +2727,12 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
} }
else else
{ {
bfd_put_64 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT); rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
rela.r_addend = 0; rela.r_addend = 0;
} }
bfd_put_64 (output_bfd, (bfd_vma) 0,
sgot->contents + (h->got.offset &~ (bfd_vma) 1));
bfd_elf64_swap_reloca_out (output_bfd, &rela, bfd_elf64_swap_reloca_out (output_bfd, &rela,
((Elf64_External_Rela *) srela->contents ((Elf64_External_Rela *) srela->contents
+ srela->reloc_count)); + srela->reloc_count));