mips.c (mips_classify_symbol): Don't return SYMBOL_PC_RELATIVE for nonlocal labels.
authorRichard Sandiford <rdsandiford@googlemail.com>
Sun, 16 Jan 2011 21:52:37 +0000 (21:52 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sun, 16 Jan 2011 21:52:37 +0000 (21:52 +0000)
gcc/
* config/mips/mips.c (mips_classify_symbol): Don't return
SYMBOL_PC_RELATIVE for nonlocal labels.

From-SVN: r168874

gcc/ChangeLog
gcc/config/mips/mips.c

index 105d5a41cdb3e0ef99113af15f29a49d4bd60515..a3706fb7b552678f5eee62059137683dcd966d8d 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-16  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       * config/mips/mips.c (mips_classify_symbol): Don't return
+       SYMBOL_PC_RELATIVE for nonlocal labels.
+
 2011-01-15  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sol2-bi.h (CC1_SPEC): Fix typo.
index 357054691925ea04c35271fee6027e588474c7ed..a534638541dd22eefa47ab593d3b5827da5b4e63 100644 (file)
@@ -1669,10 +1669,13 @@ mips_classify_symbol (const_rtx x, enum mips_symbol_context context)
 
   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)