Ensure sum from SDA is 16-bit
authorMichael Meissner <meissner@cygnus.com>
Mon, 16 Mar 1998 15:35:24 +0000 (15:35 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Mon, 16 Mar 1998 15:35:24 +0000 (15:35 +0000)
From-SVN: r18631

gcc/ChangeLog
gcc/config/rs6000/rs6000.c

index 7017ba0..4ffc5e4 100644 (file)
@@ -3,6 +3,10 @@ Mon Mar 16 15:57:17 1998  Michael Meissner  <meissner@cygnus.com>
        * gcc.c (default_arg): Don't wander off the end of allocated
        memory.
 
+       (From Geoffrey Keating  <geoffk@ozemail.com.au>)
+       * rs6000.c (small_data_operand): Ensure that any address
+       referenced relative to the small data area is inside the SDA.   
+
 Mon Mar 16 12:55:15 1998  Jim Wilson  <wilson@cygnus.com>
        
        * config/m68k/netbsd.h (ASM_SPEC): Add %{m68060}.
index 8b7f340..aa80812 100644 (file)
@@ -1080,7 +1080,18 @@ small_data_operand (op, mode)
     return 0;
 
   else
-    sym_ref = XEXP (XEXP (op, 0), 0);
+    {
+      rtx sum = XEXP (op, 0);
+      HOST_WIDE_INT summand;
+
+      /* We have to be careful here, because it is the referenced address
+        that must be 32k from _SDA_BASE_, not just the symbol.  */
+      summand = INTVAL (XEXP (sum, 1));
+      if (summand < 0 || summand > g_switch_value)
+       return 0;
+
+      sym_ref = XEXP (sum, 0);
+    }
 
   if (*XSTR (sym_ref, 0) != '@')
     return 0;