Skip to content

arch/risc-v: add missing CMake support for standalone ELF applications - #19695

Open
raiden00pl wants to merge 1 commit into
apache:masterfrom
raiden00pl:riscv-cmake-kernel
Open

arch/risc-v: add missing CMake support for standalone ELF applications#19695
raiden00pl wants to merge 1 commit into
apache:masterfrom
raiden00pl:riscv-cmake-kernel

Conversation

@raiden00pl

Copy link
Copy Markdown
Member

Summary

The CMake build had no STARTUP_OBJS (crt0) target and no elf.cmake, so applications were linked without crt0 and without '-e _start': the ELF entry defaulted to main and applications crashed on exit returning to a NULL address.

Add STARTUP_OBJS and elf.cmake with the LDELFFLAGS equivalents from Toolchain.defs, following the other architectures.

Impact

fix broken ELF apps with cmake

Testing

automate tests with ntfc for kernel build

The CMake build had no STARTUP_OBJS (crt0) target and no elf.cmake, so
applications were linked without crt0 and without '-e _start': the ELF
entry defaulted to main and applications crashed on exit returning to
a NULL address.

Add STARTUP_OBJS and elf.cmake with the LDELFFLAGS equivalents from
Toolchain.defs, following the other architectures.

Signed-off-by: raiden00pl <raiden00@railab.me>
Assisted-by: Claude Code
@github-actions github-actions Bot added Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: S The size of the change in this PR is small labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

hifive1-revb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant