xtensa: generate PLT entries for call0 ABI
authorMax Filippov <jcmvbkbc@gmail.com>
Tue, 15 Sep 2015 03:37:14 +0000 (06:37 +0300)
committerMax Filippov <jcmvbkbc@gmail.com>
Tue, 15 Sep 2015 19:18:51 +0000 (22:18 +0300)
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.

bfd/ChangeLog
bfd/elf32-xtensa.c

index 2c4a6e05d02aebc9e9db814e6824837ad31261d0..fb809a3aad90c127a53cc1becfebf3876755d70a 100644 (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
index 73538cde65180769be60fc956e403c67ae8f1b2c..ada3e5a3cee713ea9dce0154d80387705b06d613 100644 (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;
 }
This page took 0.031543 seconds and 4 git commands to generate.