]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Darwin, X86, config: Adjust 'as' command lines [PR100340].
authorIain Sandoe <iain@sandoe.co.uk>
Sat, 31 Jul 2021 15:29:03 +0000 (16:29 +0100)
committerIain Sandoe <iain@sandoe.co.uk>
Wed, 13 Oct 2021 19:59:03 +0000 (20:59 +0100)
Versions of the assembler using clang from XCode 12.5/12.5.1
have a bug which produces different code layout between debug and
non-debug input, leading to a compare fail for default configure
parameters.

This is a workaround fix to disable the optimisation that is
responsible for the bug.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
PR target/100340 - Bootstrap fails with Clang 12.0.5 (XCode 12.5)

PR target/100340

gcc/ChangeLog:

* config.in: Regenerate.
* config/i386/darwin.h (EXTRA_ASM_OPTS): New
(ASM_SPEC): Pass options to disable branch shortening where
needed.
* configure: Regenerate.
* configure.ac: Detect versions of 'as' that support the
optimisation which has the bug.

(cherry picked from commit 743b8dd6fd757e997eb060d70fd4ae8e04fb56cd)

gcc/config.in
gcc/config/i386/darwin.h
gcc/configure
gcc/configure.ac

index 18db43ce4aebaf163fd661369b614766b0fd14e5..4d5da7dab3a818c884260d7edc15b5876379b38d 100644 (file)
 #endif
 
 
+/* Define if your Mac OS X assembler supports -mllvm -x86-pad-for-align=false.
+   */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN
+#endif
+
+
 /* Define if your Mac OS X assembler supports the -mmacos-version-min option.
    */
 #ifndef USED_FOR_TARGET
index c81db9bf09fcddeb691c193f615f09ff587bf5a3..e4a5cbea65786e936fa591bf10c60c0664d196c0 100644 (file)
@@ -135,10 +135,18 @@ along with GCC; see the file COPYING3.  If not see
   %{mfentry*:%eDarwin does not support -mfentry or associated options}" \
   DARWIN_CC1_SPEC
 
+/* This is a workaround for a tool bug: see PR100340.  */
+
+#ifdef HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN
+#define EXTRA_ASM_OPTS " -mllvm -x86-pad-for-align=false"
+#else
+#define EXTRA_ASM_OPTS ""
+#endif
+
 #undef ASM_SPEC
 #define ASM_SPEC "-arch %(darwin_arch) \
   " ASM_OPTIONS " -force_cpusubtype_ALL \
-  %{static}" ASM_MMACOSX_VERSION_MIN_SPEC
+  %{static}" ASM_MMACOSX_VERSION_MIN_SPEC EXTRA_ASM_OPTS
 
 #undef ENDFILE_SPEC
 #define ENDFILE_SPEC \
index 0398dedd34ea881ed8eab7888792e2322f6b289f..e84ec2e4a622848767f02d9f9f6cee7c020e8867 100755 (executable)
@@ -26919,6 +26919,41 @@ $as_echo "$as_me: WARNING: LTO for $target requires binutils >= 2.20.1, but vers
        fi
        ;;
     esac
+    case $target_os in
+       darwin2[0-9]* | darwin19*)
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for llvm assembler x86-pad-for-align option" >&5
+$as_echo_n "checking assembler for llvm assembler x86-pad-for-align option... " >&6; }
+if ${gcc_cv_as_mllvm_x86_pad_for_align+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  gcc_cv_as_mllvm_x86_pad_for_align=no
+  if test x$gcc_cv_as != x; then
+    $as_echo '.text' > conftest.s
+    if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mllvm -x86-pad-for-align=false -o conftest.o conftest.s >&5'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+    then
+       gcc_cv_as_mllvm_x86_pad_for_align=yes
+    else
+      echo "configure: failed program was" >&5
+      cat conftest.s >&5
+    fi
+    rm -f conftest.o conftest.s
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_mllvm_x86_pad_for_align" >&5
+$as_echo "$gcc_cv_as_mllvm_x86_pad_for_align" >&6; }
+if test $gcc_cv_as_mllvm_x86_pad_for_align = yes; then
+
+$as_echo "#define HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN 1" >>confdefs.h
+
+fi
+
+       ;;
+    esac
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -xbrace_comment" >&5
 $as_echo_n "checking assembler for -xbrace_comment... " >&6; }
index 1b31a246ae48614c1d76a98c42440d8424f7cade..bd37d47f4a1d04f82c6ee8771a8c484b0d431654 100644 (file)
@@ -4729,6 +4729,15 @@ foo:     nop
        fi
        ;;
     esac
+    case $target_os in
+       darwin2[[0-9]]* | darwin19*)
+        gcc_GAS_CHECK_FEATURE([llvm assembler x86-pad-for-align option],
+          gcc_cv_as_mllvm_x86_pad_for_align,,
+          [-mllvm -x86-pad-for-align=false], [.text],,
+          [AC_DEFINE(HAVE_AS_MLLVM_X86_PAD_FOR_ALIGN, 1,
+           [Define if your Mac OS X assembler supports -mllvm -x86-pad-for-align=false.])])
+       ;;
+    esac
 
     gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment,,
       [-xbrace_comment=no], [.text],,