-
Notifications
You must be signed in to change notification settings - Fork 2.1k
build system: use thread-safe stdio #21438
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
Changes from all commits
f69b666
2ed57cb
2623221
674dede
64c7624
3415656
4a84f6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -922,3 +922,17 @@ groups: | |
| open and solder bridges SB4, SB5 and SB6 are closed instead, SPI2 is | ||
| connected to the STMmod+/Pmod connector. Request this feature to use | ||
| SPI2 with this board configuration. | ||
|
|
||
| - title: Bugs in hardware, toolchain, or binary blobs | ||
| help: This allows modelling bugs found in boards, so that workarounds can | ||
| be enabled for affected builds by inspecting "FEATURES_USED". Any | ||
| feature prefixed with "bug_" provided in a build will always be used, | ||
| regardless of build configuration. | ||
| features: | ||
| - name: bug_newlib_broken_stdio | ||
| help: newlib's stdio is not inherently thread-safe, but depends on the | ||
| reentrancy hooks to be provided for correct operation. When | ||
|
Comment on lines
+933
to
+934
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What exactly is the reason we cannot provide such reentrancy hooks for newlib in RIOT?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We actually could provide reentrancy hooks (just nobody did so yet). There even is a stale PR somewhere for it. But that will be a hard sell unless it is opt-in due to the large RAM requirements (per thread!) it has. (The stale PR adds an opt-in module for reentrant newlib, if I recall correctly.) The main reason people enable reentrancy in newlib is to have Reentrancy would also give you thread safety for a number of other standard C lib functions that operate on shared resources, but those are rarely ever used in the context of RIOT. (E.g. our VFS system fully bypasses the standard C lib anyway.) Once we have thread-safe stdio, there will be few use cases that would actually benefit from reentrancy, and some might rather rework the code than to pay the per-thread RAM overhead of newlib's reentrancy mechanism.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, thanks for the explanation! Would be great to have this noted down somewhere in the documentation for future reference, but I can't even find pages on neither Would you be up for writing out some bits in a follow-up PR? |
||
| reentrancy is not enabled, using newlib's stdio is racy, causing | ||
| random crashes at runtime. Use of this feature will cause an | ||
| alternative stdio implementation to be used if (and only if) newlib | ||
| is used as standard c lib. | ||
maribu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.