MIPS/BFD: Factor out relocated field storing
Move code used to store the contents of a relocated field in output into a separate function, `mips_elf_store_contents', complementing existing `mips_elf_obtain_contents'. bfd/ * elfxx-mips.c (mips_elf_store_contents): New function... (mips_elf_perform_relocation): ... factored out from here.
This commit is contained in:
parent
6057dc97e4
commit
98e10ffadb
@ -1,3 +1,8 @@
|
|||||||
|
2018-09-14 Maciej W. Rozycki <macro@mips.com>
|
||||||
|
|
||||||
|
* elfxx-mips.c (mips_elf_store_contents): New function...
|
||||||
|
(mips_elf_perform_relocation): ... factored out from here.
|
||||||
|
|
||||||
2018-09-14 Lifang Xia <lifang_xia@c-sky.com>
|
2018-09-14 Lifang Xia <lifang_xia@c-sky.com>
|
||||||
|
|
||||||
* elf32-csky.c (csky_elf_howto_table): Fill special_function of
|
* elf32-csky.c (csky_elf_howto_table): Fill special_function of
|
||||||
|
@ -5234,6 +5234,21 @@ mips_elf_relocation_needs_la25_stub (bfd *input_bfd, int r_type,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Store the field relocated by RELOCATION. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
mips_elf_store_contents (reloc_howto_type *howto,
|
||||||
|
const Elf_Internal_Rela *relocation,
|
||||||
|
bfd *input_bfd, bfd_byte *contents, bfd_vma x)
|
||||||
|
{
|
||||||
|
bfd_byte *location = contents + relocation->r_offset;
|
||||||
|
unsigned int size = bfd_get_reloc_size (howto);
|
||||||
|
|
||||||
|
/* Put the value into the output. */
|
||||||
|
if (size != 0)
|
||||||
|
bfd_put (8 * size, input_bfd, x, location);
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate the value produced by the RELOCATION (which comes from
|
/* Calculate the value produced by the RELOCATION (which comes from
|
||||||
the INPUT_BFD). The ADDEND is the addend to use for this
|
the INPUT_BFD). The ADDEND is the addend to use for this
|
||||||
RELOCATION; RELOCATION->R_ADDEND is ignored.
|
RELOCATION; RELOCATION->R_ADDEND is ignored.
|
||||||
@ -6346,7 +6361,6 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
|
|||||||
bfd_vma x;
|
bfd_vma x;
|
||||||
bfd_byte *location;
|
bfd_byte *location;
|
||||||
int r_type = ELF_R_TYPE (input_bfd, relocation->r_info);
|
int r_type = ELF_R_TYPE (input_bfd, relocation->r_info);
|
||||||
unsigned int size;
|
|
||||||
|
|
||||||
/* Figure out where the relocation is occurring. */
|
/* Figure out where the relocation is occurring. */
|
||||||
location = contents + relocation->r_offset;
|
location = contents + relocation->r_offset;
|
||||||
@ -6505,9 +6519,7 @@ mips_elf_perform_relocation (struct bfd_link_info *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Put the value into the output. */
|
/* Put the value into the output. */
|
||||||
size = bfd_get_reloc_size (howto);
|
mips_elf_store_contents (howto, relocation, input_bfd, contents, x);
|
||||||
if (size != 0)
|
|
||||||
bfd_put (8 * size, input_bfd, x, location);
|
|
||||||
|
|
||||||
_bfd_mips_elf_reloc_shuffle (input_bfd, r_type, !bfd_link_relocatable (info),
|
_bfd_mips_elf_reloc_shuffle (input_bfd, r_type, !bfd_link_relocatable (info),
|
||||||
location);
|
location);
|
||||||
|
Loading…
Reference in New Issue
Block a user