Hello, Everyone. Please apply attached patch to both llvm-gcc trunk & 2.0 release. Mingw32 system headers (complex.h) contains inline FP math, which causes libstdc++ configure to fail due to infinite cycle in llvm-gcc.
Attached patch workarounds this by providing replacement code and wrapping "bad" places into __NO_MATH_INLINES define, which is default for all i386 systems now. Patch just adds one new mingw32-specific fixincludes rule, which executes long sed expression doing all dirty work :)
diff -r 6cbd996d9f48 fixincludes/fixincl.x --- a/fixincludes/fixincl.x Sun May 06 09:02:00 2007 +0000 +++ b/fixincludes/fixincl.x Thu May 10 03:20:59 2007 +0400 @@ -2,11 +2,11 @@ * * DO NOT EDIT THIS FILE (fixincl.x) * - * It has been AutoGen-ed Friday July 8, 2005 at 03:33:04 PM PDT + * It has been AutoGen-ed Thursday May 10, 2007 at 03:18:13 AM MSD * From the definitions inclhack.def * and the template file fixincl */ -/* DO NOT CVS-MERGE THIS FILE, EITHER Fri Jul 8 15:33:04 PDT 2005 +/* DO NOT CVS-MERGE THIS FILE, EITHER Thu May 10 03:18:13 MSD 2007 * * You must regenerate it. Use the ./genfixes script. * @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 195 fixup descriptions. + * This file contains 196 fixup descriptions. * * See README for more information. * @@ -26,7 +26,8 @@ * * You may redistribute it and/or modify it under the terms of the * GNU General Public License, as published by the Free Software - * Foundation; either version 2, or (at your option) any later version. + * Foundation; either version 2 of the License, or (at your option) + * any later version. * * inclhack is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -34,10 +35,10 @@ * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with inclhack. See the file "COPYING". If not, - * write to: The Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * along with inclhack. If not, write to: + * The Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor + * Boston, MA 02110-1301, USA. */ /* * * * * * * * * * * * * * * * * * * * * * * * * * @@ -4050,6 +4051,43 @@ static const char* apzMath_Huge_Val_From /* * * * * * * * * * * * * * * * * * * * * * * * * * * + * Description of Mingw_Inline_Fp_Math fix + */ +tSCC zMingw_Inline_Fp_MathName[] = + "mingw_inline_fp_math"; + +/* + * File name selection pattern + */ +tSCC zMingw_Inline_Fp_MathList[] = + "|complex.h|"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzMingw_Inline_Fp_MathMachs[] = { + "i[34567]86-*-mingw*", + (const char*)NULL }; + +/* + * content selection pattern - do fix if pattern found + */ +tSCC zMingw_Inline_Fp_MathSelect0[] = + "[ \\t]*__asm__[ \\t]*\\(\\\"fpatan"; + +#define MINGW_INLINE_FP_MATH_TEST_CT 1 +static tTestDesc aMingw_Inline_Fp_MathTests[] = { + { TT_EGREP, zMingw_Inline_Fp_MathSelect0, (regex_t*)NULL }, }; + +/* + * Fix Command Arguments for Mingw_Inline_Fp_Math + */ +static const char* apzMingw_Inline_Fp_MathPatch[] = { "sed", + "-e", "/^\\#ifdef[ \\t]*__GNUC__$/,/^\\#endif[ \\t]*\\/*[ \\t]*__GNUC__[ \\t]*$/ { :ack N; /\\n[ \\t]*:/! b ack; s/\\(\\n[ \\t]*double[ \\t]*res;\\)\\n/\\1\\n#ifdef __NO_MATH_INLINES\\n res = atan((__imag__ _Z) \\/ (__real__ _Z));\\n#else\\n/; s/\\(\\n[ \\t]*float[ \\t]*res;\\)\\n/\\1\\n#ifdef __NO_MATH_INLINES\\n res = atanf((__imag__ _Z) \\/ (__real__ _Z));\\n#else\\n/; s/\\(\\n[ \\t]*long[ \\t]*double[ \\t]*res;\\)\\n/\\1\\n#ifdef __NO_MATH_INLINES\\n res = atanl((__imag__ _Z) \\/ (__real__ _Z));\\n#else\\n/; s/\\(\\\"st[(]1[)]\\\"[)];[ \\t]*\\)$/\\1\\n#endif/g }", + "-e", "s/\\(\\#include[ \\t]*<_mingw.h>\\)/\\1\\n\\#include <math.h>/", + (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * * Description of Nested_Auth_Des fix */ tSCC zNested_Auth_DesName[] = @@ -7932,9 +7970,9 @@ static const char* apzX11_SprintfPatch[] * * List of all fixes */ -#define REGEX_COUNT 234 +#define REGEX_COUNT 235 #define MACH_LIST_SIZE_LIMIT 261 -#define FIX_COUNT 195 +#define FIX_COUNT 196 /* * Enumerate the fixes @@ -8037,6 +8075,7 @@ typedef enum { MACHINE_NAME_FIXIDX, MATH_EXCEPTION_FIXIDX, MATH_HUGE_VAL_FROM_DBL_MAX_FIXIDX, + MINGW_INLINE_FP_MATH_FIXIDX, NESTED_AUTH_DES_FIXIDX, NESTED_MOTOROLA_FIXIDX, NESTED_SYS_LIMITS_FIXIDX, @@ -8623,6 +8662,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = { MATH_HUGE_VAL_FROM_DBL_MAX_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT, aMath_Huge_Val_From_Dbl_MaxTests, apzMath_Huge_Val_From_Dbl_MaxPatch, 0 }, + { zMingw_Inline_Fp_MathName, zMingw_Inline_Fp_MathList, + apzMingw_Inline_Fp_MathMachs, + MINGW_INLINE_FP_MATH_TEST_CT, FD_MACH_ONLY, + aMingw_Inline_Fp_MathTests, apzMingw_Inline_Fp_MathPatch, 0 }, + { zNested_Auth_DesName, zNested_Auth_DesList, apzNested_Auth_DesMachs, NESTED_AUTH_DES_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, diff -r 6cbd996d9f48 fixincludes/inclhack.def --- a/fixincludes/inclhack.def Sun May 06 09:02:00 2007 +0000 +++ b/fixincludes/inclhack.def Thu May 10 03:18:05 2007 +0400 @@ -2299,6 +2299,22 @@ fix = { }; +/* APPLE LOCAL begin LLVM */ +/* We need to fix complex.h not to include inline FP assembly. + * This is needed to workaround PR879 + */ +fix = { + hackname = mingw_inline_fp_math; + files = complex.h; + mach = 'i[34567]86-*-mingw*'; + select = '[ \t]*__asm__[ \t]*\(\"fpatan'; + sed = "/^\\#ifdef[ \\t]*__GNUC__$/,/^\\#endif[ \\t]*\\/*[ \\t]*__GNUC__[ \\t]*$/ { :ack N; /\\n[ \\t]*:/! b ack; s/\\(\\n[ \\t]*double[ \\t]*res;\\)\\n/\\1\\n#ifdef __NO_MATH_INLINES\\n res = atan((__imag__ _Z) \\/ (__real__ _Z));\\n#else\\n/; s/\\(\\n[ \\t]*float[ \\t]*res;\\)\\n/\\1\\n#ifdef __NO_MATH_INLINES\\n res = atanf((__imag__ _Z) \\/ (__real__ _Z));\\n#else\\n/; s/\\(\\n[ \\t]*long[ \\t]*double[ \\t]*res;\\)\\n/\\1\\n#ifdef __NO_MATH_INLINES\\n res = atanl((__imag__ _Z) \\/ (__real__ _Z));\\n#else\\n/; s/\\(\\\"st[(]1[)]\\\"[)];[ \\t]*\\)$/\\1\\n#endif/g }"; + sed = "s/\\(\\#include[ \\t]*<_mingw.h>\\)/\\1\\n\\#include <math.h>\/"; + test_text = ' __asm__ ("fpatan;"' + ' : "=t" (res) : "0" (__real__ _Z), "u" (__imag__ _Z) : "st(1)");'; +}; +/* APPLE local end LLVM */ + /* * nested comment */ diff -r 6cbd996d9f48 fixincludes/mkfixinc.sh --- a/fixincludes/mkfixinc.sh Sun May 06 09:02:00 2007 +0000 +++ b/fixincludes/mkfixinc.sh Mon May 07 13:19:01 2007 +0400 @@ -20,7 +20,6 @@ case $machine in i?86-*-moss* | \ i?86-*-pe | \ i?86-*-cygwin* | \ - i?86-*-mingw32* | \ i?86-*-uwin* | \ i?86-*-interix* | \ powerpc-*-eabiaix* | \
_______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits