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

mipsel AOT support

Open duchengxian opened this issue 3 years ago • 6 comments

2 problems:

  1. wamrc support mips and mipseb, but mips==mipseb in wamrc. change source code to "mipsel" solved this problem
  2. after above modification, iwasm can load AOT file, but reported "invalid relocation type", looks like mips doesn't do relocation

could you pls have a look ?

duchengxian avatar Dec 07 '21 12:12 duchengxian

Hi,

2 problems:

  1. wamrc support mips and mipseb, but mips==mipseb in wamrc. change source code to "mipsel" solved this problem

#887 adds "mipsel" to wamrc's target list, could you please try again with "wamrc --target=mipsel" after applying the patch?

  1. after above modification, iwasm can load AOT file, but reported "invalid relocation type", looks like mips doesn't do relocation

Yes, currently the AOT relocation operations for mips target haven't been implemented, it really takes effort to resolve it. Could you please try the XIP mode instead? Please refer to the document here.

wenyongh avatar Dec 12 '21 10:12 wenyongh

#887 looks fine

I used XIP mode to generated AOT file, and iwasm has recognised the XIP mode, but apply_relocation() still be called and cause "Load relocation section failed: invalid relocation type 4." pls take a look if you have a chance

duchengxian avatar Dec 13 '21 02:12 duchengxian

@duchengxian Hi, now the XIP mode is a highly architecture dependent feature, it's only tested on arm & riscv. Other platform would need to check the intrinsic need be replaced according to target ISA like this (float operation is easy to cause relocation usually): https://github.com/bytecodealliance/wasm-micro-runtime/blob/5547924e28c589aee62210ef464833c659950328/core/iwasm/aot/aot_intrinsic.c#L602

no1wudi avatar Dec 13 '21 06:12 no1wudi

@no1wudi I am not familar with ISA, it's too difficult to find out how to adapt the runtime to MIPS

After comment out apply_relocation(), iwasm+aot is still not work, but it works after specific "-f". Maybe there are potential problems with long jump, but it's a workaround for short code

hope better solution for it. thanks for your great work

duchengxian avatar Dec 13 '21 09:12 duchengxian

What's your aot compile option ? Note: Simply comment out apply_relocation is dangerous , the relocation is occurred with some specific instructions instead of "long code".

no1wudi avatar Dec 14 '21 02:12 no1wudi

used option like wenyongh said: wamrc --enable-indirect-mode --disable-llvm-intrinsics --target=mipsel -o <aot_file> <wasm_file>

duchengxian avatar Dec 15 '21 12:12 duchengxian