Skip to content
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

Difference between AOT generated for gnu and eabi target ABI #3280

Open
FractalGiraffe opened this issue Apr 3, 2024 · 1 comment
Open

Comments

@FractalGiraffe
Copy link

FractalGiraffe commented Apr 3, 2024

In our pipeline, we build AOT files for both gnu and eabi target ABI's. However, we think we can simplify our pipeline by just building for one of them, as the generated AOT should be the same for both.

Generally, 'gnu' and 'eabi' distinguish the existence of an operating system and primarily indicate C standard library ABI. They also distinguish the sizes of some data types, like wchar_t, but that's relevant for binary compatibility, which is not an issue in our case. A C compiler may generate different function calls depending on what it believes is available above and beyond the Standard C library. A toolchain for an EABI, or bare-metal ABI, may assume a different C library (e.g. newlib or even no C library) to the GNU Linux C ABI (for which it assumes glibc). We generate AOT after we build WebAssembly with wasi-libc, so C standard library ABI is irrelevant when building AOT.

What's the difference between using gnu and eabi on generated AOT? Can you confirm we can simplify our pipeline?

Many thanks.

@wenyongh
Copy link
Contributor

wenyongh commented Apr 8, 2024

Hi, I have no idea about the difference between the AOT files generated for gnu and eabi either, it seems that even for eabi, the generated machine code is different when using arm-none-eabi and armv7a-none-eabi, see:
https://clang.llvm.org/docs/CrossCompilation.html
Maybe you can refer to more llvm documents.

I think here there should be no issue when an AOT function calls another AOT function as long as they uses the same abi. The issue is that callings between runtime and AOT code and runtime should have better be compiled with same abi used for AOT code: after relocation, the AOT code can directly call runtime symbols (see aot_reloc.h) and native APIs (e.g. libc-wasi), and runtime calls AOT code through asm code (see core/iwasm/common/arch/invokeNative_xxx.s) or quick aot entries (see quick_aot_entries in wasm_native.c).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants