tags 327780 + patch thanks Hi,
With a little help from my friends (on IRC)... I've identified the cause of this bug to be part of revision 1.74 of bfd/elf32-m68k.c in the binutils source. I confirmed that it works by producing a cross-binutils on my (powerpc) laptop from the binutils source package with only that revision reversed. I'm building a native binutils right now to verify, but I don't expect any problems there. The patch that I applied follows. Note that this completely removes the PLT support for the ColdFire V4E (i.e., it's a verbatim reversion of revision 1.74), so it's not really suitable for upstream; but since Debian doesn't support the V4E (yet), this should do for the moment -- unless someone identifies the bug Real Soon and fixes it :-) --- elf32-m68k.c.orig 2005-08-31 05:27:29.000000000 +0200 +++ elf32-m68k.c 2005-10-31 20:25:40.000000000 +0100 @@ -217,37 +217,6 @@ 0, 0, 0, 0 /* replaced with offset to start of .plt. */ }; - -#define CFV4E_PLT_ENTRY_SIZE 24 - -#define CFV4E_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_CFV4E) - -static const bfd_byte elf_cfv4e_plt0_entry[CFV4E_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 /* nop */ -}; - -/* Subsequent entries in a procedure linkage table look like this. */ - -static const bfd_byte elf_cfv4e_plt_entry[CFV4E_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) #define PLT_CPU32_ENTRY_SIZE 24 @@ -1013,8 +982,6 @@ { if (CPU32_FLAG (dynobj)) s->size += PLT_CPU32_ENTRY_SIZE; - else if (CFV4E_FLAG (dynobj)) - s->size += CFV4E_PLT_ENTRY_SIZE; else s->size += PLT_ENTRY_SIZE; } @@ -1036,8 +1003,6 @@ /* Make room for this entry. */ if (CPU32_FLAG (dynobj)) s->size += PLT_CPU32_ENTRY_SIZE; - else if (CFV4E_FLAG (dynobj)) - s->size += CFV4E_PLT_ENTRY_SIZE; else s->size += PLT_ENTRY_SIZE; @@ -1823,19 +1788,17 @@ corresponds to this symbol. This is the index of this symbol in all the symbols for which we are making plt entries. The first entry in the procedure linkage table is reserved. */ - if (CPU32_FLAG (output_bfd)) - plt_index = (h->plt.offset / PLT_CPU32_ENTRY_SIZE) - 1; - else if (CFV4E_FLAG (output_bfd)) - plt_index = (h->plt.offset / CFV4E_PLT_ENTRY_SIZE) - 1; + if ( CPU32_FLAG (output_bfd)) + plt_index = h->plt.offset / PLT_CPU32_ENTRY_SIZE - 1; else - plt_index = (h->plt.offset / PLT_ENTRY_SIZE) - 1; + plt_index = h->plt.offset / PLT_ENTRY_SIZE - 1; /* Get the offset into the .got table of the entry that corresponds to this function. Each .got entry is 4 bytes. The first three are reserved. */ got_offset = (plt_index + 3) * 4; - if (CPU32_FLAG (output_bfd)) + if ( CPU32_FLAG (output_bfd)) { /* Fill in the entry in the procedure linkage table. */ memcpy (splt->contents + h->plt.offset, elf_cpu32_plt_entry, @@ -1844,14 +1807,6 @@ plt_off2 = 12; plt_off3 = 18; } - else if (CFV4E_FLAG (output_bfd)) - { - memcpy (splt->contents + h->plt.offset, elf_cfv4e_plt_entry, - CFV4E_PLT_ENTRY_SIZE); - plt_off1 = 2; - plt_off2 = 14; - plt_off3 = 20; - } else { /* Fill in the entry in the procedure linkage table. */ @@ -1864,12 +1819,11 @@ /* The offset is relative to the first extension word. */ bfd_put_32 (output_bfd, - sgot->output_section->vma - + sgot->output_offset - + got_offset - - (splt->output_section->vma - + h->plt.offset - + CFV4E_FLAG (output_bfd) ? 8 : 2), + (sgot->output_section->vma + + sgot->output_offset + + got_offset + - (splt->output_section->vma + + h->plt.offset + 2)), splt->contents + h->plt.offset + plt_off1); bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), @@ -1882,7 +1836,7 @@ (splt->output_section->vma + splt->output_offset + h->plt.offset - + CFV4E_FLAG (output_bfd) ? 12 : 8), + + 8), sgot->contents + got_offset); /* Fill in the entry in the .rela.plt section. */ @@ -2060,25 +2014,9 @@ /* Fill in the first entry in the procedure linkage table. */ if (splt->size > 0) { - if (CFV4E_FLAG (output_bfd)) - { - memcpy (splt->contents, elf_cfv4e_plt0_entry, CFV4E_PLT_ENTRY_SIZE); - 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 - = CFV4E_PLT_ENTRY_SIZE; - } - else if (CPU32_FLAG (output_bfd)) + if (!CPU32_FLAG (output_bfd)) { - memcpy (splt->contents, elf_cpu32_plt0_entry, PLT_CPU32_ENTRY_SIZE); + memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE); bfd_put_32 (output_bfd, (sgot->output_section->vma + sgot->output_offset + 4 @@ -2090,11 +2028,11 @@ - (splt->output_section->vma + 10)), splt->contents + 12); elf_section_data (splt->output_section)->this_hdr.sh_entsize - = PLT_CPU32_ENTRY_SIZE; + = PLT_ENTRY_SIZE; } - else + else /* cpu32 */ { - memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE); + memcpy (splt->contents, elf_cpu32_plt0_entry, PLT_CPU32_ENTRY_SIZE); bfd_put_32 (output_bfd, (sgot->output_section->vma + sgot->output_offset + 4 @@ -2106,7 +2044,7 @@ - (splt->output_section->vma + 10)), splt->contents + 12); elf_section_data (splt->output_section)->this_hdr.sh_entsize - = PLT_ENTRY_SIZE; + = PLT_CPU32_ENTRY_SIZE; } } } -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]