Skip to content

Commit

Permalink
Bug 788276 - Properly check for broken (deprecated) compilers. r=gps.
Browse files Browse the repository at this point in the history
Check for old versions of llvm.
  • Loading branch information
cixtor committed Sep 12, 2012
1 parent 3e41736 commit 3d13bf4
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 0 deletions.
1 change: 1 addition & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ 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
Expand Down
52 changes: 52 additions & 0 deletions build/autoconf/llvm-pr8927.m4
Original file line number Diff line number Diff line change
@@ -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
])
1 change: 1 addition & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -2944,6 +2944,7 @@ 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 ========================================================
Expand Down
1 change: 1 addition & 0 deletions js/src/aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ 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
Expand Down
52 changes: 52 additions & 0 deletions js/src/build/autoconf/llvm-pr8927.m4
Original file line number Diff line number Diff line change
@@ -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
])
1 change: 1 addition & 0 deletions js/src/configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -2527,6 +2527,7 @@ AC_SUBST(WRAP_SYSTEM_INCLUDES)
AC_SUBST(VISIBILITY_FLAGS)

MOZ_GCC_PR49911
MOZ_LLVM_PR8927

dnl Checks for header files.
dnl ========================================================
Expand Down

0 comments on commit 3d13bf4

Please sign in to comment.