Skip to content

avr: provide errno storage - #208

Open
Firat17aze wants to merge 1 commit into
EmbLinkOs:mainfrom
Firat17aze:fix/avr-errno-storage
Open

Firat17aze wants to merge 1 commit into
EmbLinkOs:mainfrom
Firat17aze:fix/avr-errno-storage

Conversation

@Firat17aze

Copy link
Copy Markdown

Fixes #206.

AVR firmware uses the shared <errno.h>, where errno calls __errno_location, but the AVR-only libc archive had no implementation. Any read or write therefore left an undefined symbol at link time.

This adds one program-wide value for AVR, documents that runtime model, and extends the existing AVR libc test to write and read errno at both -O0 and -Os.

Validation:

  • make rt-embedded
  • PATH=/opt/homebrew/opt/llvm/bin:$PATH sh tests/golden/avr-libc-run.sh — passed on QEMU ATmega328P at -O0 and -Os, including archive-isolation checks
  • git diff --check — passed
  • make check — started from a clean host-library build, but stopped after nine minutes during the unrelated serial x86-64 libc build; no failure had occurred and the execution suite had not started

No physical AVR board was available; validation was limited to the repository’s QEMU ATmega328P harness.

LLMs were used for review and code generation in some parts of this pull request.

AVR programs include the shared errno header, which calls __errno_location, but the AVR-only libc archive did not define it. A read or write of errno therefore left firmware with an undefined symbol.

Add one program-wide value for the single-threaded AVR runtime and exercise it in the AVR libc QEMU test at -O0 and -Os.

Validation: make rt-embedded; PATH=/opt/homebrew/opt/llvm/bin:$PATH sh tests/golden/avr-libc-run.sh. The latter failed to link before this change and passes on QEMU after it.

This branch has not been deployed

No deployments
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.

avr: errno does not link: __errno_location is not in the C library

1 participant