-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Windows AARCH64 Target #8247
Comments
This depends on #4992 -- a little bit of core runtime functionality (trap handling, unwind info generation) necessary for this OS/architecture pair. If you're willing to work on this, we'd be happy to review a PR! |
Thank you for linking the relevant issue; I’ll take a look and see about submitting a PR. |
I've been trying to get My work-in-progress branch is available at https://github.com/dpaoliello/wasmtime/tree/arm64wip Current, when I run
Import thing from that output is that I've tried setting the function alignment to 8: https://github.com/dpaoliello/wasmtime/blob/e7184160fe909864c767177de17729f876c0da60/cranelift/codegen/src/isa/aarch64/inst/mod.rs#L1184 And the symbol alignment to 8: But neither seems to have fixed this - any idea what I'm doing wrong? |
I think If it's not created by Cranelift this might be something where we're generating the wrong relocation against |
It's not |
Ok, I finally understand what's happening here. When emitting a call, wasmtime emits it as wasmtime/cranelift/codegen/src/isa/aarch64/abi.rs Lines 1041 to 1045 in e56ffd7
wasmtime/cranelift/codegen/src/isa/aarch64/inst/emit.rs Lines 3165 to 3185 in e56ffd7
That type of reloc needs to be 8 byte aligned, however functions (at least on Windows, not sure about other platforms) aren't guaranteed to be 8 byte aligned, thus the linker complains. When I look at code generated by LLVM, I see branch26 relocs being emitted for called functions, which seems to be generated by this: I'm not entirely sure how to handle implementing this in wasmtime with the abstraction between abi.rs and emit.rs. |
And, just to confound things, sometimes LLVM will generate a page base + page offset for a call: https://godbolt.org/z/3c7ce1vP4 |
Is there a relocation that doesn't need to be 8-byte aligned we could use? I'm a bit surprised by that godbolt link because
Here If we need these relocations to be 8-byte aligned in Cranelift it would probably look like:
I'm mostly surprised that LLVM doesn't seem to be doing anything with nops but from what you're saying it should work? |
Sorry, bit of confusion, the target of the reloc needs to be 8 byte aligned, not the reloc or consuming instruction. |
Aha that makes more sense! (I should also read more carefully...) This might be as simple as updating this value? That could perhaps have a comment for now saying only Windows so far requires 8-byte alignment but it's easier to bump all platforms to 8-byte so that's why it's unconditionally a minimum of 8 for now. |
That helps: it at least means that any function in the current compilation can be the target of a reloc. |
Oh dear sorry I'm being particularly slow at understanding this, you've already told me that historically as well... Is this perhaps something related to dllimport or something like that? Where memcpy should be imported via dllimport and some slightly different form of relocation is something the linker handles when fixing it up? Otherwise I'll probably step aside as I'm probably out of my depth here... |
Feature
Compile the C API and produce ARM64 builds for Windows
Benefit
Will unblock this issue in the wasmtime-dotnet package
Not sure if the wheel exist for this yet; in terms of infrastructure cross compilation on Github Actions should be possible, but if necessary I’m happy to deploy some new self-hosted runners to power this feature.
The text was updated successfully, but these errors were encountered: