This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] MIPS gas: Disallow most PC-rel references to other sections
- From: Thiemo Seufer <ths at networkno dot de>
- To: binutils at sourceware dot org
- Date: Fri, 3 Nov 2006 16:37:16 +0000
- Subject: [PATCH] MIPS gas: Disallow most PC-rel references to other sections
Hello All,
I applied the appended patch, it disallows MIPS16 PC-relative
references to different sections, except for branches. This catches
(broken) compiler output which attempts to use constant offsets over
section borders.
Thiemo
2006-11-03 Thiemo Seufer <ths@mips.com>
* config/tc-mips.c (md_pcrel_from_section): Disallow PC relative
MIPS16 instructions referencing other sections, unless they are
external branches.
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.356
diff -u -p -r1.356 tc-mips.c
--- gas/config/tc-mips.c 3 Nov 2006 12:36:39 -0000 1.356
+++ gas/config/tc-mips.c 3 Nov 2006 15:48:10 -0000
@@ -11544,6 +11544,10 @@ md_pcrel_from (fixS *fixP)
/* Return the address of the delay slot. */
return addr + 4;
default:
+ /* We have no relocation type for PC relative MIPS16 instructions. */
+ if (fixP->fx_addsy && S_GET_SEGMENT (fixP->fx_addsy) != now_seg)
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("PC relative MIPS16 instruction references a different section"));
return addr;
}
}