Skip to content

Commit 5438ec4

Browse files
committed
Fix static stack semantics for libcalls; cleanup LTO.
1 parent 589047b commit 5438ec4

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

mos-platform/atari8/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ merge_libraries(atari8-crt0
1111
common-zero-bss
1212
common-exit-return
1313
)
14-
target_compile_options(atari8-crt0 PRIVATE -fno-lto)
1514

1615
add_platform_library(atari8-c
1716
abort.c
@@ -22,5 +21,5 @@ add_platform_library(atari8-c
2221
target_include_directories(atari8-c SYSTEM BEFORE PUBLIC .)
2322

2423
# abort is preemptively included if LTO is used, which pulls in _exit support
25-
# unneccessarily.
26-
set_property(SOURCE abort.c PROPERTY COMPILE_FLAGS -fno-lto)
24+
# unneccessarily. It can be called in an interrupt.
25+
set_property(SOURCE abort.c PROPERTY COMPILE_OPTIONS -fno-lto -fno-static-stack)

mos-platform/commodore/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ merge_libraries(commodore-crt0
1212
common-zero-bss
1313
common-exit-return
1414
)
15-
target_compile_options(commodore-crt0 PRIVATE -fno-lto)
1615

1716
add_platform_library(commodore-c
1817
abort.c
@@ -22,6 +21,6 @@ add_platform_library(commodore-c
2221
kernal.S
2322
)
2423
# abort is preemptively included if LTO is used, which pulls in _exit support
25-
# unneccessarily.
26-
set_property(SOURCE abort.c PROPERTY COMPILE_OPTIONS -fno-lto)
24+
# unneccessarily. It can also be called in an interrupt.
25+
set_property(SOURCE abort.c PROPERTY COMPILE_OPTIONS -fno-lto -fno-static-stack)
2726
target_include_directories(commodore-c SYSTEM BEFORE PUBLIC .)

mos-platform/common/c/stdio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ int putchar(int c) {
55
return c;
66
}
77

8-
int puts(const char *s) {
8+
// This can be called by abort(), which can be called in a signal and is not
9+
// included in LTO.
10+
__attribute((interrupt, no_isr)) int puts(const char *s) {
911
for (; *s; ++s)
1012
__putchar(*s);
1113
__putchar('\n');

mos-platform/common/crt/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@ add_platform_library(common-crt
1111
shift.cc
1212
)
1313
# Don't pull in stack pointer init unnecessarily.
14-
set_property(SOURCE divmod-large.cc PROPERTY COMPILE_OPTIONS -fno-lto)
14+
# This can be called in an interrupt.
15+
set_property(SOURCE divmod-large.cc PROPERTY COMPILE_OPTIONS -fno-lto -fno-static-stack)

mos-platform/osi-c1p/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ merge_libraries(osi-c1p-crt0
1313
common-zero-bss
1414
common-exit-loop
1515
)
16-
target_compile_options(osi-c1p-crt0 PRIVATE -fno-lto)
1716

1817
add_platform_library(osi-c1p-c
1918
abort.c

mos-platform/sim/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ merge_libraries(sim-crt0
1313
common-exit-custom
1414
common-init-stack
1515
)
16-
target_compile_options(sim-crt0 PRIVATE -fno-lto)
1716

1817
add_platform_library(sim-c
1918
assert.c

0 commit comments

Comments
 (0)