Open IllusionMan1212 opened 5 months ago
The current ABI for arm32 is mostly a placeholder, and will need correcting for aggregates. The problem is reverse engineering how LLVM does things more than anything.
https://github.com/odin-lang/Odin/blob/master/src/llvm_abi.cpp#L1392-L1472
Context
Expected Behavior
Correct values are passed to, and returned from, foreign functions.
Current Behavior
Argument values are incorrect when printed in foreign functions and return values are incorrect when printed on the odin-side.
Failure Information (for bugs)
The Odin compiler is currently not conforming to the arm32 ABI homogeneous aggregates section.
There are 3 issues that need fixing:
For the first and the second points, the same issue was happening on arm64 and was reported in #2561 and fixed by https://github.com/odin-lang/odin/commit/f3a463000d4d777cf255bfebda3f51fba4ce8fcc . I've confirmed that same code fixes 1 and 2 but 3 still happens, I haven't been able to test to see if it's an issue on arm64 too but I suspect it is.
Steps to Reproduce
Simple C code compiled with
gcc -c -o main.o main.c
and made into a static lib withar rcs libodintest.a main.o
And the odin code that calls the C library
And this is what gets printed to the terminal
Failure Logs
N/A