Bug 788276 - Properly check for broken (deprecated) compilers. r=gps.
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Wed, 12 Sep 2012 14:48:16 -0400
changeset 106932 b68926c02a8378f4005d94bfc5fdcf7e5b39640d
parent 106931 272eede695e40d2b52a657ac0433485cbca60917
child 106933 c3590f5e7e1fead463d93538ddb7b2e82426a371
push id1075
push uservporof@mozilla.com
push dateThu, 13 Sep 2012 10:46:49 +0000
treeherderfx-team@f39786e8364d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs788276
milestone18.0a1
Bug 788276 - Properly check for broken (deprecated) compilers. r=gps. Check for old versions of llvm.
aclocal.m4
build/autoconf/llvm-pr8927.m4
configure.in
js/src/aclocal.m4
js/src/build/autoconf/llvm-pr8927.m4
js/src/configure.in
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -12,16 +12,17 @@ builtin(include, build/autoconf/pkg.m4)d
 builtin(include, build/autoconf/codeset.m4)dnl
 builtin(include, build/autoconf/altoptions.m4)dnl
 builtin(include, build/autoconf/mozprog.m4)dnl
 builtin(include, build/autoconf/mozheader.m4)dnl
 builtin(include, build/autoconf/mozcommonheader.m4)dnl
 builtin(include, build/autoconf/acwinpaths.m4)dnl
 builtin(include, build/autoconf/lto.m4)dnl
 builtin(include, build/autoconf/gcc-pr49911.m4)dnl
+builtin(include, build/autoconf/llvm-pr8927.m4)dnl
 builtin(include, build/autoconf/frameptr.m4)dnl
 builtin(include, build/autoconf/compiler-opts.m4)dnl
 builtin(include, build/autoconf/expandlibs.m4)dnl
 builtin(include, build/autoconf/arch.m4)dnl
 builtin(include, build/autoconf/android.m4)dnl
 builtin(include, build/autoconf/zlib.m4)dnl
 builtin(include, build/autoconf/linux.m4)dnl
 
new file mode 100644
--- /dev/null
+++ b/build/autoconf/llvm-pr8927.m4
@@ -0,0 +1,52 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Check if the compiler suffers from http://llvm.org/pr8927. If so, ask the
+dnl user to upgrade.
+
+AC_DEFUN([MOZ_LLVM_PR8927],
+[
+AC_MSG_CHECKING(for llvm pr8927)
+ac_have_llvm_pr8927="no"
+AC_LANG_SAVE
+AC_LANG_C
+
+_SAVE_CFLAGS=$CFLAGS
+CFLAGS="-O2"
+AC_TRY_RUN([
+struct foobar {
+  int x;
+};
+static const struct foobar* foo() {
+  static const struct foobar d = { 0 };
+  return &d;
+}
+static const struct foobar* bar() {
+  static const struct foobar d = { 0 };
+  return &d;
+}
+__attribute__((noinline)) int zed(const struct foobar *a,
+                                  const struct foobar *b) {
+  return a == b;
+}
+int main() {
+  return zed(foo(), bar());
+}
+], true,
+   ac_have_llvm_pr8927="yes",
+   true)
+CFLAGS="$_SAVE_CFLAGS"
+
+AC_LANG_RESTORE
+
+if test "$ac_have_llvm_pr8927" = "yes"; then
+   AC_MSG_RESULT(yes)
+   echo This compiler would miscompile firefox, plase upgrade.
+   echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites
+   echo for more information.
+   exit 1
+else
+   AC_MSG_RESULT(no)
+fi
+])
--- a/configure.in
+++ b/configure.in
@@ -2939,16 +2939,17 @@ fi         # GNU_CC
 if test "$SOLARIS_SUNPRO_CC"; then
 VISIBILITY_FLAGS='-xldscope=hidden'
 fi         # Sun Studio on Solaris
 
 AC_SUBST(WRAP_SYSTEM_INCLUDES)
 AC_SUBST(VISIBILITY_FLAGS)
 
 MOZ_GCC_PR49911
