* elfxx-mips.c (mips_elf_create_dynamic_relocation): Return early

for discard relocations; don't add an R_MIPS_NONE to the main body
	of .rel.dyn.
This commit is contained in:
Richard Sandiford
2004-11-16 09:54:10 +00:00
parent 1d72487d99
commit 5d41f0b6e5
2 changed files with 95 additions and 99 deletions

@ -1,3 +1,9 @@
2004-11-16 Richard Sandiford <rsandifo@redhat.com>
* elfxx-mips.c (mips_elf_create_dynamic_relocation): Return early
for discard relocations; don't add an R_MIPS_NONE to the main body
of .rel.dyn.
2004-11-04 Paul Brook <paul@codesourcery.com> 2004-11-04 Paul Brook <paul@codesourcery.com>
* elf-bfd.h (_bfd_elf_slurp_version_tables): Update prototype. * elf-bfd.h (_bfd_elf_slurp_version_tables): Update prototype.

@ -3783,10 +3783,11 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
bfd_vma *addendp, asection *input_section) bfd_vma *addendp, asection *input_section)
{ {
Elf_Internal_Rela outrel[3]; Elf_Internal_Rela outrel[3];
bfd_boolean skip;
asection *sreloc; asection *sreloc;
bfd *dynobj; bfd *dynobj;
int r_type; int r_type;
long indx;
bfd_boolean defined_p;
r_type = ELF_R_TYPE (output_bfd, rel->r_info); r_type = ELF_R_TYPE (output_bfd, rel->r_info);
dynobj = elf_hash_table (info)->dynobj; dynobj = elf_hash_table (info)->dynobj;
@ -3796,7 +3797,6 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd) BFD_ASSERT (sreloc->reloc_count * MIPS_ELF_REL_SIZE (output_bfd)
< sreloc->size); < sreloc->size);
skip = FALSE;
outrel[0].r_offset = outrel[0].r_offset =
_bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset); _bfd_elf_section_offset (output_bfd, info, input_section, rel[0].r_offset);
outrel[1].r_offset = outrel[1].r_offset =
@ -3830,26 +3830,17 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
if (outrel[0].r_offset == MINUS_ONE) if (outrel[0].r_offset == MINUS_ONE)
/* The relocation field has been deleted. */ /* The relocation field has been deleted. */
skip = TRUE; return TRUE;
else if (outrel[0].r_offset == MINUS_TWO)
if (outrel[0].r_offset == MINUS_TWO)
{ {
/* The relocation field has been converted into a relative value of /* The relocation field has been converted into a relative value of
some sort. Functions like _bfd_elf_write_section_eh_frame expect some sort. Functions like _bfd_elf_write_section_eh_frame expect
the field to be fully relocated, so add in the symbol's value. */ the field to be fully relocated, so add in the symbol's value. */
skip = TRUE;
*addendp += symbol; *addendp += symbol;
return TRUE;
} }
/* If we've decided to skip this relocation, just output an empty
record. Note that R_MIPS_NONE == 0, so that this call to memset
is a way of setting R_TYPE to R_MIPS_NONE. */
if (skip)
memset (outrel, 0, sizeof (Elf_Internal_Rela) * 3);
else
{
long indx;
bfd_boolean defined_p;
/* We must now calculate the dynamic symbol table index to use /* We must now calculate the dynamic symbol table index to use
in the relocation. */ in the relocation. */
if (h != NULL if (h != NULL
@ -3941,7 +3932,6 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
+ input_section->output_offset); + input_section->output_offset);
outrel[2].r_offset += (input_section->output_section->vma outrel[2].r_offset += (input_section->output_section->vma
+ input_section->output_offset); + input_section->output_offset);
}
/* Put the relocation back out. We have to use the special /* Put the relocation back out. We have to use the special
relocation outputter in the 64-bit case since the 64-bit relocation outputter in the 64-bit case since the 64-bit
@ -3967,7 +3957,7 @@ mips_elf_create_dynamic_relocation (bfd *output_bfd,
|= SHF_WRITE; |= SHF_WRITE;
/* On IRIX5, make an entry of compact relocation info. */ /* On IRIX5, make an entry of compact relocation info. */
if (! skip && IRIX_COMPAT (output_bfd) == ict_irix5) if (IRIX_COMPAT (output_bfd) == ict_irix5)
{ {
asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel"); asection *scpt = bfd_get_section_by_name (dynobj, ".compact_rel");
bfd_byte *cr; bfd_byte *cr;