Skip to content

[libc] Add stack-checking alloca for GCC/IA16#2124

Merged
ghaerr merged 1 commit intomasterfrom
ia16
Dec 6, 2024
Merged

[libc] Add stack-checking alloca for GCC/IA16#2124
ghaerr merged 1 commit intomasterfrom
ia16

Conversation

@ghaerr
Copy link
Copy Markdown
Owner

@ghaerr ghaerr commented Dec 6, 2024

Adds stack-overflow checking alloca to GCC/IA16 for ELKS. This allows alloca to be safely used in ia16-elf-gcc projects without fear of stack overflow. Some tools in 8086-toolchain will be updated after this is committed.

This version of alloca will check for protected stack remaining for the allocation, and if there isn't enough, the message "ALLOCA FAIL, INCREASE STACK" will be displayed, and alloca will return NULL.

Similar to #2123.

Next steps will be to provide standard stack overflow checking in every function call as well as malloc, for both GCC/IA16 and OWC. This will help developers writing more complex programs, such as those in 8086-toolchain, to know when the stack or heap areas are too small, instead of the application just crashing.

@ghaerr ghaerr merged commit 156dbc5 into master Dec 6, 2024
@ghaerr ghaerr deleted the ia16 branch December 6, 2024 04:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant