wasm-micro-runtime icon indicating copy to clipboard operation
wasm-micro-runtime copied to clipboard

AOT float point ops failed

Open AfflatusX opened this issue 3 years ago • 2 comments

When loading wasm module, I get following error:

error: AOT module load failed: resolve symbol __aeabi_i2f failed

I'm comiling with:

target_compile_options (app PRIVATE -mfloat-abi=soft) target_compile_options (app PRIVATE -lfplib)

which means it should have the soft fp support. I searched ARM's software fp lib:

https://developer.arm.com/documentation/dui0475/m/floating-point-support/the-software-floating-point-library--fplib/fplib-conversions-between-floats--long-longs--doubles--and-ints?lang=en

Looks like i2f isn't defined there?

AfflatusX avatar May 20 '21 18:05 AfflatusX

here is the command I used for AOT:

../tools/wamrc --target=thumbv7 --target-abi=eabi --cpu=cortex-m3 -o build/optimized.aot build/optimized.wasm

However, I think that eabi option is wrong? I tried to use --target-abi=gnu but it then complains about __floatsisf being missing.

AfflatusX avatar May 20 '21 18:05 AfflatusX

after poking around - looks like https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/core/iwasm/aot/arch/aot_reloc_thumb.c is missing a couple functions -

i2f fmul fdiv fadd

After adding them into that file, the issue is solved.

AfflatusX avatar May 20 '21 19:05 AfflatusX