This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[patch] patch to fix MIPS empic testcase failure
- To: binutils at sourceware dot cygnus dot com
- Subject: [patch] patch to fix MIPS empic testcase failure
- From: cgd at sibyte dot com (Chris G. Demetriou)
- Date: 07 Oct 2000 18:42:21 -0700
Change log below is pretty descriptive. The problem was that it was
assuming that the 'add' symbol was always in the current segment. For
the mips empic test case lines:
la $3,g1-l3 # R_MIPS_GNU_REL_HI16 g1 0
# R_MIPS_GNU_REL_LO16 g1 C
la $3,l1-l3 # R_MIPS_GNU_REL_HI16 .foo 0
# R_MIPS_GNU_REL_LO16 .foo 114
that wasn't the case, and the assembler would fall over noting that
BFD_RELOC_LO16 wasn't good in PIC code.
For lovers of irony: when the patch to add the empic test case was
originally (and incompletely 8-) proposed, part of the message was
"They'd be more interesting if they failed." The buggy code which
caused the empic test failure was introduced in the source tree
between the time they were initially proposed and when they were
eventually committed. 8-)
to apply in src/gas:
2000-10-07 Chris Demetriou <cgd@sibyte.com>
* config/tc-mips.c (mips_ip): When calculating offsets,
don't accept as constant the difference between the
addresses of symbols in two different sections.
Index: config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.26
diff -c -r1.26 tc-mips.c
*** tc-mips.c 2000/09/20 22:05:08 1.26
--- tc-mips.c 2000/10/08 01:37:26
***************
*** 7873,7880 ****
|| offset_expr.X_add_number < -0x8000)
&& (mips_pic != EMBEDDED_PIC
|| offset_expr.X_op != O_subtract
! || (S_GET_SEGMENT (offset_expr.X_op_symbol)
! != now_seg)))
break;
if (c == 'h' || c == 'H')
--- 7873,7880 ----
|| offset_expr.X_add_number < -0x8000)
&& (mips_pic != EMBEDDED_PIC
|| offset_expr.X_op != O_subtract
! || (S_GET_SEGMENT (offset_expr.X_add_symbol)
! != S_GET_SEGMENT (offset_expr.X_op_symbol))))
break;
if (c == 'h' || c == 'H')