2002-07-31 Stephen Clarke * elf32-sh.c (elf_sh_plt0_entry_be, elf_sh_plt_entry_le): copy contents of .got.plt[2] to tr0, not address of .got.plt. (sh_elf_finish_dynamic_symbol): Do not apply GOT_BIAS when patching absolute plt entry. In shmedia absolute plt entry, set bottom bit of pt to plt0 as this is an shmedia branch target. * elf64-sh64.c (elf_sh64_plt0_entry_be, elf_sh64_plt0_entry_le): copy contents of .got.plt[2] to tr0, not address of .got.plt. (sh64_elf64_finish_dynamic_symbol): Do not apply GOT_BIAS when patching absolute plt entry. In shmedia absolute plt entry, set bottom bit of pt to plt0 as this is an shmedia branch target. Index: src/bfd/elf32-sh.c =================================================================== RCS file: /cvs/src/src/bfd/elf32-sh.c,v retrieving revision 1.52 diff -u -c -3 -p -r1.52 elf32-sh.c *** src/bfd/elf32-sh.c 7 Jul 2002 09:10:39 -0000 1.52 --- src/bfd/elf32-sh.c 31 Jul 2002 18:50:00 -0000 *************** static const bfd_byte elf_sh_plt0_entry_ *** 2947,2953 **** 0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 16, r17 */ 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ 0x89, 0x10, 0x09, 0x90, /* ld.l r17, 8, r25 */ ! 0x6b, 0xf1, 0x46, 0x00, /* ptabs r17, tr0 */ 0x89, 0x10, 0x05, 0x10, /* ld.l r17, 4, r17 */ 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ 0x6f, 0xf0, 0xff, 0xf0, /* nop */ --- 2947,2953 ---- 0xcc, 0x00, 0x01, 0x10, /* movi .got.plt >> 16, r17 */ 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ 0x89, 0x10, 0x09, 0x90, /* ld.l r17, 8, r25 */ ! 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ 0x89, 0x10, 0x05, 0x10, /* ld.l r17, 4, r17 */ 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ 0x6f, 0xf0, 0xff, 0xf0, /* nop */ *************** static const bfd_byte elf_sh_plt0_entry_ *** 2967,2973 **** 0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */ 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ 0x90, 0x09, 0x10, 0x89, /* ld.l r17, 8, r25 */ ! 0x00, 0x46, 0xf1, 0x6b, /* ptabs r17, tr0 */ 0x10, 0x05, 0x10, 0x89, /* ld.l r17, 4, r17 */ 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ 0xf0, 0xff, 0xf0, 0x6f, /* nop */ --- 2967,2973 ---- 0x10, 0x01, 0x00, 0xcc, /* movi .got.plt >> 16, r17 */ 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ 0x90, 0x09, 0x10, 0x89, /* ld.l r17, 8, r25 */ ! 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ 0x10, 0x05, 0x10, 0x89, /* ld.l r17, 4, r17 */ 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ 0xf0, 0xff, 0xf0, 0x6f, /* nop */ *************** sh_elf_finish_dynamic_symbol (output_bfd *** 5479,5485 **** got_offset = (plt_index + 3) * 4; #ifdef GOT_BIAS ! got_offset -= GOT_BIAS; #endif /* Fill in the entry in the procedure linkage table. */ --- 5479,5486 ---- got_offset = (plt_index + 3) * 4; #ifdef GOT_BIAS ! if (info->shared) ! got_offset -= GOT_BIAS; #endif /* Fill in the entry in the procedure linkage table. */ *************** sh_elf_finish_dynamic_symbol (output_bfd *** 5500,5507 **** (splt->contents + h->plt.offset + elf_sh_plt_symbol_offset (info))); movi_shori_putval (output_bfd, ! (splt->output_section->vma + splt->output_offset), (splt->contents + h->plt.offset + elf_sh_plt_plt0_offset (info))); #else --- 5501,5510 ---- (splt->contents + h->plt.offset + elf_sh_plt_symbol_offset (info))); + /* Set bottom bit because its for a branch to SHmedia */ movi_shori_putval (output_bfd, ! (splt->output_section->vma + splt->output_offset) ! | 1, (splt->contents + h->plt.offset + elf_sh_plt_plt0_offset (info))); #else *************** sh_elf_finish_dynamic_symbol (output_bfd *** 5540,5546 **** } #ifdef GOT_BIAS ! got_offset += GOT_BIAS; #endif #ifdef INCLUDE_SHMEDIA --- 5543,5550 ---- } #ifdef GOT_BIAS ! if (info->shared) ! got_offset += GOT_BIAS; #endif #ifdef INCLUDE_SHMEDIA Index: src/bfd/elf64-sh64.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-sh64.c,v retrieving revision 1.15 diff -u -c -3 -p -r1.15 elf64-sh64.c *** src/bfd/elf64-sh64.c 7 Jul 2002 09:10:40 -0000 1.15 --- src/bfd/elf64-sh64.c 31 Jul 2002 18:50:00 -0000 *************** static const bfd_byte elf_sh64_plt0_entr *** 3016,3022 **** 0xc8, 0x00, 0x01, 0x10, /* shori (.got.plt >> 16) & 65535, r17 */ 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ 0x8d, 0x10, 0x09, 0x90, /* ld.q r17, 16, r25 */ ! 0x6b, 0xf1, 0x46, 0x00, /* ptabs r17, tr0 */ 0x8d, 0x10, 0x05, 0x10, /* ld.q r17, 8, r17 */ 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ 0x6f, 0xf0, 0xff, 0xf0, /* nop */ --- 3016,3022 ---- 0xc8, 0x00, 0x01, 0x10, /* shori (.got.plt >> 16) & 65535, r17 */ 0xc8, 0x00, 0x01, 0x10, /* shori .got.plt & 65535, r17 */ 0x8d, 0x10, 0x09, 0x90, /* ld.q r17, 16, r25 */ ! 0x6b, 0xf1, 0x66, 0x00, /* ptabs r25, tr0 */ 0x8d, 0x10, 0x05, 0x10, /* ld.q r17, 8, r17 */ 0x44, 0x01, 0xff, 0xf0, /* blink tr0, r63 */ 0x6f, 0xf0, 0xff, 0xf0, /* nop */ *************** static const bfd_byte elf_sh64_plt0_entr *** 3036,3042 **** 0x10, 0x01, 0x00, 0xc8, /* shori (.got.plt >> 16) & 65535, r17 */ 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ 0x90, 0x09, 0x10, 0x8d, /* ld.q r17, 16, r25 */ ! 0x00, 0x46, 0xf1, 0x6b, /* ptabs r17, tr0 */ 0x10, 0x05, 0x10, 0x8d, /* ld.q r17, 8, r17 */ 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ 0xf0, 0xff, 0xf0, 0x6f, /* nop */ --- 3036,3042 ---- 0x10, 0x01, 0x00, 0xc8, /* shori (.got.plt >> 16) & 65535, r17 */ 0x10, 0x01, 0x00, 0xc8, /* shori .got.plt & 65535, r17 */ 0x90, 0x09, 0x10, 0x8d, /* ld.q r17, 16, r25 */ ! 0x00, 0x66, 0xf1, 0x6b, /* ptabs r25, tr0 */ 0x10, 0x05, 0x10, 0x8d, /* ld.q r17, 8, r17 */ 0xf0, 0xff, 0x01, 0x44, /* blink tr0, r63 */ 0xf0, 0xff, 0xf0, 0x6f, /* nop */ *************** sh64_elf64_finish_dynamic_symbol (output *** 3805,3811 **** The first three are reserved. */ got_offset = (plt_index + 3) * 8; ! got_offset -= GOT_BIAS; /* Fill in the entry in the procedure linkage table. */ if (! info->shared) --- 3805,3812 ---- The first three are reserved. */ got_offset = (plt_index + 3) * 8; ! if (info->shared) ! got_offset -= GOT_BIAS; /* Fill in the entry in the procedure linkage table. */ if (! info->shared) *************** sh64_elf64_finish_dynamic_symbol (output *** 3824,3831 **** (splt->contents + h->plt.offset + elf_sh64_plt_symbol_offset (info))); movi_shori_putval (output_bfd, ! (splt->output_section->vma + splt->output_offset), (splt->contents + h->plt.offset + elf_sh64_plt_plt0_offset (info))); } --- 3825,3834 ---- (splt->contents + h->plt.offset + elf_sh64_plt_symbol_offset (info))); + /* Set bottom bit because its for a branch to SHmedia */ movi_shori_putval (output_bfd, ! (splt->output_section->vma + splt->output_offset) ! | 1, (splt->contents + h->plt.offset + elf_sh64_plt_plt0_offset (info))); } *************** sh64_elf64_finish_dynamic_symbol (output *** 3844,3850 **** + elf_sh64_plt_symbol_offset (info))); } ! got_offset += GOT_BIAS; movi_shori_putval (output_bfd, plt_index * sizeof (Elf64_External_Rela), --- 3847,3854 ---- + elf_sh64_plt_symbol_offset (info))); } ! if (info->shared) ! got_offset += GOT_BIAS; movi_shori_putval (output_bfd, plt_index * sizeof (Elf64_External_Rela),