Skip to content

Commit 8d5cb4d

Browse files
[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. NixOS/nixpkgs#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
1 parent 587ba75 commit 8d5cb4d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bolt/runtime/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@ set(BOLT_RT_FLAGS
3535
-fno-exceptions
3636
-fno-rtti
3737
-fno-stack-protector
38-
-fPIC)
38+
-fPIC
39+
# Runtime currently assumes omitted frame pointers for functions marked __attribute((naked)).
40+
# Protect against distros adding -fno-omit-frame-pointer and compiling with GCC.
41+
# Refs: llvm/llvm-project#147569 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77882
42+
-fomit-frame-pointer
43+
)
3944
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
4045
set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS}
4146
-mno-sse

0 commit comments

Comments
 (0)