This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

help with sh-nto optimization


Hi, all.

THe QNX sh4 support (not in the recent patch), has an
optimization that I would like to implement and submit.

Since we are an RTOS, we don't use lazy linking.  As a
result, our .plt stubs can be smaller than the defaults.

eg:

#define PLT_ENTRY_SIZE   12

static const bfd_byte elf_sh_small_plt_entry_be[SMALL_PLT_ENTRY_SIZE] =
{
  0xd1, 0x01,   /* mov.l 0f,r1 */
  0x61, 0x12,   /* mov.l @r1,r1 */
  0x41, 0x2b,   /* jmp @r1 */
  0x00, 0x09,   /* nop */
  0, 0, 0, 0,   /* 0: replaced with address of this symbol in .got.  */
};

...
...
...


instead of:

#define PLT_ENTRY_SIZE   28

static const bfd_byte elf_sh_plt_entry_be[PLT_ENTRY_SIZE] =
{
  0xd0, 0x04,   /* mov.l 1f,r0 */
  0x60, 0x02,   /* mov.l @r0,r0 */
  0xd1, 0x02,   /* mov.l 0f,r1 */
  0x40, 0x2b,   /* jmp @r0 */
  0x60, 0x13,   /*  mov r1,r0 */
  0xd1, 0x03,   /* mov.l 2f,r1 */
  0x40, 0x2b,   /* jmp @r0 */
  0x00, 0x09,   /* nop */
  0, 0, 0, 0,   /* 0: replaced with address of .PLT0.  */
  0, 0, 0, 0,   /* 1: replaced with address of this symbol in .got.  */
  0, 0, 0, 0,   /* 2: replaced with offset into relocation table.  */
};

...
...
...




We did this by adding a command line to ld "--{no}-small-stubs", and set
a boolean flag in the info struct (initialized to no-small-stubs).  Then 
we checked against that flag and used the small-stubs and related code
accordingly.


Feedback?  Comments?  Suggestions?  I would like to add the "--{no}-small-stubs"
ld command line regardless for our legacy purposes.  We have it as the default
in our gcc specs files and our qcc conf files (qcc is our compiler front end,
and the conf files are our equivalents of specs files).

Thanks.
GP


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]