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
WASI,libc: fix libstd with wasi-libc linkage, and enable tests. #9227
Conversation
036e093
to
5acf48a
Compare
finally resolved the symbol issue but weird.. I see "the number of locals exceeds the minimum".. look into this now though it looks like a calling convention mismatch..
|
OK a bit of progress.. looks like linking with libc has not succeeded yet.
|
looks like we have to remove |
OK now const std = @import("std");
pub fn main() void {
std.debug.print("hello with libc!", .{});
} |
f65537c
to
cf25c52
Compare
@kubkon I believe this is ready for review. I would appreciate it if you could have a chance to take a look! :) |
31f2b8f
to
18557e8
Compare
Almost there, but the fs tests haven't passed yet. I guess something to do with preopens, but couldn't figure out yet... |
OK finally passes all the tests locally...🤞 |
OK I believe everything works now after rebasing 😄 hope all the tests would pass again 🤞 |
OK I did a bit of research on wasm-ld behavior on wasm-import-module and wasm-import-name attributes, and other frontend's behavior.. I found that the root cause of linktime symbol mismatch and maybe I could reduce the amount of change (mostly due to the workaround for it) here. Will work on a separate PR in next few days. |
#9279 will reduce the fair amount of change in this PR. |
rebased on #9279 . |
If you don't mind, I'll convert this PR into a draft since it's blocked by #9279 so that we don't merge it prematurely. |
Right, thanks for doing that for me! |
@mathetake could you rebase/merge against master given that #9279 is now merged, and mark the PR as ready for review (if you still feel it's ready ofc!)? |
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
d0427f1
to
1e20a62
Compare
@kubkon I've just made this for ready again:) Thanks! |
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the previous set of suggestions, and I apologise for not spending more time on reviewing this PR earlier. Anyway, looks good! I've just got a final set of changes I'd like you to incorporate and we should be ready to merge!
if (builtin.target.os.tag != .wasi) { | ||
if (!has_flock_open_flags and flags.lock != .None) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (builtin.target.os.tag != .wasi) { | |
if (!has_flock_open_flags and flags.lock != .None) { | |
if (!has_flock_open_flags and flags.lock != .None and builtin.target.os.tag != .wasi) { |
I think we can put all checks in one if
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is a little bit trick.. we need to remove out this if block since since the expression is not compiltime-known, and WASI doesn't have os.flock
that's why I put the OS check prior to the if block. Added comment about this: 68617c9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha, makes sense!
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Thanks @kubkon always! I hope I addressed all your comments:) |
This PR modifies libstd for WASI + wasi-libc target, and resolves #8845