+MOZ_LLVM_PR8927
 
 dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
 dnl ========================================================
 if test "$GNU_CC"; then
   CFLAGS_save="${CFLAGS}"
   CFLAGS="${CFLAGS} -Werror"
   AC_CACHE_CHECK(for __force_align_arg_pointer__ attribute,
                  ac_cv_force_align_arg_pointer,
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -11,16 +11,17 @@ builtin(include, build/autoconf/nspr.m4)
 builtin(include, build/autoconf/altoptions.m4)dnl
 builtin(include, build/autoconf/moznbytetype.m4)dnl
 builtin(include, build/autoconf/mozprog.m4)dnl
 builtin(include, build/autoconf/mozheader.m4)dnl
 builtin(include, build/autoconf/mozcommonheader.m4)dnl
 builtin(include, build/autoconf/acwinpaths.m4)dnl
 builtin(include, build/autoconf/lto.m4)dnl
 builtin(include, build/autoconf/gcc-pr49911.m4)dnl
+builtin(include, build/autoconf/llvm-pr8927.m4)dnl
 builtin(include, build/autoconf/frameptr.m4)dnl
 builtin(include, build/autoconf/compiler-opts.m4)dnl
 builtin(include, build/autoconf/expandlibs.m4)dnl
 builtin(include, build/autoconf/arch.m4)dnl
 builtin(include, build/autoconf/android.m4)dnl
 builtin(include, build/autoconf/zlib.m4)dnl
 builtin(include, build/autoconf/linux.m4)dnl
 
new file mode 100644
--- /dev/null
+++ b/js/src/build/autoconf/llvm-pr8927.m4
@@ -0,0 +1,52 @@
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Check if the compiler suffers from http://llvm.org/pr8927. If so, ask the
+dnl user to upgrade.
+
+AC_DEFUN([MOZ_LLVM_PR8927],
+[
+AC_MSG_CHECKING(for llvm pr8927)
+ac_have_llvm_pr8927="no"
+AC_LANG_SAVE
+AC_LANG_C
+
+_SAVE_CFLAGS=$CFLAGS
+CFLAGS="-O2"
+AC_TRY_RUN([
+struct foobar {
+  int x;
+};
+static const struct foobar* foo() {
+  static const struct foobar d = { 0 };
+  return &d;
+}
+static const struct foobar* bar() {
+  static const struct foobar d = { 0 };
+  return &d;
+}
+__attribute__((noinline)) int zed(const struct foobar *a,
+                                  const struct foobar *b) {
+  return a == b;
+}
+int main() {
+  return zed(foo(), bar());
+}
+], true,
+   ac_have_llvm_pr8927="yes",
+   true)
+CFLAGS="$_SAVE_CFLAGS"
+
+AC_LANG_RESTORE
+
+if test "$ac_have_llvm_pr8927" = "yes"; then
+   AC_MSG_RESULT(yes)
+   echo This compiler would miscompile firefox, plase upgrade.
+   echo see http://developer.mozilla.org/en-US/docs/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites
+   echo for more information.
+   exit 1
+else
+   AC_MSG_RESULT(no)
+fi
+])
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2522,16 +2522,17 @@ fi         # GNU_CC
 if test "$SOLARIS_SUNPRO_CC"; then
 VISIBILITY_FLAGS='-xldscope=hidden'
 fi         # Sun Studio on Solaris
 
 AC_SUBST(WRAP_SYSTEM_INCLUDES)
 AC_SUBST(VISIBILITY_FLAGS)
 
 MOZ_GCC_PR49911
+MOZ_LLVM_PR8927
 
 dnl Checks for header files.
 dnl ========================================================
 AC_HEADER_DIRENT
 case "$target_os" in
 freebsd*)
 # for stuff like -lXshm
     CPPFLAGS="${CPPFLAGS} ${X_CFLAGS}"