]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Check for .code16 support
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 24 Dec 2013 00:17:34 +0000 (01:17 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Tue, 24 Dec 2013 00:17:34 +0000 (01:17 +0100)
configure.ac

index b25304f4246bdb9ba603cb4cee6ec5bcf2928601..d66c9fbfc8c70ef01d10d0da5e29b915d7a90015 100644 (file)
@@ -538,12 +538,33 @@ AC_COMPILE_IFELSE(
 # on arm clang doesn't support .arch directive
 # on mips clang doesn't support privilegied instructions, doubleword store/load
 # and crashes with hand-written assembly
-if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
-   || test "x$target_cpu" = xx86_64 || test "x$target_cpu" = xarm \
+if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xarm \
    || test "x$target_cpu" = xmips || test "x$target_cpu" = xmipsel ); then
    TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
 fi
 
+if test "x$grub_cv_cc_target_clang" = xyes && ( test "x$target_cpu" = xi386 \
+   || test "x$target_cpu" = xx86_64  ); then
+AC_CACHE_CHECK([if clang can handle .code16], [grub_cv_cc_target_clang_code16]
+[
+CFLAGS="$TARGET_CCASFLAGS"
+AC_COMPILE_IFELSE(
+[AC_LANG_PROGRAM([], [[
+   asm volatile (".code16\n"
+                 "xorw %ax, %ax\n"
+#ifdef __x86_64__
+                ".code64\n"
+#else
+                ".code32\n"
+#endif
+                 );
+]])],
+[grub_cv_cc_target_clang_code16=yes], [grub_cv_cc_target_clang_code16=no])])
+   if test x$grub_cv_cc_target_clang_code16 = xno ; then
+     TARGET_CCASFLAGS="$TARGET_CCASFLAGS -no-integrated-as"
+   fi
+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]
 [