--- elf32-m68k.c 2004-12-14 12:27:51.000000000 +0530 +++ ../gcc-3.4.0/bfd/elf32-m68k.c 2004-10-04 16:59:08.000000000 +0530 @@ -191,11 +191,11 @@ /* The size in bytes of an entry in the procedure linkage table. */ -#define PLT_ENTRY_SIZE 20 +#define PLT_ENTRY_SIZE 24 /* The first entry in a procedure linkage table looks like this. See the SVR4 ABI m68k supplement to see how this works. */ - +#if 0 /* HCLT */ static const bfd_byte elf_m68k_plt0_entry[PLT_ENTRY_SIZE] = { 0x2f, 0x3b, 0x01, 0x70, /* move.l (%pc,addr),-(%sp) */ @@ -216,6 +216,34 @@ 0x60, 0xff, /* bra.l .plt */ 0, 0, 0, 0 /* replaced with offset to start of .plt. */ }; +#endif + +static const bfd_byte elf_m68k_plt0_entry[PLT_ENTRY_SIZE] = +{ + 0x20, 0x3c, + 0, 0, 0, 0, /* replaced with offset to .got + 4. */ + 0x2f, 0x3b, 0x08, 0xfa, /* move.l (%pc,addr),-(%sp) */ + 0x20, 0x3c, + 0, 0, 0, 0, /* replaced with offset to .got + 8. */ + 0x20, 0x7b, 0x08, 0x00, /* move.l (%pc,%d0:l), %a0 */ + 0x4e, 0xd0, /* jmp (%a0) */ + 0x4e, 0x71 +}; + +/* Subsequent entries in a procedure linkage table look like this. */ + +static const bfd_byte elf_m68k_plt_entry[PLT_ENTRY_SIZE] = +{ + 0x20, 0x3c, + 0, 0, 0, 0, /* replaced with offset to symbol's .got entry. */ + 0x20, 0x7b, 0x08, 0x00, /* move.l (%pc,%d0:l), %a0 */ + 0x4e, 0xd0, /* jmp (%a0) */ + 0x2f, 0x3c, /* move.l #offset,-(%sp) */ + 0, 0, 0, 0, /* replaced with offset into relocation table. */ + 0x60, 0xff, /* bra.l .plt */ + 0, 0, 0, 0 /* replaced with offset to start of .plt. */ +}; + #define CPU32_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_CPU32) @@ -1820,9 +1848,14 @@ /* Fill in the entry in the procedure linkage table. */ memcpy (splt->contents + h->plt.offset, elf_m68k_plt_entry, PLT_ENTRY_SIZE); +#if 0 /* HCLT */ plt_off1 = 4; plt_off2 = 10; plt_off3 = 16; +#endif + plt_off1 = 2; + plt_off2 = 14; + plt_off3 = 20; } /* The offset is relative to the first extension word. */ @@ -1831,7 +1864,7 @@ + sgot->output_offset + got_offset - (splt->output_section->vma - + h->plt.offset + 2)), + + h->plt.offset + 2) - 6 ), splt->contents + h->plt.offset + plt_off1); bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), @@ -1844,7 +1877,7 @@ (splt->output_section->vma + splt->output_offset + h->plt.offset - + 8), + + 12), sgot->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ @@ -2033,6 +2066,7 @@ if (!CPU32_FLAG (output_bfd)) { memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE); +#if 0 /* HCLT */ bfd_put_32 (output_bfd, (sgot->output_section->vma + sgot->output_offset + 4 @@ -2043,6 +2077,17 @@ + sgot->output_offset + 8 - (splt->output_section->vma + 10)), splt->contents + 12); +#endif + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 4 + - (splt->output_section->vma + 2)), + splt->contents + 2); + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + 8 + - (splt->output_section->vma + 10) - 8 ), + splt->contents + 12); elf_section_data (splt->output_section)->this_hdr.sh_entsize = PLT_ENTRY_SIZE; }