diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7017ba0ec4a..4ffc5e49104 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -3,6 +3,10 @@ Mon Mar 16 15:57:17 1998 Michael Meissner * gcc.c (default_arg): Don't wander off the end of allocated memory. + (From Geoffrey Keating ) + * 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 * config/m68k/netbsd.h (ASM_SPEC): Add %{m68060}. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 8b7f340cfec..aa80812803c 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -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;