Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 762071 - JS is being compiled with exceptions enabled. r=khuey.
  • Loading branch information
cixtor committed Jun 8, 2012
1 parent 7aa1559 commit ae42c5d
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 65 deletions.
28 changes: 27 additions & 1 deletion build/autoconf/compiler-opts.m4
Expand Up @@ -52,8 +52,34 @@ esac
fi
])

dnl ============================================================================
dnl C++ rtti
dnl We don't use it in the code, but it can be usefull for debugging, so give
dnl the user the option of enabling it.
dnl ============================================================================
AC_DEFUN([MOZ_RTTI],
[
MOZ_ARG_ENABLE_BOOL(cpp-rtti,
[ --enable-cpp-rtti Enable C++ RTTI ],
[ _MOZ_USE_RTTI=1 ],
[ _MOZ_USE_RTTI= ])
if test -z "$_MOZ_USE_RTTI"; then
if test "$GNU_CC"; then
CXXFLAGS="$CXXFLAGS -fno-rtti"
else
case "$target" in
*-mingw*)
CXXFLAGS="$CXXFLAGS -GR-"
esac
fi
fi
])

dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS],
[
MOZ_RTTI
if test "$CLANG_CXX"; then
## We disable return-type-c-linkage because jsval is defined as a C++ type but is
## returned by C functions. This is possible because we use knowledge about the ABI
Expand All @@ -64,7 +90,7 @@ fi
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions"
fi
dnl ========================================================
Expand Down
2 changes: 0 additions & 2 deletions config/autoconf.mk.in
Expand Up @@ -315,8 +315,6 @@ MOZ_OPTIMIZE_SIZE_TWEAK = @MOZ_OPTIMIZE_SIZE_TWEAK@

MOZ_ALLOW_HEAP_EXECUTE_FLAGS = @MOZ_ALLOW_HEAP_EXECUTE_FLAGS@

MOZ_RTTI_FLAGS_ON = @_MOZ_RTTI_FLAGS_ON@

PROFILE_GEN_CFLAGS = @PROFILE_GEN_CFLAGS@
PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@
PROFILE_USE_CFLAGS = @PROFILE_USE_CFLAGS@
Expand Down
44 changes: 9 additions & 35 deletions configure.in
Expand Up @@ -723,8 +723,6 @@ case "$target" in
AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi

_MOZ_RTTI_FLAGS_ON='-GR'
_MOZ_RTTI_FLAGS_OFF='-GR-'
AC_DEFINE(HAVE_SEH_EXCEPTIONS)

if test -n "$WIN32_REDIST_DIR"; then
Expand Down Expand Up @@ -1706,8 +1704,6 @@ if test "$GNU_CC"; then
AC_TRY_LINK(,,AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no])
LDFLAGS=$_SAVE_LDFLAGS)
_MOZ_RTTI_FLAGS_ON=-frtti
_MOZ_RTTI_FLAGS_OFF=-fno-rtti

# Check for -mssse3 on $CC
AC_MSG_CHECKING([for -mssse3 option to $CC])
Expand Down Expand Up @@ -2867,6 +2863,7 @@ if test -z "$COMPILE_ENVIRONMENT"; then
SKIP_LIBRARY_CHECKS=1
fi

MOZ_COMPILER_OPTS
if test -z "$SKIP_COMPILER_CHECKS"; then
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ========================================================
Expand Down Expand Up @@ -2997,42 +2994,21 @@ else
AC_MSG_RESULT(no)
fi

dnl ========================================================
dnl C++ rtti
dnl Should be smarter and check that the compiler does indeed have rtti
dnl ========================================================

MOZ_ARG_ENABLE_BOOL(cpp-rtti,
[ --enable-cpp-rtti Enable C++ RTTI ],
[ _MOZ_USE_RTTI=1 ],
[ _MOZ_USE_RTTI= ])

if test "$_MOZ_USE_RTTI"; then
_MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
else
_MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
fi

AC_SUBST(_MOZ_RTTI_FLAGS_ON)

dnl Check whether we can use gcc's c++0x mode
AC_LANG_CPLUSPLUS

if test "$GNU_CXX"; then
_SAVE_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -std=gnu++0x"

if test -z "$_MOZ_USE_RTTI"; then
CXXFLAGS="$CXXFLAGS $_MOZ_RTTI_FLAGS"
AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
ac_cv_cxx0x_headers_bug,
[AC_TRY_COMPILE([#include <memory>], [],
ac_cv_cxx0x_headers_bug="no",
ac_cv_cxx0x_headers_bug="yes")])
CXXFLAGS="$_SAVE_CXXFLAGS"
if test "$ac_cv_cxx0x_headers_bug" = "no"; then
CXXFLAGS="$CXXFLAGS -std=gnu++0x"
fi
AC_CACHE_CHECK(for gcc c++0x headers bug without rtti,
ac_cv_cxx0x_headers_bug,
[AC_TRY_COMPILE([#include <memory>], [],
ac_cv_cxx0x_headers_bug="no",
ac_cv_cxx0x_headers_bug="yes")])
CXXFLAGS="$_SAVE_CXXFLAGS"
if test "$ac_cv_cxx0x_headers_bug" = "no"; then
CXXFLAGS="$CXXFLAGS -std=gnu++0x"
fi
fi

Expand Down Expand Up @@ -3230,7 +3206,6 @@ AC_SUBST(WRAP_SYSTEM_INCLUDES)
AC_SUBST(VISIBILITY_FLAGS)

MOZ_GCC_PR49911
MOZ_COMPILER_OPTS

dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
dnl ========================================================
Expand Down Expand Up @@ -8688,7 +8663,6 @@ CFLAGS=`echo \
$CFLAGS`

CXXFLAGS=`echo \
$_MOZ_RTTI_FLAGS \
$_WARNINGS_CXXFLAGS \
$CXXFLAGS`

Expand Down
28 changes: 27 additions & 1 deletion js/src/build/autoconf/compiler-opts.m4
Expand Up @@ -52,8 +52,34 @@ esac
fi
])

