diff --git a/ChangeLog b/ChangeLog index 96aacf1fb..d27eaba8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-12-04 Vladimir Serbinenko + + * configure.ac: Add -no-integrated-as if {addme|ame} isn't supported. + * INSTALL: Note that GRUBwas successfully compiled with clang 3.2 for + ppc. + 2013-12-04 Vladimir Serbinenko * grub-core/kern/emu/main.c: Ignore missing prototype for main. diff --git a/INSTALL b/INSTALL index ad27f3d88..7602323b1 100644 --- a/INSTALL +++ b/INSTALL @@ -23,8 +23,8 @@ configuring the GRUB. Note: clang 3.3 or later works for mips(el) earlier versions fail to generate .reginfo and hence gprel relocations fail. - Note: clang 3.4 or later works for powerpc - earlier versions suffer from vacopy bug (#15286) + Note: clang 3.2 or later works for powerpc + earlier versions not tested Note: clang has no support for generating 64-bit sparc code and hence you can't compile GRUB for sparc64 with clang Note: clang has no support for ia64 and hence you can't compile GRUB diff --git a/configure.ac b/configure.ac index 69be355c4..c371a85b3 100644 --- a/configure.ac +++ b/configure.ac @@ -515,7 +515,9 @@ AC_CACHE_CHECK([which extra warnings work], [grub_cv_target_cc_w_extra_flags], [ TARGET_CFLAGS="$TARGET_CFLAGS $grub_cv_target_cc_w_extra_flags" AC_CACHE_CHECK([if compiling with clang], [grub_cv_cc_target_clang] -[AC_COMPILE_IFELSE( +[ +CFLAGS="$TARGET_CFLAGS" +AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([], [[ #ifdef __clang__ #error "is clang" @@ -533,6 +535,26 @@ if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \ TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" fi +if test "x$grub_cv_cc_target_clang" = xyes && test "x$target_cpu" = xpowerpc; then +AC_CACHE_CHECK([if clang can handle ame instruction], [grub_cv_cc_target_clang_ame] +[ +CFLAGS="$TARGET_CFLAGS" +AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([], [[ + unsigned int a = 0, b = 0; + asm volatile ("{ame|addme} %0,%1" : "=r" (a) : "r" (b)); + if (a) + return 1; +]])], +[grub_cv_cc_target_clang_ame=yes], [grub_cv_cc_target_clang_ame=no])]) + # clang <= 3.3 doesn't handle most of ppc assembly, not even inline assembly + # used by gcrypt + if test x$grub_cv_cc_target_clang_ame = xno ; then + TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as" + TARGET_CFLAGS="$TARGET_CCASFLAGS -no-integrated-as" + fi +fi + if test "x$target_cpu" = xi386 && test "x$platform" != xemu; then TARGET_CFLAGS="$TARGET_CFLAGS -march=i386" fi