Add Cosmopolitan Libc Platform (#2598)
This PR adds the Cosmopolitan Libc platform enabling compatibility with multiple x86_64 operating systems with the same binary. The platform is similar to the Linux platform, but for now only x86_64 with interpreter modes are supported. The only major change to the core is `posix.c/convert_errno()` was rewritten to use a switch statement. With Cosmopolitan errno values depend on the currently running operating system, and so they are non-constant and cannot be used in array designators. However, the `cosmocc` compiler allows non-constant case labels in switch statements, enabling the new version. And updated wamr-test-suites script to add `-j <platform>` option. The spec tests can be ran via `CC=cosmocc ./test_wamr.sh -j cosmopolitan -t classic-interp` or `CC=cosmocc ./test_wamr.sh -j cosmopolitan -t fast-interp`.
This commit is contained in:
@ -443,3 +443,23 @@ make
|
||||
aos make
|
||||
```
|
||||
download the binary to developerkit board, check the output from serial port
|
||||
|
||||
## Cosmopolitan Libc
|
||||
Currently, only x86_64 architecture with interpreter modes is supported.
|
||||
|
||||
Clone the Cosmopolitan Libc. Setup `cosmocc` as described in [Getting Started](https://github.com/jart/cosmopolitan/#getting-started) being sure to get it into `PATH`.
|
||||
|
||||
Build iwasm
|
||||
``` Bash
|
||||
export CC=cosmocc
|
||||
export CXX=cosmoc++
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cmake -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 -B build
|
||||
cmake --build build -j
|
||||
```
|
||||
|
||||
Run like
|
||||
``` Bash
|
||||
./build/iwasm.com <wasm file>
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user