dnl ============================================================================
dnl C++ rtti
dnl We don't use it in the code, but it can be usefull for debugging, so give
dnl the user the option of enabling it.
dnl ============================================================================
AC_DEFUN([MOZ_RTTI],
[
MOZ_ARG_ENABLE_BOOL(cpp-rtti,
[ --enable-cpp-rtti Enable C++ RTTI ],
[ _MOZ_USE_RTTI=1 ],
[ _MOZ_USE_RTTI= ])
if test -z "$_MOZ_USE_RTTI"; then
if test "$GNU_CC"; then
CXXFLAGS="$CXXFLAGS -fno-rtti"
else
case "$target" in
*-mingw*)
CXXFLAGS="$CXXFLAGS -GR-"
esac
fi
fi
])

dnl A high level macro for selecting compiler options.
AC_DEFUN([MOZ_COMPILER_OPTS],
[
MOZ_RTTI
if test "$CLANG_CXX"; then
## We disable return-type-c-linkage because jsval is defined as a C++ type but is
## returned by C functions. This is possible because we use knowledge about the ABI
Expand All @@ -64,7 +90,7 @@ fi
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections"
CXXFLAGS="$CXXFLAGS -ffunction-sections -fdata-sections -fno-exceptions"
fi
dnl ========================================================
Expand Down
2 changes: 0 additions & 2 deletions js/src/config/autoconf.mk.in
Expand Up @@ -116,8 +116,6 @@ MOZ_PGO_OPTIMIZE_FLAGS = @MOZ_PGO_OPTIMIZE_FLAGS@
MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@
MOZ_OPTIMIZE_SIZE_TWEAK = @MOZ_OPTIMIZE_SIZE_TWEAK@

MOZ_RTTI_FLAGS_ON = @_MOZ_RTTI_FLAGS_ON@

PROFILE_GEN_CFLAGS = @PROFILE_GEN_CFLAGS@
PROFILE_GEN_LDFLAGS = @PROFILE_GEN_LDFLAGS@
PROFILE_USE_CFLAGS = @PROFILE_USE_CFLAGS@
Expand Down
25 changes: 1 addition & 24 deletions js/src/configure.in
Expand Up @@ -708,9 +708,6 @@ case "$target" in
AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi

_MOZ_RTTI_FLAGS_ON='-GR'
_MOZ_RTTI_FLAGS_OFF='-GR-'

dnl Ensure that mt.exe is 'Microsoft (R) Manifest Tool',
dnl not something else like "magnetic tape manipulation utility".
MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
Expand Down Expand Up @@ -1573,8 +1570,6 @@ if test "$GNU_CC"; then
DSO_CFLAGS=''
DSO_PIC_CFLAGS='-fPIC'
ASFLAGS="$ASFLAGS -fPIC"
_MOZ_RTTI_FLAGS_ON=-frtti
_MOZ_RTTI_FLAGS_OFF=-fno-rtti

# Turn on GNU-specific warnings:
# -Wall - turn on a lot of warnings
Expand Down Expand Up @@ -2627,6 +2622,7 @@ if test "$ENABLE_METHODJIT_TYPED_ARRAY"; then
AC_DEFINE(JS_METHODJIT_TYPED_ARRAY)
fi

MOZ_COMPILER_OPTS
if test -z "$SKIP_COMPILER_CHECKS"; then
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ========================================================
Expand Down Expand Up @@ -2896,7 +2892,6 @@ AC_SUBST(WRAP_SYSTEM_INCLUDES)
AC_SUBST(VISIBILITY_FLAGS)

MOZ_GCC_PR49911
MOZ_COMPILER_OPTS

dnl Check for __force_align_arg_pointer__ for SSE2 on gcc
dnl ========================================================
Expand Down Expand Up @@ -4537,23 +4532,6 @@ if test "$ac_cv_struct_tm_zone_tm_gmtoff" = "yes" ; then
fi
fi # ! SKIP_COMPILER_CHECKS

dnl ========================================================
dnl C++ rtti
dnl Should be smarter and check that the compiler does indeed have rtti
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(cpp-rtti,
[ --enable-cpp-rtti Enable C++ RTTI ],
[ _MOZ_USE_RTTI=1 ],
[ _MOZ_USE_RTTI= ])

if test "$_MOZ_USE_RTTI"; then
_MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_ON
else
_MOZ_RTTI_FLAGS=$_MOZ_RTTI_FLAGS_OFF
fi

AC_SUBST(_MOZ_RTTI_FLAGS_ON)

AC_DEFINE(CPP_THROW_NEW, [throw()])
AC_LANG_C

Expand Down Expand Up @@ -4786,7 +4764,6 @@ CFLAGS=`echo \
$CFLAGS`

CXXFLAGS=`echo \
$_MOZ_RTTI_FLAGS \
$_WARNINGS_CXXFLAGS \
$CXXFLAGS`

Expand Down

0 comments on commit ae42c5d

Please sign in to comment.