xtensa: generate PLT entries for call0 ABI

2015-09-15  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* elf32-xtensa.c (elf_xtensa_be_plt_entry)
	(elf_xtensa_le_plt_entry): Emit 'entry' instruction only for
	windowed ABI.
	(elf_xtensa_create_plt_entry): Generate 'l32r' offsets and fix
	up instructions according to ABI.
This commit is contained in:
Max Filippov 2015-09-15 06:37:14 +03:00
parent 5382cfab61
commit 92b3f00826
2 changed files with 20 additions and 7 deletions

View File

@ -1,3 +1,11 @@
2015-09-15 Max Filippov <jcmvbkbc@gmail.com>
* elf32-xtensa.c (elf_xtensa_be_plt_entry)
(elf_xtensa_le_plt_entry): Emit 'entry' instruction only for
windowed ABI.
(elf_xtensa_create_plt_entry): Generate 'l32r' offsets and fix
up instructions according to ABI.
2015-09-14 Rich Felker <dalias@libc.org>
* elf32-sh.c (sh_elf_relocate_section): Set EF_SH_PIC flag

View File

@ -521,7 +521,9 @@ elf_xtensa_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
static const bfd_byte elf_xtensa_be_plt_entry[PLT_ENTRY_SIZE] =
{
#if XSHAL_ABI == XTHAL_ABI_WINDOWED
0x6c, 0x10, 0x04, /* entry sp, 32 */
#endif
0x18, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */
0x1a, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */
0x1b, 0x00, 0x00, /* l32r a11, [literal for reloc index] */
@ -531,7 +533,9 @@ static const bfd_byte elf_xtensa_be_plt_entry[PLT_ENTRY_SIZE] =
static const bfd_byte elf_xtensa_le_plt_entry[PLT_ENTRY_SIZE] =
{
#if XSHAL_ABI == XTHAL_ABI_WINDOWED
0x36, 0x41, 0x00, /* entry sp, 32 */
#endif
0x81, 0x00, 0x00, /* l32r a8, [got entry for rtld's resolver] */
0xa1, 0x00, 0x00, /* l32r a10, [got entry for rtld's link map] */
0xb1, 0x00, 0x00, /* l32r a11, [literal for reloc index] */
@ -2317,7 +2321,7 @@ elf_xtensa_create_plt_entry (struct bfd_link_info *info,
{
asection *splt, *sgotplt;
bfd_vma plt_base, got_base;
bfd_vma code_offset, lit_offset;
bfd_vma code_offset, lit_offset, abi_offset;
int chunk;
chunk = reloc_index / PLT_ENTRIES_PER_CHUNK;
@ -2342,15 +2346,16 @@ elf_xtensa_create_plt_entry (struct bfd_link_info *info,
? elf_xtensa_be_plt_entry
: elf_xtensa_le_plt_entry),
PLT_ENTRY_SIZE);
abi_offset = XSHAL_ABI == XTHAL_ABI_WINDOWED ? 3 : 0;
bfd_put_16 (output_bfd, l32r_offset (got_base + 0,
plt_base + code_offset + 3),
splt->contents + code_offset + 4);
plt_base + code_offset + abi_offset),
splt->contents + code_offset + abi_offset + 1);
bfd_put_16 (output_bfd, l32r_offset (got_base + 4,
plt_base + code_offset + 6),
splt->contents + code_offset + 7);
plt_base + code_offset + abi_offset + 3),
splt->contents + code_offset + abi_offset + 4);
bfd_put_16 (output_bfd, l32r_offset (got_base + lit_offset,
plt_base + code_offset + 9),
splt->contents + code_offset + 10);
plt_base + code_offset + abi_offset + 6),
splt->contents + code_offset + abi_offset + 7);
return plt_base + code_offset;
}