Fix UEFI compilation for cranelift-jit#12602
Fix UEFI compilation for cranelift-jit#12602RossComputerGuy wants to merge 1 commit intobytecodealliance:mainfrom
Conversation
be76ea8 to
9dfe34e
Compare
9dfe34e to
e2d65a8
Compare
It seems the example crashes in UEFI. May need help figuring this problem out. |
|
@RossComputerGuy thanks for the PR. Unfortunately I don't think there is much that we can go on regarding your observed crash. The quoted log shows normal compilation followed by "synchronous exception", nothing in-between, and you've told us nothing about your environment or what you're trying to do. I can make some educated guesses -- e.g., have you set pages to have execute permission? Is that a thing in your environment (do you have paging enabled)? Are you properly managing other requirements of the ABI (e.g. stack alignment)? Does the code that you're compiling have any bugs that could result in a bad memory access? Basically, for an actionable bug report, we need: (i) information about what you're trying to do; (ii) information about what happened; (iii) information about why you believe something else should have happened; (iv) whatever investigation you've done that narrows down where this divergence is occurring, ideally pointing in the direction of a Cranelift issue. Thanks! |
|
I did narrow it down to this block: wasmtime/cranelift/jit/examples/jit-minimal.rs Lines 30 to 54 in f641800 I'll see if I can get more details. |
|
OK, thanks. That's a function body that returns |
|
Yes but isn't that block not even executing anything? I thought that's just doing codegen. I do have |
|
target-lexicon's default_calling_convention method doesn't look like it handles uefi. Maybe that is the issue? On x86_64 uefi uses the windows callconv. |
|
That is correct, however this is aarch64 that I am compiling for. |
|
Ah, I see, I thought you meant you had narrowed down the exception to the code produced by that IR emission sequence. You mean literally there is a crash in that IR emission sequence... Do you have a panic handler that can print a panic message at least? |
|
Yeah no, it doesn't even get to the point of emitting the binary. I haven't attached a panic handler but I will. I know there's also a UEFI debug protocol which should allow me to attach into the interrupt vector so hopefully I can catch exceptions and deal with them. |
Fixes enough of the errors to get cranelift-jit compiled to UEFI via:
Requires changes to
region-rsbut it hasn't been touched in 2 years. darfink/region-rs#39