frameptr.m4 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. dnl This Source Code Form is subject to the terms of the Mozilla Public
  2. dnl License, v. 2.0. If a copy of the MPL was not distributed with this
  3. dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
  4. dnl Set MOZ_FRAMEPTR_FLAGS to the flags that should be used for enabling or
  5. dnl disabling frame pointers in this architecture based on the configure
  6. dnl options
  7. AC_DEFUN([MOZ_SET_FRAMEPTR_FLAGS], [
  8. case "$target" in
  9. *android*)
  10. unwind_tables="-funwind-tables"
  11. ;;
  12. esac
  13. if test "$GNU_CC"; then
  14. MOZ_ENABLE_FRAME_PTR="-fno-omit-frame-pointer $unwind_tables"
  15. MOZ_DISABLE_FRAME_PTR="-fomit-frame-pointer"
  16. if test "$CPU_ARCH" = arm; then
  17. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54398
  18. MOZ_ENABLE_FRAME_PTR="$unwind_tables"
  19. fi
  20. else
  21. case "$target" in
  22. dnl Oy (Frame-Pointer Omission) is only support on x86 compilers
  23. *-mingw32*)
  24. MOZ_ENABLE_FRAME_PTR="-Oy-"
  25. MOZ_DISABLE_FRAME_PTR="-Oy"
  26. ;;
  27. esac
  28. fi
  29. # If we are debugging, profiling, using sanitizers, or on win32 we want a
  30. # frame pointer.
  31. if test -z "$MOZ_OPTIMIZE" -o \
  32. -n "$MOZ_PROFILING" -o \
  33. -n "$MOZ_DEBUG" -o \
  34. -n "$MOZ_MSAN" -o \
  35. -n "$MOZ_ASAN" -o \
  36. "$OS_ARCH:$CPU_ARCH" = "WINNT:x86"; then
  37. MOZ_FRAMEPTR_FLAGS="$MOZ_ENABLE_FRAME_PTR"
  38. else
  39. MOZ_FRAMEPTR_FLAGS="$MOZ_DISABLE_FRAME_PTR"
  40. fi
  41. ])