build/autoconf/frameptr.m4
author Carsten "Tomcat" Book <cbook@mozilla.com>
Wed, 16 Nov 2016 14:50:44 +0100
changeset 350852 5bfd79155fff3f7bef6eee90509c7167edd4b634
parent 302456 07abc6a269c9ad81d5a8e51c093f7dceba9fad02
child 356832 b419aaefae9553e2dfd6d634c62a5c5721bc0923
permissions -rw-r--r--
Backed out changeset 7d1f7dd996f7 (bug 1310845)

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], [
  case "$target" in
  *android*)
    unwind_tables="-funwind-tables"
    ;;
  esac
  if test "$GNU_CC"; then
    MOZ_ENABLE_FRAME_PTR="-fno-omit-frame-pointer $unwind_tables"
    MOZ_DISABLE_FRAME_PTR="-fomit-frame-pointer"
    if test "$CPU_ARCH" = arm; then
      # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54398
      MOZ_ENABLE_FRAME_PTR="$unwind_tables"
    fi
  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 or using sanitizers, we want a frame pointer.
  if test -z "$MOZ_OPTIMIZE" -o \
          -n "$MOZ_PROFILING" -o \
          -n "$MOZ_DEBUG" -o \
          -n "$MOZ_MSAN" -o \
          -n "$MOZ_ASAN"; then
    MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
  else
    MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR"
  fi
])