Skip to content

Commit 86b9dc2

Browse files
committed
Disable LTO and static stacks for all crt builtins
These functions can be called from floating point builtins, which violates the implicit attribute leaf on them. The floating point builtins shouldn't be brought in summarily to LTO, since they may reserve ZP and static stack space even if unused. The same logic broadly applies to all CRT builtins, so until we have a better solution, pull all of them out of LTO.
1 parent a5e0a1c commit 86b9dc2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mos-platform/common/crt/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ add_platform_library(common-crt
1111
shift.cc
1212
rotate.cc
1313
)
14-
# Don't pull in stack pointer init unnecessarily.
15-
# This can be called in an interrupt.
16-
set_property(SOURCE divmod-large.cc PROPERTY COMPILE_OPTIONS -fno-lto -fno-static-stack)
14+
15+
# Disable LTO for builtins since they may otherwise take up ZP and static
16+
# spance even if unused. Disable static stacks, since they are not LTOed, and
17+
# they may be called within interrupts.
18+
target_compile_options(common-crt PRIVATE -fno-lto -fno-static-stack)
1719

1820
# Merge the builtins library from llvm-mos into libcrt.
1921
get_filename_component(compiler_dir ${CMAKE_C_COMPILER} DIRECTORY)

0 commit comments

Comments
 (0)