From: Michael Meissner Date: Mon, 16 Mar 1998 15:35:24 +0000 (+0000) Subject: Ensure sum from SDA is 16-bit X-Git-Tag: prereleases/egcs-1.1-prerelease~2084 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dbf55e5349e10486b12221c9dad95e6bcfbca0ed;p=thirdparty%2Fgcc.git Ensure sum from SDA is 16-bit From-SVN: r18631 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7017ba0ec4a1..4ffc5e49104f 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 8b7f340cfec6..aa80812803c6 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;