This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: MIPS PLT entry
- From: "Fu, Chao-Ying" <fu at mips dot com>
- To: "Adam Nemet" <anemet at caviumnetworks dot com>
- Cc: "Richard Sandiford" <rdsandiford at googlemail dot com>, "Maciej W. Rozycki" <macro at linux-mips dot org>, <binutils at sourceware dot org>
- Date: Thu, 16 Jul 2009 15:54:31 -0700
- Subject: RE: MIPS PLT entry
Adam Nemet wrote:
> "Fu, Chao-Ying" <fu@mips.com> writes:
> > Here is the new patch. Please check it. Thanks a lot!
>
> Since your resubmitting anyway, you might want to incorporate Maciej's
> comments as well. FWIW, I agree with him but I didn't want to be too
> pedantic either ;).
>
> Adam
>
Yes, sure. Here is the diff for elfxx-mips.c to incorporate Maciej's idea.
Thanks!
Regards,
Chao-ying
Index: elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.255
diff -u -p -r1.255 elfxx-mips.c
--- elfxx-mips.c 21 May 2009 14:15:49 -0000 1.255
+++ elfxx-mips.c 16 Jul 2009 22:49:44 -0000
@@ -662,6 +662,12 @@ static struct mips_got_info *mips_elf_go
/* This will be used when we sort the dynamic relocation records. */
static bfd *reldyn_sorting_bfd;
+/* True if ABFD is for CPUs with load interlocking that include
+ non-MIPS1 CPUs and R3900. */
+#define LOAD_INTERLOCKS_P(abfd) \
+ (((elf_elfheader (abfd)->e_flags & EF_MIPS_ARCH) != E_MIPS_ARCH_1) \
+ || ((elf_elfheader (abfd)->e_flags & EF_MIPS_MACH) == E_MIPS_MACH_3900))
+
/* True if ABFD is a PIC object. */
#define PIC_OBJECT_P(abfd) \
((elf_elfheader (abfd)->e_flags & EF_MIPS_PIC) != 0)
@@ -8631,9 +8637,11 @@ _bfd_mips_elf_size_dynamic_sections (bfd
else if (s == htab->splt)
{
/* If the last PLT entry has a branch delay slot, allocate
- room for an extra nop to fill the delay slot. */
- if (!htab->is_vxworks && s->size > 0)
- s->size += 4;
+ room for an extra nop to fill the delay slot.
+ This is for CPUs without load interlocking. */
+ if (!LOAD_INTERLOCKS_P (output_bfd)
+ && !htab->is_vxworks && s->size > 0)
+ s->size += 4;
}
else if (! CONST_STRNEQ (name, ".init")
&& s != htab->sgot
@@ -9355,8 +9363,17 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd
plt_entry = mips_exec_plt_entry;
bfd_put_32 (output_bfd, plt_entry[0] | got_address_high, loc);
bfd_put_32 (output_bfd, plt_entry[1] | got_address_low | load, loc + 4);
- bfd_put_32 (output_bfd, plt_entry[2] | got_address_low, loc + 8);
- bfd_put_32 (output_bfd, plt_entry[3], loc + 12);
+
+ if (!LOAD_INTERLOCKS_P (output_bfd))
+ {
+ bfd_put_32 (output_bfd, plt_entry[2] | got_address_low, loc + 8);
+ bfd_put_32 (output_bfd, plt_entry[3], loc + 12);
+ }
+ else
+ {
+ bfd_put_32 (output_bfd, plt_entry[3], loc + 8);
+ bfd_put_32 (output_bfd, plt_entry[2] | got_address_low, loc + 12);
+ }
/* Emit an R_MIPS_JUMP_SLOT relocation against the .got.plt entry. */
mips_elf_output_dynamic_relocation (output_bfd, htab->srelplt,