Adriaan van Os wrote:
Waldek Hebisch wrote:
After that I can build the compiler proper. However I get ICE when building gcc runtime. Trying gpc on knuth3.pas (to get assembler output) give me ICE. Both ICE-s seem related to generting labels needed in PIC code...
Is this related to <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16649> ? I also found <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16557>. I will try the patches included with those bug reports.
Yes, it is bug 16649. The following patch extracted from the bug report eliminated ICE. I still get duplicate labels, but I had to skip one hunk which did not apply: --- ./config/i386/i386.c.orig Wed Mar 16 16:23:40 2005 +++ ./config/i386/i386.c Thu Jun 16 13:33:02 2005 @@ -5810,6 +5810,28 @@ return term; } + +/* Allow {LABEL | SYMBOL}_REF - SYMBOL_REF-FOR-PICBASE for Mach-O as + this is used for to form addresses to local data when -fPIC is in + use. */ + +static bool +darwin_local_data_pic (rtx disp) +{ + if (GET_CODE (disp) == MINUS) + { + if (GET_CODE (XEXP (disp, 0)) == LABEL_REF + || GET_CODE (XEXP (disp, 0)) == SYMBOL_REF) + if (GET_CODE (XEXP (disp, 1)) == SYMBOL_REF) + { + const char *sym_name = XSTR (XEXP (disp, 1), 0); + if (! strcmp (sym_name, "<pic base>")) + return true; + } + } + + return false; +} /* Determine if a given RTX is a valid constant. We already know this satisfies CONSTANT_P. */ @@ -5829,6 +5851,9 @@ x = XEXP (x, 0); } + if (TARGET_MACHO && darwin_local_data_pic (x)) + return true; + /* Only some unspecs are valid as "constants". */ if (GET_CODE (x) == UNSPEC) switch (XINT (x, 1)) @@ -5980,18 +6005,8 @@ saw_plus = true; } - /* Allow {LABEL | SYMBOL}_REF - SYMBOL_REF-FOR-PICBASE for Mach-O. */ - if (TARGET_MACHO && GET_CODE (disp) == MINUS) - { - if (GET_CODE (XEXP (disp, 0)) == LABEL_REF - || GET_CODE (XEXP (disp, 0)) == SYMBOL_REF) - if (GET_CODE (XEXP (disp, 1)) == SYMBOL_REF) - { - const char *sym_name = XSTR (XEXP (disp, 1), 0); - if (! strcmp (sym_name, "<pic base>")) - return 1; - } - } + if (TARGET_MACHO && darwin_local_data_pic (disp)) + return 1; if (GET_CODE (disp) != UNSPEC) return 0; -- Waldek Hebisch hebisch@math.uni.wroc.pl