feat: weakly define forwarded syscalls #182
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR defines weak symbols for forwarded syscalls. This avoids linker errors when building Hermit without
feature = "mman"
, but still allows not compiling the respective syscalls since they might be unused at runtime.There are two alternatives to this:
not(feature = "mman")
, we could provide strong syscall symbols but stub them similar to this PR.f
symbols corresponding tosys_f
directly, completely removing the need for this kind of forwarding.This way, we would have linker errors only when applications actually use
f
, not all the time because some unused newlib symbol uses it.Other languages than C benefit from having
f
semantics available. We currently lie in the libc crate and say thatsys_f
is justf
, but this might actually lead to problems. When third-party crates callaccept
, for example, and check the return value for-1
as mandated by POSIX, we instead return-errno
, which is not what applications expect across all programming languages.Having thought about this more and having written this down, I now think that option 2 is actually the best one, though it is a bigger decision, and this PR may still prove useful until such a decision is made.
CC: @zyuiop