diff mbox

[committed] Fix MIPS16 non-local goto regressions

Message ID 87d3nwy0qq.fsf@firetop.home
State New
Headers show

Commit Message

Richard Sandiford Jan. 16, 2011, 9:53 p.m. UTC
Many non-local goto tests were failing on MIPS16 because we were
using ADDIUPC instructions to load the address of the target label.
Using ADDIUPC for nonlocal labels was always wrong, because we have no
control over the range.  However, it hits more often now, because in the
affected tests, we put the parent and child in different sections.

Tested on mips64-linux-gnu, where it fixes many failures.  Applied.

Richard


gcc/
	* config/mips/mips.c (mips_classify_symbol): Don't return
	SYMBOL_PC_RELATIVE for nonlocal labels.
diff mbox

Patch

Index: gcc/config/mips/mips.c
===================================================================
--- gcc/config/mips/mips.c	2011-01-16 21:38:17.000000000 +0000
+++ gcc/config/mips/mips.c	2011-01-16 21:38:20.000000000 +0000
@@ -1669,10 +1669,13 @@  mips_classify_symbol (const_rtx x, enum
 
   if (GET_CODE (x) == LABEL_REF)
     {
-      /* LABEL_REFs are used for jump tables as well as text labels.
-	 Only return SYMBOL_PC_RELATIVE if we know the label is in
-	 the text section.  */
-      if (TARGET_MIPS16_SHORT_JUMP_TABLES)
+      /* Only return SYMBOL_PC_RELATIVE if we are generating MIPS16
+	 code and if we know that the label is in the current function's
+	 text section.  LABEL_REFs are used for jump tables as well as
+	 text labels, so we must check whether jump tables live in the
+	 text section.  */
+      if (TARGET_MIPS16_SHORT_JUMP_TABLES
+	  && !LABEL_REF_NONLOCAL_P (x))
 	return SYMBOL_PC_RELATIVE;
 
       if (TARGET_ABICALLS && !TARGET_ABSOLUTE_ABICALLS)