[llvm] [BOLT] Force frame pointers off for runtimes (PR #148009)
Peter Waller via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 02:51:52 PDT 2025
https://github.com/peterwaller-arm updated https://github.com/llvm/llvm-project/pull/148009
>From 01424e27538291e11e228c17d724ea9c536ed651 Mon Sep 17 00:00:00 2001
From: Peter Waller <peter.waller at arm.com>
Date: Thu, 10 Jul 2025 18:09:55 +0100
Subject: [PATCH] [BOLT] Force frame pointers off for runtimes
Distributions are making the choice to turn frame pointers on by
default. Nixpkgs recently turned them on, and the method they use to do
so implies that everything is built with them on by default.
https://github.com/NixOS/nixpkgs/pull/399014
Assuming that a well behaved distribution doing this puts
'-fno-omit-frame-pointer' at the beginning of the compiler invocation,
we can still re-enable it by supplying -fomit-frame-pointer thereafter.
See also: #147569
Fixes: #148595
---
bolt/runtime/CMakeLists.txt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/bolt/runtime/CMakeLists.txt b/bolt/runtime/CMakeLists.txt
index 87cc44812da11..63f178bd263c2 100644
--- a/bolt/runtime/CMakeLists.txt
+++ b/bolt/runtime/CMakeLists.txt
@@ -35,7 +35,12 @@ set(BOLT_RT_FLAGS
-fno-exceptions
-fno-rtti
-fno-stack-protector
- -fPIC)
+ -fPIC
+ # Runtime currently assumes omitted frame pointers for functions marked __attribute((naked)).
+ # Protect against distros adding -fno-omit-frame-pointer and compiling with GCC.
+ # Refs: llvm/llvm-project#148595 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77882
+ -fomit-frame-pointer
+)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS}
-mno-sse
More information about the llvm-commits
mailing list