This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: MIPS JAL/JALR to BAL transformation for Linux (o32 ABI)
- From: "Fu, Chao-Ying" <fu at mips dot com>
- To: "Richard Sandiford" <rdsandiford at googlemail dot com>
- Cc: "Adam Nemet" <anemet at caviumnetworks dot com>, <binutils at sourceware dot org>, "Lau, David" <davidlau at mips dot com>, "Garbacea, Ilie" <ilie at mips dot com>
- Date: Wed, 5 Aug 2009 14:46:41 -0700
- Subject: RE: MIPS JAL/JALR to BAL transformation for Linux (o32 ABI)
Richard Sandiford wrote:
> "Fu, Chao-Ying" <fu@mips.com> writes:
> > To check output_bfd, we need to add a new parameter of
> output_bfd to
> > mips_elf_perform_relocation. But now because JALR_TO_BAL_P
> is true for all
> > and JAL_TO_BAL_P is true for RM9000, checking input_bfd
> should be the same
> > as checking output_bfd for non-RM9000 objects. We still
> can change to check
> > output_bfd later.
>
> The output bfd is also available via info->output_bfd. (bfd has
> a habit of passing both around, but the info parameter makes the
> output_bfd parameter redundant.)
>
> Richard
>
Yes. Here is the patch to fix this. Ok to install? Thanks a lot!
Regards,
Chao-ying
2009-08-05 Chao-ying Fu <fu@mips.com>
* elfxx-mips.c (mips_elf_perform_relocation): Pass info->output_bfd
toJAL_TO_BAL_P and JALR_TO_BAL_P.
Index: elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.257
diff -u -p -r1.257 elfxx-mips.c
--- elfxx-mips.c 5 Aug 2009 21:17:51 -0000 1.257
+++ elfxx-mips.c 5 Aug 2009 21:44:54 -0000
@@ -5600,10 +5600,10 @@ mips_elf_perform_relocation (struct bfd_
/* Try converting JAL and JALR to BAL, if the target is in range. */
if (!info->relocatable
&& !require_jalx
- && ((JAL_TO_BAL_P (input_bfd)
+ && ((JAL_TO_BAL_P (info->output_bfd)
&& r_type == R_MIPS_26
&& (x >> 26) == 0x3) /* jal addr */
- || (JALR_TO_BAL_P (input_bfd)
+ || (JALR_TO_BAL_P (info->output_bfd)
&& r_type == R_MIPS_JALR
&& x == 0x0320f809))) /* jalr t9 */
{