From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19526 invoked by alias); 16 Mar 2005 09:21:37 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 18917 invoked from network); 16 Mar 2005 09:21:05 -0000 Received: from unknown (HELO wproxy.gmail.com) (64.233.184.207) by sourceware.org with SMTP; 16 Mar 2005 09:21:05 -0000 Received: by wproxy.gmail.com with SMTP id 36so1073wra for ; Wed, 16 Mar 2005 01:21:04 -0800 (PST) Received: by 10.54.54.44 with SMTP id c44mr184631wra; Tue, 15 Mar 2005 23:30:04 -0800 (PST) Received: by 10.54.6.28 with HTTP; Tue, 15 Mar 2005 23:30:04 -0800 (PST) Message-ID: Date: Wed, 16 Mar 2005 14:37:00 -0000 From: C Jaiprakash Reply-To: C Jaiprakash To: binutils@sources.redhat.com, binutils@sourceware.org Subject: Patches for review [Plt entry generation for coldfire v4e] Cc: cjaiprakash@noida.hcltech.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_28_19117013.1110958204037" X-SW-Source: 2005-03/txt/msg00435.txt.bz2 ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 442 Hi, I am sorry for the disclaimer attached with my previous mail.. I am resending the patches from other mail id. Regards, C Jaiprakash ========= Hi, I am attaching patches for generating plt entris for coldfire v4e. Since coldifire v4e do not support 32 bit displacement addressing mode existing PLT entries will not work. Please review the patches and let me know if any changes are required. Thanks and best regards, C Jaiprakash ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="tc-m68k.c.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tc-m68k.c.patch" Content-length: 808 Index: tc-m68k.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gas/config/tc-m68k.c,v retrieving revision 1.62 diff -u -p -r1.62 tc-m68k.c --- tc-m68k.c 1 Mar 2005 01:57:39 -0000 1.62 +++ tc-m68k.c 16 Mar 2005 06:40:31 -0000 @@ -7447,6 +7447,8 @@ void m68k_elf_final_processing (void) { /* Set file-specific flags if this is a cpu32 processor. */ + if ( arch_coldfire_fpu(current_architecture) ) + elf_elfheader (stdoutput)->e_flags |=3D EF_CFV4E; if (cpu_of_arch (current_architecture) & cpu32) elf_elfheader (stdoutput)->e_flags |=3D EF_CPU32; else if ((cpu_of_arch (current_architecture) & m68000up) ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="m68k.h.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="m68k.h.patch" Content-length: 551 Index: m68k.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/include/elf/m68k.h,v retrieving revision 1.8 diff -u -p -r1.8 m68k.h --- m68k.h 3 Mar 2005 11:58:06 -0000 1.8 +++ m68k.h 16 Mar 2005 06:39:16 -0000 @@ -54,5 +54,6 @@ END_RELOC_NUMBERS (R_68K_max) =20 #define EF_CPU32 0x00810000 #define EF_M68000 0x01000000 +#define EF_CFV4E 0x00008000 =20 #endif ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="gasChangeLog.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="gasChangeLog.patch" Content-length: 697 Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gas/ChangeLog,v retrieving revision 1.2420 diff -u -p -r1.2420 ChangeLog --- ChangeLog 15 Mar 2005 20:37:58 -0000 1.2420 +++ ChangeLog 16 Mar 2005 06:54:10 -0000 @@ -1,3 +1,7 @@ +2005-03-15 C Jaiprakash + * config/tc-m68k.c (m68k_elf_final_processing): Set file specific flag + for coldfire v4e.=20 + 2005-03-15 Zack Weinberg =20 * config/tc-arm.c (do_mla): Rename to do_mlas, take second ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="elfChangeLog.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="elfChangeLog.patch" Content-length: 626 Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/include/elf/ChangeLog,v retrieving revision 1.226 diff -u -p -r1.226 ChangeLog --- ChangeLog 2 Mar 2005 21:21:50 -0000 1.226 +++ ChangeLog 16 Mar 2005 06:55:20 -0000 @@ -1,3 +1,6 @@ +2005-03-02 C Jaipraash + * m68k.h: Define EF_CFV4E flag. + 2005-03-02 Daniel Jacobowitz Joseph Myers =20 ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="elf32-m68k.c.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="elf32-m68k.c.patch" Content-length: 6160 Index: elf32-m68k.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/bfd/elf32-m68k.c,v retrieving revision 1.73 diff -u -p -r1.73 elf32-m68k.c --- elf32-m68k.c 20 Feb 2005 14:59:06 -0000 1.73 +++ elf32-m68k.c 16 Mar 2005 06:39:49 -0000 @@ -191,6 +191,37 @@ reloc_type_lookup (abfd, code) =20 /* The size in bytes of an entry in the procedure linkage table. */ =20 +#define CFV4E_PLT_ENTRY_SIZE 24=20 + +#define CFV4E_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_CFV4E) + +static const bfd_byte elf_cfv4e_plt0_entry[CFV4E_PLT_ENTRY_SIZE] =3D +{ + 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] =3D +{ + 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 PLT_ENTRY_SIZE 20 =20 /* The first entry in a procedure linkage table looks like this. See @@ -977,6 +1008,8 @@ elf_m68k_adjust_dynamic_symbol (info, h) { if (CPU32_FLAG (dynobj)) s->size +=3D PLT_CPU32_ENTRY_SIZE; + else if( CFV4E_FLAG(dynobj) ) + s->_raw_size +=3D CFV4E_PLT_ENTRY_SIZE; else s->size +=3D PLT_ENTRY_SIZE; } @@ -998,6 +1031,8 @@ elf_m68k_adjust_dynamic_symbol (info, h) /* Make room for this entry. */ if (CPU32_FLAG (dynobj)) s->size +=3D PLT_CPU32_ENTRY_SIZE; + else if( CFV4E_FLAG(dynobj) ) + s->_raw_size +=3D CFV4E_PLT_ENTRY_SIZE; else s->size +=3D PLT_ENTRY_SIZE; =20 @@ -1789,6 +1824,8 @@ elf_m68k_finish_dynamic_symbol (output_b first entry in the procedure linkage table is reserved. */ if ( CPU32_FLAG (output_bfd)) plt_index =3D h->plt.offset / PLT_CPU32_ENTRY_SIZE - 1; + else if ( CFV4E_FLAG(output_bfd)) + plt_index =3D h->plt.offset / CFV4E_PLT_ENTRY_SIZE - 1; else plt_index =3D h->plt.offset / PLT_ENTRY_SIZE - 1; =20 @@ -1806,6 +1843,15 @@ elf_m68k_finish_dynamic_symbol (output_b plt_off2 =3D 12; plt_off3 =3D 18; } + else if (CFV4E_FLAG (output_bfd)) + { + memcpy (splt->contents + h->plt.offset, elf_cfv4e_plt_entry, + CFV4E_PLT_ENTRY_SIZE); + plt_off1 =3D 2; + plt_off2 =3D 14; + plt_off3 =3D 20; + + } else { /* Fill in the entry in the procedure linkage table. */ @@ -1816,26 +1862,48 @@ elf_m68k_finish_dynamic_symbol (output_b plt_off3 =3D 16; } =20 - /* The offset is relative to the first extension word. */ - bfd_put_32 (output_bfd, + if ( !CFV4E_FLAG (output_bfd)) + { + /* 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 + 2)), splt->contents + h->plt.offset + plt_off1); - + } + else + { + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset + - (splt->output_section->vma + + h->plt.offset + 2) - 6), + splt->contents + h->plt.offset + plt_off1); +=09=20=20 + }=20=20=20=20=20=20 bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), splt->contents + h->plt.offset + plt_off2); bfd_put_32 (output_bfd, - (h->plt.offset + plt_off3), splt->contents + h->plt.offset + plt_off3); - - /* Fill in the entry in the global offset table. */ - bfd_put_32 (output_bfd, + if ( !CFV4E_FLAG (output_bfd)) + { + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + 8), + sgot->contents + got_offset); + } + else + bfd_put_32 (output_bfd, (splt->output_section->vma + splt->output_offset + h->plt.offset - + 8), + + 12), sgot->contents + got_offset); =20 /* Fill in the entry in the .rela.plt section. */ @@ -2013,7 +2081,24 @@ elf_m68k_finish_dynamic_sections (output /* Fill in the first entry in the procedure linkage table. */ if (splt->size > 0) { - if (!CPU32_FLAG (output_bfd)) + + 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 + =3D CFV4E_PLT_ENTRY_SIZE; + } + else if (!CPU32_FLAG (output_bfd)) { memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE); bfd_put_32 (output_bfd, ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="ChangeLog.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ChangeLog.patch" Content-length: 792 Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/bfd/ChangeLog,v retrieving revision 1.2962 diff -u -p -r1.2962 ChangeLog --- ChangeLog 16 Mar 2005 02:41:24 -0000 1.2962 +++ ChangeLog 16 Mar 2005 06:53:39 -0000 @@ -1,3 +1,8 @@ +2005-03-16 C Jaiprakash + * elf32-m68k.c (elf_cfv4e_plt0_entry): plt entry for coldfire v4e.=20 + (elf_m68k_adjust_dynamic_symbol,elf_m68k_finish_dynamic_symbol, + elf_m68k_finish_dynamic_sections): use it + 2005-03-16 Alan Modra =20 * elf32-ppc.c (ppc_elf_create_linker_section): Set SEC_LINKER_CREATED ------=_Part_28_19117013.1110958204037-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26491 invoked by alias); 16 Mar 2005 09:27:12 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 26070 invoked from network); 16 Mar 2005 09:26:39 -0000 Received: from unknown (HELO wproxy.gmail.com) (64.233.184.197) by sourceware.org with SMTP; 16 Mar 2005 09:26:39 -0000 Received: by wproxy.gmail.com with SMTP id 37so2204wra for ; Wed, 16 Mar 2005 01:26:38 -0800 (PST) Received: by 10.54.54.44 with SMTP id c44mr184631wra; Tue, 15 Mar 2005 23:30:04 -0800 (PST) Received: by 10.54.6.28 with HTTP; Tue, 15 Mar 2005 23:30:04 -0800 (PST) Message-ID: Date: Wed, 16 Mar 2005 14:42:00 -0000 From: C Jaiprakash Reply-To: C Jaiprakash To: binutils@sources.redhat.com, binutils@sourceware.org Subject: Patches for review [Plt entry generation for coldfire v4e] Cc: cjaiprakash@noida.hcltech.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_28_19117013.1110958204037" X-SW-Source: 2005-03/txt/msg00436.txt.bz2 Message-ID: <20050316144200.AakgO8igeWKZPU9Ydx0y1wEh7N8onYQH_558IVKb90s@z> ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 442 Hi, I am sorry for the disclaimer attached with my previous mail.. I am resending the patches from other mail id. Regards, C Jaiprakash ========= Hi, I am attaching patches for generating plt entris for coldfire v4e. Since coldifire v4e do not support 32 bit displacement addressing mode existing PLT entries will not work. Please review the patches and let me know if any changes are required. Thanks and best regards, C Jaiprakash ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="tc-m68k.c.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tc-m68k.c.patch" Content-length: 808 Index: tc-m68k.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gas/config/tc-m68k.c,v retrieving revision 1.62 diff -u -p -r1.62 tc-m68k.c --- tc-m68k.c 1 Mar 2005 01:57:39 -0000 1.62 +++ tc-m68k.c 16 Mar 2005 06:40:31 -0000 @@ -7447,6 +7447,8 @@ void m68k_elf_final_processing (void) { /* Set file-specific flags if this is a cpu32 processor. */ + if ( arch_coldfire_fpu(current_architecture) ) + elf_elfheader (stdoutput)->e_flags |=3D EF_CFV4E; if (cpu_of_arch (current_architecture) & cpu32) elf_elfheader (stdoutput)->e_flags |=3D EF_CPU32; else if ((cpu_of_arch (current_architecture) & m68000up) ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="m68k.h.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="m68k.h.patch" Content-length: 551 Index: m68k.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/include/elf/m68k.h,v retrieving revision 1.8 diff -u -p -r1.8 m68k.h --- m68k.h 3 Mar 2005 11:58:06 -0000 1.8 +++ m68k.h 16 Mar 2005 06:39:16 -0000 @@ -54,5 +54,6 @@ END_RELOC_NUMBERS (R_68K_max) =20 #define EF_CPU32 0x00810000 #define EF_M68000 0x01000000 +#define EF_CFV4E 0x00008000 =20 #endif ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="gasChangeLog.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="gasChangeLog.patch" Content-length: 697 Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gas/ChangeLog,v retrieving revision 1.2420 diff -u -p -r1.2420 ChangeLog --- ChangeLog 15 Mar 2005 20:37:58 -0000 1.2420 +++ ChangeLog 16 Mar 2005 06:54:10 -0000 @@ -1,3 +1,7 @@ +2005-03-15 C Jaiprakash + * config/tc-m68k.c (m68k_elf_final_processing): Set file specific flag + for coldfire v4e.=20 + 2005-03-15 Zack Weinberg =20 * config/tc-arm.c (do_mla): Rename to do_mlas, take second ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="elfChangeLog.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="elfChangeLog.patch" Content-length: 626 Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/include/elf/ChangeLog,v retrieving revision 1.226 diff -u -p -r1.226 ChangeLog --- ChangeLog 2 Mar 2005 21:21:50 -0000 1.226 +++ ChangeLog 16 Mar 2005 06:55:20 -0000 @@ -1,3 +1,6 @@ +2005-03-02 C Jaipraash + * m68k.h: Define EF_CFV4E flag. + 2005-03-02 Daniel Jacobowitz Joseph Myers =20 ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="elf32-m68k.c.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="elf32-m68k.c.patch" Content-length: 6160 Index: elf32-m68k.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/bfd/elf32-m68k.c,v retrieving revision 1.73 diff -u -p -r1.73 elf32-m68k.c --- elf32-m68k.c 20 Feb 2005 14:59:06 -0000 1.73 +++ elf32-m68k.c 16 Mar 2005 06:39:49 -0000 @@ -191,6 +191,37 @@ reloc_type_lookup (abfd, code) =20 /* The size in bytes of an entry in the procedure linkage table. */ =20 +#define CFV4E_PLT_ENTRY_SIZE 24=20 + +#define CFV4E_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_CFV4E) + +static const bfd_byte elf_cfv4e_plt0_entry[CFV4E_PLT_ENTRY_SIZE] =3D +{ + 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] =3D +{ + 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 PLT_ENTRY_SIZE 20 =20 /* The first entry in a procedure linkage table looks like this. See @@ -977,6 +1008,8 @@ elf_m68k_adjust_dynamic_symbol (info, h) { if (CPU32_FLAG (dynobj)) s->size +=3D PLT_CPU32_ENTRY_SIZE; + else if( CFV4E_FLAG(dynobj) ) + s->_raw_size +=3D CFV4E_PLT_ENTRY_SIZE; else s->size +=3D PLT_ENTRY_SIZE; } @@ -998,6 +1031,8 @@ elf_m68k_adjust_dynamic_symbol (info, h) /* Make room for this entry. */ if (CPU32_FLAG (dynobj)) s->size +=3D PLT_CPU32_ENTRY_SIZE; + else if( CFV4E_FLAG(dynobj) ) + s->_raw_size +=3D CFV4E_PLT_ENTRY_SIZE; else s->size +=3D PLT_ENTRY_SIZE; =20 @@ -1789,6 +1824,8 @@ elf_m68k_finish_dynamic_symbol (output_b first entry in the procedure linkage table is reserved. */ if ( CPU32_FLAG (output_bfd)) plt_index =3D h->plt.offset / PLT_CPU32_ENTRY_SIZE - 1; + else if ( CFV4E_FLAG(output_bfd)) + plt_index =3D h->plt.offset / CFV4E_PLT_ENTRY_SIZE - 1; else plt_index =3D h->plt.offset / PLT_ENTRY_SIZE - 1; =20 @@ -1806,6 +1843,15 @@ elf_m68k_finish_dynamic_symbol (output_b plt_off2 =3D 12; plt_off3 =3D 18; } + else if (CFV4E_FLAG (output_bfd)) + { + memcpy (splt->contents + h->plt.offset, elf_cfv4e_plt_entry, + CFV4E_PLT_ENTRY_SIZE); + plt_off1 =3D 2; + plt_off2 =3D 14; + plt_off3 =3D 20; + + } else { /* Fill in the entry in the procedure linkage table. */ @@ -1816,26 +1862,48 @@ elf_m68k_finish_dynamic_symbol (output_b plt_off3 =3D 16; } =20 - /* The offset is relative to the first extension word. */ - bfd_put_32 (output_bfd, + if ( !CFV4E_FLAG (output_bfd)) + { + /* 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 + 2)), splt->contents + h->plt.offset + plt_off1); - + } + else + { + bfd_put_32 (output_bfd, + (sgot->output_section->vma + + sgot->output_offset + + got_offset + - (splt->output_section->vma + + h->plt.offset + 2) - 6), + splt->contents + h->plt.offset + plt_off1); +=09=20=20 + }=20=20=20=20=20=20 bfd_put_32 (output_bfd, plt_index * sizeof (Elf32_External_Rela), splt->contents + h->plt.offset + plt_off2); bfd_put_32 (output_bfd, - (h->plt.offset + plt_off3), splt->contents + h->plt.offset + plt_off3); - - /* Fill in the entry in the global offset table. */ - bfd_put_32 (output_bfd, + if ( !CFV4E_FLAG (output_bfd)) + { + /* Fill in the entry in the global offset table. */ + bfd_put_32 (output_bfd, + (splt->output_section->vma + + splt->output_offset + + h->plt.offset + + 8), + sgot->contents + got_offset); + } + else + bfd_put_32 (output_bfd, (splt->output_section->vma + splt->output_offset + h->plt.offset - + 8), + + 12), sgot->contents + got_offset); =20 /* Fill in the entry in the .rela.plt section. */ @@ -2013,7 +2081,24 @@ elf_m68k_finish_dynamic_sections (output /* Fill in the first entry in the procedure linkage table. */ if (splt->size > 0) { - if (!CPU32_FLAG (output_bfd)) + + 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 + =3D CFV4E_PLT_ENTRY_SIZE; + } + else if (!CPU32_FLAG (output_bfd)) { memcpy (splt->contents, elf_m68k_plt0_entry, PLT_ENTRY_SIZE); bfd_put_32 (output_bfd, ------=_Part_28_19117013.1110958204037 Content-Type: text/plain; name="ChangeLog.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="ChangeLog.patch" Content-length: 792 Index: ChangeLog =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/bfd/ChangeLog,v retrieving revision 1.2962 diff -u -p -r1.2962 ChangeLog --- ChangeLog 16 Mar 2005 02:41:24 -0000 1.2962 +++ ChangeLog 16 Mar 2005 06:53:39 -0000 @@ -1,3 +1,8 @@ +2005-03-16 C Jaiprakash + * elf32-m68k.c (elf_cfv4e_plt0_entry): plt entry for coldfire v4e.=20 + (elf_m68k_adjust_dynamic_symbol,elf_m68k_finish_dynamic_symbol, + elf_m68k_finish_dynamic_sections): use it + 2005-03-16 Alan Modra =20 * elf32-ppc.c (ppc_elf_create_linker_section): Set SEC_LINKER_CREATED ------=_Part_28_19117013.1110958204037--