gecko-dev/build/autoconf/frameptr.m4
Mike Hommey cdd1898856 Bug 1491236 - Always enable unwind tables on *nix r=froydnj
We were already always enabling it on builds with frame pointers on
Android. We now extend this to builds without frame pointers, helping
with client-side stacktracing for crashes.

It's also the default on many platforms, such as x86-64, whether frame
pointer are enabled or not and on x86 with GCC. Somehow, it's not the
case for x86 with clang, so this makes clang builds the same as GCC
builds in that regard.

On ARM, we were always omitting frame pointers because of a GCC bug, but
we've not been using GCC for Android builds for a long time (and the GCC
bug was actually fixed in 4.7 and backported to 4.6, making it fixed in
all versions of GCC we support).

Differential Revision: https://phabricator.services.mozilla.com/D6110

--HG--
extra : moz-landing-system : lando
2018-09-18 21:48:28 +00:00

39 lines
1.3 KiB
Plaintext

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 Set MOZ_FRAMEPTR_FLAGS to the flags that should be used for enabling or
dnl disabling frame pointers in this architecture based on the configure
dnl options
AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
if test "$GNU_CC"; then
MOZ_ENABLE_FRAME_PTR="-fno-omit-frame-pointer -funwind-tables"
MOZ_DISABLE_FRAME_PTR="-fomit-frame-pointer -funwind-tables"
else
case "$target" in
dnl Oy (Frame-Pointer Omission) is only support on x86 compilers
*-mingw32*)
MOZ_ENABLE_FRAME_PTR="-Oy-"
MOZ_DISABLE_FRAME_PTR="-Oy"
;;
esac
fi
# If we are debugging, profiling, using sanitizers, or on win32 we want a
# frame pointer. It is not required to enable frame pointers on AArch64
# Windows, but we enable it for compatibility with ETW.
if test -z "$MOZ_OPTIMIZE" -o \
-n "$MOZ_PROFILING" -o \
-n "$MOZ_DEBUG" -o \
-n "$MOZ_MSAN" -o \
-n "$MOZ_ASAN" -o \
-n "$MOZ_UBSAN" -o \
"$OS_ARCH:$CPU_ARCH" = "WINNT:x86" -o \
"$OS_ARCH:$CPU_ARCH" = "WINNT:aarch64"; then
MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
else
MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR"
fi
])