Skip to content

Commit bf9fb2e

Browse files
authored
cosmopolitan: Update compiler and update platform_internal.h (#3079)
This fixes the cosmopolitan platform. - Switch `build_cosmocc.sh` and platform documentation to explicitly use the x86_64 cosmocc compiler as multi-arch cosmocc won't work here. Older version `cosmocc` just did a x86_64 build. - Add missing items from `platform_internal.h` to fix build.
1 parent d815bbc commit bf9fb2e

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

core/shared/platform/cosmopolitan/platform_internal.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ typedef pthread_t korp_tid;
5555
typedef pthread_mutex_t korp_mutex;
5656
typedef pthread_cond_t korp_cond;
5757
typedef pthread_t korp_thread;
58+
typedef pthread_rwlock_t korp_rwlock;
5859
typedef sem_t korp_sem;
5960

6061
#define OS_THREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
@@ -67,6 +68,12 @@ typedef int os_file_handle;
6768
typedef DIR *os_dir_stream;
6869
typedef int os_raw_file_handle;
6970

71+
static inline os_file_handle
72+
os_get_invalid_handle()
73+
{
74+
return -1;
75+
}
76+
7077
#if WASM_DISABLE_WRITE_GS_BASE == 0
7178
#if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
7279
#define os_writegsbase(base_addr) \

product-mini/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ make
447447
## Cosmopolitan Libc
448448
Currently, only x86_64 architecture with interpreter modes is supported.
449449

450-
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`.
450+
Setup `cosmocc` as described in [Getting Started](https://github.com/jart/cosmopolitan/#getting-started) being sure to get its `bin` directory into `PATH`.
451451

452452
Build iwasm
453453
``` Bash
454-
export CC=cosmocc
455-
export CXX=cosmoc++
454+
export CC=x86_64-unknown-cosmo-cc
455+
export CXX=x86_64-unknown-cosmo-c++
456456
rm -rf build
457457
mkdir build
458458
cmake -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 -B build

product-mini/platforms/cosmopolitan/build_cosmocc.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# Copyright (C) 2023 Dylibso. All rights reserved.
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5-
export CC=cosmocc
6-
export CXX=cosmoc++
5+
export CC=x86_64-unknown-cosmo-cc
6+
export CXX=x86_64-unknown-cosmo-c++
77
rm -rf build
88
mkdir build
99
cmake -DWAMR_BUILD_INTERP=1 -DWAMR_BUILD_FAST_INTERP=1 -B build

0 commit comments

Comments
 (0)