Skip to content

lib: newlib: Add workaround for #38258 #38261

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Sep 2, 2021

Conversation

stephanosio
Copy link
Member

For the Xtensa platforms (e.g. qemu_xtensa), the first `malloc` call
may fail if the newlib heap base address is such that the first `sbrk`
call returns a 4096-byte aligned address.

Here we add a workaround for Xtensa that allocates and immediately
frees a 16-byte memory block during initialisation so that all
subsequent `malloc` calls succeed.

This commit needs to be reverted once the issue #38258 is fixed.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>

Fixes #38234.

Workaround for #38258.

For the Xtensa platforms (e.g. qemu_xtensa), the first `malloc` call
may fail if the newlib heap base address is such that the first `sbrk`
call returns a 4096-byte aligned address.

Here we add a workaround for Xtensa that allocates and immediately
frees a 16-byte memory block during initialisation so that all
subsequent `malloc` calls succeed.

This commit needs to be reverted once the issue zephyrproject-rtos#38258 is fixed.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
@stephanosio stephanosio requested a review from nashif as a code owner September 2, 2021 13:56
@github-actions github-actions bot added the area: C Library C Standard Library label Sep 2, 2021
@stephanosio stephanosio added area: newlib Newlib C Standard Library area: Xtensa Xtensa Architecture Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc. labels Sep 2, 2021
@stephanosio
Copy link
Member Author

[19/20]
INFO    -  60/185 qemu_xtensa               tests/lib/newlib/thread_safety/libraries.libc.newlib.thread_safety PASSED (qemu 2.063s)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area: C Library C Standard Library area: newlib Newlib C Standard Library area: Xtensa Xtensa Architecture Hotfix Fix for issues blocking development, i.e. CI issues, tests failing in CI, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newlib retargetable lock init fails on qemu_xtensa
3 participants