[M68K] Don't clobber PIC reference to constant pool
Andreas Schwab
schwab@linux-m68k.org
Mon Jun 14 21:41:00 GMT 2010
m68k_delegitimize_address should not do anything if the argument isn't a
MEM, otherwise PIC references to the constant pool will be miscompiled.
Tested on m68k-linux, committed to trunk and 4.5 branch.
Andreas.
2010-06-14 Andreas Schwab <schwab@linux-m68k.org>
* config/m68k/m68k.c (m68k_delegitimize_address): Don't do
anything if the argument is not a MEM.
Index: gcc/config/m68k/m68k.c
===================================================================
--- gcc/config/m68k/m68k.c (revision 160760)
+++ gcc/config/m68k/m68k.c (working copy)
@@ -4625,16 +4625,17 @@ m68k_output_dwarf_dtprel (FILE *file, in
and turn them back into a direct symbol reference. */
static rtx
-m68k_delegitimize_address (rtx x)
+m68k_delegitimize_address (rtx orig_x)
{
- rtx orig_x = delegitimize_mem_from_attrs (x);
- rtx y;
+ rtx x, y;
rtx addend = NULL_RTX;
rtx result;
- x = orig_x;
- if (MEM_P (x))
- x = XEXP (x, 0);
+ orig_x = delegitimize_mem_from_attrs (orig_x);
+ if (! MEM_P (orig_x))
+ return orig_x;
+
+ x = XEXP (orig_x, 0);
if (GET_CODE (x) == PLUS
&& GET_CODE (XEXP (x, 1)) == CONST
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
More information about the Gcc-patches
mailing list