-
Notifications
You must be signed in to change notification settings - Fork 157
Using strncpy in full newlibc missbehave on ARC platform. #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Also broken in picolibc when using the speed-optimized path. |
Proposed fix here: picolibc/picolibc#969 |
@keith-packard : Thanks for the quick response! I'm not sure how this work. Will you upstream your changes to newlibc, and then later Zephyr toolchain pickup a new version of newlibc? Or what is the workflow? |
I'm not sure what newlib will do as they don't directly support Zephyr. Can you use picolibc for your application? |
I need the full libc, so I need the precompiled libc that comes with the toolchain. |
Picolibc does come with the Zephyr toolchain, is that version causing you the performance issues mentioned above? Do you need a speed-optimized variant? If so, you can use the picolibc module for Zephyr, which builds the C library along with your application. If you need libstdc++ as well, then you'd need zephyrproject-rtos/zephyr#80762 which builds that library as a module as well. |
Yes I need libstdc++ and the speed optimised path. I'm not sure how much extra time this will add to our build pipeline. We are building a bunch of different flavours, so if the CI pipeline take much longer there will be complains. |
I've got a pending PR, #821, which builds both -Os and -O2 versions of every library using the existing GCC multilib code patched to allow optimization to be used as a multilib flag. Maybe we can get that moved along? |
strncpy on ARC platform
When building c++ application for ARC em platform and using full newlibc (CONFIG_REQUIRES_FULL_LIBCPP=y, CONFIG_NEWLIB_LIBC=y). strncpy don't copy some string length correctly. It copies to little characters.
arc_em : strncpy copies string with len 23-30 incorrect.
arc_hs : strncpy copies string with len 23-39 incorrect.
The error only show up when using the full version of newlibc. Tested on sdk version 0.16.5-1 & 0.17.0
Repo
I created a small c++ sample to show the error.
The text was updated successfully, but these errors were encountered: