Stream: general

Topic: ✔ Aarch64: does cranelift split function into multiple?


view this post on Zulip Adel Prokurov (Feb 13 2022 at 15:56):

So for example this: <https://gist.github.com/playXE/bcadfaefeecaf511d81f4b141ca1e1bc>. There is relatively large Cranelift IR dump but when I look at disassembly it seems that it just splits function into a few and other parts I can't see

GitHub Gist: instantly share code, notes, and snippets.

view this post on Zulip bjorn3 (Feb 13 2022 at 22:05):

Cranelift can't split functions into multiple parts. I think whatever you used for disassembling returned an incomplete disassembly. It likely chokes on the constant embedded inside the instruction stream. At address 0x1478140d0 there should be a 64 bit constant followed by the rest of the code. The branch instruction at the end of the disassembly jumps over this constant.

view this post on Zulip bjorn3 (Feb 13 2022 at 22:05):

@Adel Prokurov ^

view this post on Zulip Adel Prokurov (Feb 14 2022 at 09:06):

bjorn3 said:

Cranelift can't split functions into multiple parts. I think whatever you used for disassembling returned an incomplete disassembly. It likely chokes on the constant embedded inside the instruction stream. At address 0x1478140d0 there should be a 64 bit constant followed by the rest of the code. The branch instruction at the end of the disassembly jumps over this constant.

Thanks for the reply. I'll look into alternative disassembler then (I am using capstone at the moment)

view this post on Zulip Adel Prokurov (Feb 14 2022 at 09:13):

So I tried to use bad64 to disarm arm64 code and it works just fine. Probably capstone just does not work correctly for M1?

view this post on Zulip Notification Bot (Feb 14 2022 at 09:13):

Adel Prokurov has marked this topic as resolved.

view this post on Zulip bjorn3 (Feb 14 2022 at 11:09):

For capstone you will have to explicitly enable the skipdata option. Cranelift uses also capstone for debugging: https://github.com/bytecodealliance/wasmtime/blob/05ace6c0e24f4fd8e256edab7de841a5b28c5735/cranelift/src/disasm.rs#L96

Standalone JIT-style runtime for WebAssembly, using Cranelift - wasmtime/disasm.rs at 05ace6c0e24f4fd8e256edab7de841a5b28c5735 · bytecodealliance/wasmtime

view this post on Zulip Adel Prokurov (Feb 15 2022 at 07:36):

bjorn3 said:

For capstone you will have to explicitly enable the skipdata option. Cranelift uses also capstone for debugging: https://github.com/bytecodealliance/wasmtime/blob/05ace6c0e24f4fd8e256edab7de841a5b28c5735/cranelift/src/disasm.rs#L96

I didn't know that! Thanks for help


Last updated: Oct 23 2024 at 20:03 UTC