Skip to content

Truly independent web browser

Meta: Keep frame pointers on all Unix-like platforms

Jelle Raaijmakers8421e079701e
diff --git a/Meta/CMake/compile_options.cmake b/Meta/CMake/compile_options.cmake
index c431f69f3c6..062721ff5c4 100644
--- a/Meta/CMake/compile_options.cmake
+++ b/Meta/CMake/compile_options.cmake
@@ -80,6 +80,13 @@ elseif (NOT CMAKE_CROSSCOMPILING)
set(RUSTC_TARGET_CPU_FLAGS -Ctarget-cpu=native)
endif()
+# Stack walks such as the crash handler's follow frame pointers. Apple platforms keep them by default, and Windows
+# unwinds through the unwind tables its ABI requires instead, so only other platforms need to ask for them.
+if (NOT APPLE AND NOT WIN32)
+ add_cxx_compile_options(-fno-omit-frame-pointer)
+ set(RUSTC_TARGET_FRAME_POINTER_FLAGS -Cforce-frame-pointers=yes)
+endif()
+
add_cxx_compile_options(-Wcast-qual)
add_cxx_compile_options(-Wformat=2)
add_cxx_compile_options(-Wimplicit-fallthrough)
@@ -304,7 +311,3 @@ if (ENABLE_LAGOM_COVERAGE_COLLECTION)
"Collecting code coverage is unsupported in this configuration.")
endif()
endif()
-
-if (ENABLE_FUZZERS)
- add_cxx_compile_options(-fno-omit-frame-pointer)
-endif()
diff --git a/Meta/CMake/rust_crate.cmake b/Meta/CMake/rust_crate.cmake
index a1ce4e6f451..582e40c3907 100644
--- a/Meta/CMake/rust_crate.cmake
+++ b/Meta/CMake/rust_crate.cmake
@@ -1,7 +1,7 @@
set_property(GLOBAL PROPERTY JOB_POOLS "${JOB_POOLS};cargo=1")
# Compiler flags shared by Rust libraries, binaries, and tests.
-set(RUSTC_TARGET_FLAGS -Dwarnings ${RUSTC_TARGET_CPU_FLAGS})
+set(RUSTC_TARGET_FLAGS -Dwarnings ${RUSTC_TARGET_CPU_FLAGS} ${RUSTC_TARGET_FRAME_POINTER_FLAGS})
list(JOIN RUSTC_TARGET_FLAGS " " RUSTC_TARGET_FLAGS)
# import_rust_crate(MANIFEST_PATH path/to/Cargo.toml CRATE_NAME name [PANIC_UNWIND] [NO_DEFAULT_FEATURES]