[3.4/3.5 PATCH] Fix target/16649 ICE on x86-darwin
Andrew Pinski
pinskia@physics.uc.edu
Wed Jul 21 12:33:00 GMT 2004
GCC rejects some constant RTL which are valid for x86-darwin:
(const:SI (minus:SI (symbol_ref:SI ("&L___keymgr_global$non_lazy_ptr"))
(symbol_ref:SI ("<pic base>")))
This is a fall out of the patch to fix PR target/15717.
This patch fixes it by accepting the above RTL as it is a valid constant
on x86-darwin.
OK for the mainline and the 3.4 branch? Tested with a cross compiler
from
powerpc-apple-darwin to i686-pc-darwin and ran into another bug, PR
16651
when building libstdc++.
Thanks,
Andrew Pinski
ChangeLog:
* config/i386/i386.c (legitimate_constant_p): For Darwin,
accept {LABEL | SYMBOL}_REF - SYMBOL_REF-FOR-PICBASE as a constant
expression.
Index: i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.696
diff -u -p -r1.696 i386.c
--- i386.c 20 Jul 2004 12:25:51 -0000 1.696
+++ i386.c 21 Jul 2004 00:23:58 -0000
@@ -5896,6 +5896,19 @@ legitimate_constant_p (rtx x)
if (GET_CODE (inner) == PLUS
&& tls_symbolic_operand (XEXP (inner, 0), Pmode))
return false;
+
+ /* Allow {LABEL | SYMBOL}_REF - SYMBOL_REF-FOR-PICBASE for Mach-O. */
+ if (TARGET_MACHO && GET_CODE (inner) == MINUS)
+ {
+ if (GET_CODE (XEXP (inner, 0)) == LABEL_REF
+ || GET_CODE (XEXP (inner, 0)) == SYMBOL_REF)
+ if (GET_CODE (XEXP (inner, 1)) == SYMBOL_REF)
+ {
+ const char *sym_name = XSTR (XEXP (inner, 1), 0);
+ if (! strcmp (sym_name, "<pic base>"))
+ return 1;
+ }
+ }
if (GET_CODE (inner) == PLUS
|| GET_CODE (inner) == MINUS)
More information about the Gcc-patches
mailing list