View | Details | Raw Unified | Return to bug 16017 | Differences between
and this patch

Collapse All | Expand All

(-)a/bfd/elf32-arm.c (-7 / +39 lines)
Lines 2151-2156 static const bfd_vma elf32_arm_plt_entry [] = Link Here
2151
2151
2152
#endif
2152
#endif
2153
2153
2154
/* Subsequent entries in a procedure linkage table for thumb only target look like
2155
   this.  */
2156
static const bfd_vma elf32_thumb_plt_entry [] =
2157
{
2158
  0x0c00f240,		/* movw    ip, #0xNNNN    */
2159
  0x3c0cea4f,		/* lsl     ip, #12        */
2160
  0x0c00f20f,		/* addw    ip, pc, #0xNNN */
2161
  0xf000f8dc,		/* ldr     pc, [ip]       */
2162
};
2163
2154
/* The format of the first entry in the procedure linkage table
2164
/* The format of the first entry in the procedure linkage table
2155
   for a VxWorks executable.  */
2165
   for a VxWorks executable.  */
2156
static const bfd_vma elf32_arm_vxworks_exec_plt0_entry[] =
2166
static const bfd_vma elf32_arm_vxworks_exec_plt0_entry[] =
Lines 3464-3470 elf32_arm_link_hash_table_create (bfd *abfd) Link Here
3464
  ret->plt_entry_size = 16;
3474
  ret->plt_entry_size = 16;
3465
#else
3475
#else
3466
  ret->plt_header_size = 20;
3476
  ret->plt_header_size = 20;
3467
  ret->plt_entry_size = 12;
3477
  ret->plt_entry_size = 16; //TODO make conditional to using_thumb_only()
3468
#endif
3478
#endif
3469
  ret->use_rel = 1;
3479
  ret->use_rel = 1;
3470
  ret->obfd = abfd;
3480
  ret->obfd = abfd;
Lines 7689-7701 elf32_arm_populate_plt_entry (bfd *output_bfd, struct bfd_link_info *info, Link Here
7689
	}
7699
	}
7690
      else if (using_thumb_only (htab))
7700
      else if (using_thumb_only (htab))
7691
	{
7701
	{
7692
	  /* PR ld/16017: Do not generate ARM instructions for
7702
	  /* Calculate the displacement between the PLT slot and the
7693
	     the PLT if compiling for a thumb-only target.
7703
	     entry in the GOT.  The 12-byte offset accounts for the
7704
	     value produced by adding to pc in the 3rd instruction
7705
	     of the PLT stub.  */
7706
	  got_displacement = got_address - (plt_address + 12);
7694
7707
7695
	     FIXME: We ought to be able to generate thumb PLT instructions...  */
7708
	  BFD_ASSERT ((got_displacement & 0xf0000000) == 0);
7696
	  _bfd_error_handler (_("%B: Warning: thumb mode PLT generation not currently supported"),
7709
7697
			      output_bfd);
7710
	  /* As we are using 32 bit instructions we have to use 'put_arm_insn'
7698
	  return FALSE;
7711
	     instead of 'put_thumb_insn'.  */
7712
	  put_arm_insn (htab, output_bfd,
7713
			elf32_thumb_plt_entry[0]
7714
			| ((got_displacement & 0x000ff000) <<  4)
7715
			| ((got_displacement & 0x00700000) <<  8)
7716
			| ((got_displacement & 0x00800000) >> 13)
7717
			| ((got_displacement & 0x0f000000) >> 24),
7718
			ptr + 0);
7719
	  put_arm_insn (htab, output_bfd,
7720
			elf32_thumb_plt_entry[1],
7721
			ptr + 4);
7722
	  put_arm_insn (htab, output_bfd,
7723
			elf32_thumb_plt_entry[2]
7724
			| ((got_displacement & 0x000000ff) <<  16)
7725
			| ((got_displacement & 0x00000700) <<  20)
7726
			| ((got_displacement & 0x00000800) >>  1),
7727
			ptr + 8);
7728
	  put_arm_insn (htab, output_bfd,
7729
			elf32_thumb_plt_entry[3],
7730
			ptr + 12);
7699
	}
7731
	}
7700
      else
7732
      else
7701
	{
7733
	{

Return to bug 16017