This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.


2006-11-03  Thiemo Seufer  <>

	* 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;
+      /* 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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]