mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-07-27 11:53:21 +08:00
i386: Simplify VxWorks for non-PIC
Change if (PIC) { #1 } else { #2 if (VxWorks) { #3 } } #4 if (VxWorks && !PIC) { #5 } to #4 if (PIC) { #1 } else { #2 if (VxWorks) { #3 #5 } } * elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify VxWorks for non-PIC.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2017-04-27 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* elf32-i386.c (elf_i386_finish_dynamic_sections): Simplify
|
||||||
|
VxWorks for non-PIC.
|
||||||
|
|
||||||
2017-04-27 Alan Modra <amodra@gmail.com>
|
2017-04-27 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* elf-bfd.h (struct elf_backend_data): Make asection param of
|
* elf-bfd.h (struct elf_backend_data): Make asection param of
|
||||||
|
@ -5848,9 +5848,15 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
|
|||||||
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
|
bfd_elf32_swap_dyn_out (output_bfd, &dyn, dyncon);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill in the first entry in the procedure linkage table. */
|
|
||||||
if (htab->elf.splt && htab->elf.splt->size > 0)
|
if (htab->elf.splt && htab->elf.splt->size > 0)
|
||||||
{
|
{
|
||||||
|
/* UnixWare sets the entsize of .plt to 4, although that doesn't
|
||||||
|
really seem like the right value. */
|
||||||
|
elf_section_data (htab->elf.splt->output_section)
|
||||||
|
->this_hdr.sh_entsize = 4;
|
||||||
|
|
||||||
|
/* Fill in the special first entry in the procedure linkage
|
||||||
|
table. */
|
||||||
if (bfd_link_pic (info))
|
if (bfd_link_pic (info))
|
||||||
{
|
{
|
||||||
memcpy (htab->elf.splt->contents, abed->plt->pic_plt0_entry,
|
memcpy (htab->elf.splt->contents, abed->plt->pic_plt0_entry,
|
||||||
@ -5882,6 +5888,9 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
|
|||||||
if (abed->is_vxworks)
|
if (abed->is_vxworks)
|
||||||
{
|
{
|
||||||
Elf_Internal_Rela rel;
|
Elf_Internal_Rela rel;
|
||||||
|
int num_plts = (htab->elf.splt->size
|
||||||
|
/ abed->plt->plt_entry_size) - 1;
|
||||||
|
unsigned char *p;
|
||||||
|
|
||||||
/* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 4.
|
/* Generate a relocation for _GLOBAL_OFFSET_TABLE_ + 4.
|
||||||
On IA32 we use REL relocations so the addend goes in
|
On IA32 we use REL relocations so the addend goes in
|
||||||
@ -5900,39 +5909,28 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
|
|||||||
bfd_elf32_swap_reloc_out (output_bfd, &rel,
|
bfd_elf32_swap_reloc_out (output_bfd, &rel,
|
||||||
htab->srelplt2->contents +
|
htab->srelplt2->contents +
|
||||||
sizeof (Elf32_External_Rel));
|
sizeof (Elf32_External_Rel));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* UnixWare sets the entsize of .plt to 4, although that doesn't
|
/* Correct the .rel.plt.unloaded relocations. */
|
||||||
really seem like the right value. */
|
p = htab->srelplt2->contents;
|
||||||
elf_section_data (htab->elf.splt->output_section)
|
if (bfd_link_pic (info))
|
||||||
->this_hdr.sh_entsize = 4;
|
p += PLTRESOLVE_RELOCS_SHLIB * sizeof (Elf32_External_Rel);
|
||||||
|
else
|
||||||
|
p += PLTRESOLVE_RELOCS * sizeof (Elf32_External_Rel);
|
||||||
|
|
||||||
/* Correct the .rel.plt.unloaded relocations. */
|
for (; num_plts; num_plts--)
|
||||||
if (abed->is_vxworks && !bfd_link_pic (info))
|
{
|
||||||
{
|
bfd_elf32_swap_reloc_in (output_bfd, p, &rel);
|
||||||
int num_plts = (htab->elf.splt->size
|
rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx,
|
||||||
/ abed->plt->plt_entry_size) - 1;
|
R_386_32);
|
||||||
unsigned char *p;
|
bfd_elf32_swap_reloc_out (output_bfd, &rel, p);
|
||||||
|
p += sizeof (Elf32_External_Rel);
|
||||||
|
|
||||||
p = htab->srelplt2->contents;
|
bfd_elf32_swap_reloc_in (output_bfd, p, &rel);
|
||||||
if (bfd_link_pic (info))
|
rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx,
|
||||||
p += PLTRESOLVE_RELOCS_SHLIB * sizeof (Elf32_External_Rel);
|
R_386_32);
|
||||||
else
|
bfd_elf32_swap_reloc_out (output_bfd, &rel, p);
|
||||||
p += PLTRESOLVE_RELOCS * sizeof (Elf32_External_Rel);
|
p += sizeof (Elf32_External_Rel);
|
||||||
|
}
|
||||||
for (; num_plts; num_plts--)
|
|
||||||
{
|
|
||||||
Elf_Internal_Rela rel;
|
|
||||||
bfd_elf32_swap_reloc_in (output_bfd, p, &rel);
|
|
||||||
rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
|
|
||||||
bfd_elf32_swap_reloc_out (output_bfd, &rel, p);
|
|
||||||
p += sizeof (Elf32_External_Rel);
|
|
||||||
|
|
||||||
bfd_elf32_swap_reloc_in (output_bfd, p, &rel);
|
|
||||||
rel.r_info = ELF32_R_INFO (htab->elf.hplt->indx, R_386_32);
|
|
||||||
bfd_elf32_swap_reloc_out (output_bfd, &rel, p);
|
|
||||||
p += sizeof (Elf32_External_Rel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user