Skip to content

0.30.2: __riscv_flush_icache on riscv64 Linux - #103

Merged
Sunrisepeak merged 1 commit into
mainfrom
musl-0.30.2
Nov 23, 2026
Merged

Sunrisepeak merged 1 commit into
mainfrom
musl-0.30.2

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

On riscv64 Linux the compiler lowers __builtin___clear_cache to a call to __riscv_flush_icache, which the C library defines. musl's own definition (src/linux/cache.c) is excluded for its vDSO use, so a program that performs the maintenance itself did not link: the specification's conformance suite failed with undefined symbol: __riscv_flush_icache on riscv64-linux-musl (openkal-platform 0.32.1 CI, mcpplibs/openkal-platform#44).

port/src/okm_cache.c supplies __riscv_flush_icache and its public name riscv_flush_icache on riscv64 Linux. Above openkal, instructions run only from memory openkal.exec published (okm_map.c refuses PROT_EXEC), and the implementation performs the maintenance at publication where the environment offers it (openkal-linux 0.27.1 calls the kernel's riscv_flush_icache), so the call answers success. Other targets compile the file to nothing.

The compiler makes the call for __builtin___clear_cache on riscv64 Linux, and the
C library defines it there; musl's own (src/linux/cache.c) is excluded for its
vDSO use, so a program that performs the maintenance itself, as the
specification's conformance suite does, did not link (openkal-platform 0.32.1,
riscv64-linux-musl). port/src/okm_cache.c supplies it: instructions run only from
memory openkal.exec published, and the implementation performs the maintenance
at publication, so the call answers success.
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