Skip to content

[ATfE] Cherrypick libc fixes for ATfE 22 release#693

Merged
voltur01 merged 5 commits intoarm:release/arm-software/22.xfrom
voltur01:cherrypick_libc_fixes_2
Jan 22, 2026
Merged

[ATfE] Cherrypick libc fixes for ATfE 22 release#693
voltur01 merged 5 commits intoarm:release/arm-software/22.xfrom
voltur01:cherrypick_libc_fixes_2

Conversation

@voltur01
Copy link
Contributor

This applies the following changes to 22.x release branch:

#667
[ATfE] Use semihosting SYS_READC for stdin with llvm libc

#676
[ATfE] Remove LLVM_LIBC define workaround for libcxx

#678
[ATfE] Replace call to abort with __llvm_libc_exit in libc startup code

#679
[ATfE] Update comment about handling cleanup for exit()

#683
[ATfE] Provide nohost init and exit in llvmlibc startup code

Semihosting SYS_READ call on stdin just returns immediately indicating
no data was read, thus rendering stdin unusable with QEMU.

SYS_READC blocks and waits for one symbol to be read from the terminal,
however Enter key specifically is returned as '\r', thus the special
case (that may not generalize well beyond QEMU).

(cherry picked from commit b407fd6)
After llvm/llvm-project#174967
RUNTIMES_USE_LIBC=llvm-libc option provides all necessary defines for
libcxx to work with LLVM libc.

(cherry picked from commit 227f790)
…de (arm#678)

LLVM libc does not provide a way to redefine abort(), thus the local
abort() definition in LLVM libc semihosting has to be removed.

Calls to abort() in LLVM libc crt0 replaced with __llvm_libc_exit()
which is the LLVM libc defined platform specific exit handler.

This prevents exception handlers from crashing because of the trap
instruction in LLVM libc implementation of abort().

(cherry picked from commit 6859f67)
This removes the TODO comment to implement cleanup like calling cxa_finalize.

It was confirmed and captured in the updated comment that this is already done by LLVM libc's exit() implementation.

(cherry picked from commit 3872774)
Provide init and exit handlers for not hosted environments in llvm libc
crt0.

Update the documentation accordingly.

Update the UART sample to make use of the symbols provided in crt0 and
refine the comments for the remaining symbols related to IO retargeting.

(cherry picked from commit ab657ec)
@voltur01 voltur01 requested a review from a team as a code owner January 21, 2026 16:48
@voltur01 voltur01 merged commit f54c718 into arm:release/arm-software/22.x Jan 22, 2026
2 checks passed
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.

3 participants