mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-02-05 23:20:53 -08:00
Merge branch 'cosmopolitan' into 'develop'
initial port of cosmopolitan libc See merge request embeddable-common-lisp/ecl!329
This commit is contained in:
commit
fee658a580
8 changed files with 93 additions and 13 deletions
60
INSTALL
60
INSTALL
|
|
@ -208,3 +208,63 @@ imoprtant to specify a different size. For example:
|
|||
#+begin_src shell-script
|
||||
emcc program.c -sSTACK_SIZE=1048576 lib/*.a -I./include -o program.o
|
||||
#+end_src
|
||||
|
||||
* Build using Cosmopolitan toolchain (experimental)
|
||||
|
||||
Binaries built with cosmopolitan toolchain can be executed on numerous platforms
|
||||
without changes. An inititial ECL port has been completed.
|
||||
|
||||
1. Download cosmopolitan toolchain and activate it
|
||||
|
||||
Instructions for downloading the toolchain are available in its [[https://github.com/jart/cosmopolitan/blob/master/README.md ][repository]].
|
||||
For example:
|
||||
|
||||
#+begin_src sh
|
||||
mkdir cosmocc
|
||||
pushd cosmocc
|
||||
curl -o https://cosmo.zip/pub/cosmocc/cosmocc.zip
|
||||
unzip *zip
|
||||
bin/make --version # sanity test
|
||||
export PATH="`pwd`/bin:${PATH}"
|
||||
export CC=x86_64-unknown-cosmo-cc
|
||||
export CXX=x86_64-unknown-cosmo-c++
|
||||
popd
|
||||
#+end_src
|
||||
|
||||
2. Build ECL
|
||||
|
||||
#+begin_src sh
|
||||
./configure --disable-shared --prefix=/tmp/cosmo-cl
|
||||
make -j15
|
||||
make install
|
||||
# make check
|
||||
#+end_src
|
||||
|
||||
- The platform is reported in *FEATURES* as :COSMO and as :LINUX
|
||||
- make check will fail because libc segfaults when using fenv.h
|
||||
|
||||
This platform is not upstreamed yet in libgc, so it may be necessary to add the
|
||||
following code to the file gcconfig.h:
|
||||
|
||||
#+begin_src c
|
||||
# if defined(__COSMOPOLITAN__)
|
||||
# if defined(__x86_64__)
|
||||
# define mach_type_known
|
||||
# define X86_64
|
||||
# define LINUX // optional?
|
||||
# elif defined(__aarch64__)
|
||||
# define mach_type_known
|
||||
# define AARCH64
|
||||
# define LINUX // optional?
|
||||
# endif
|
||||
# endif
|
||||
#+end_src
|
||||
|
||||
For details see: https://github.com/jart/cosmopolitan/issues/939.
|
||||
|
||||
Cosmopolitan condition variables can't be used with mutexes that are not
|
||||
initialized as PTHREAD_MUTEX_NORMAL. That means that recursive locks and
|
||||
deterministic deadlock detection are not supported on this platform.
|
||||
|
||||
Moreover floating point exception handling is not working and it is libc issue
|
||||
that manifests itself with segfaults.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
;;; -*- mode: Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp ; buffer-read-only: t; -*-
|
||||
;;; This is ASDF 3.1.8.8: Another System Definition Facility.
|
||||
;;; This is ASDF 3.1.8.9: Another System Definition Facility.
|
||||
;;;
|
||||
;;; Feedback, bug reports, and patches are all welcome:
|
||||
;;; please mail to <asdf-devel@common-lisp.net>.
|
||||
|
|
@ -1732,7 +1732,7 @@ keywords explicitly."
|
|||
|
||||
(defun os-unix-p ()
|
||||
"Is the underlying operating system some Unix variant?"
|
||||
(or (featurep '(:or :unix :cygwin)) (os-macosx-p)))
|
||||
(or (featurep '(:or :unix :cygwin :haiku :linux)) (os-macosx-p)))
|
||||
|
||||
(defun os-windows-p ()
|
||||
"Is the underlying operating system Microsoft Windows?"
|
||||
|
|
@ -7274,7 +7274,7 @@ previously-loaded version of ASDF."
|
|||
;; "3.4.5.67" would be a development version in the official branch, on top of 3.4.5.
|
||||
;; "3.4.5.0.8" would be your eighth local modification of official release 3.4.5
|
||||
;; "3.4.5.67.8" would be your eighth local modification of development version 3.4.5.67
|
||||
(asdf-version "3.1.8.8")
|
||||
(asdf-version "3.1.8.9")
|
||||
(existing-version (asdf-version)))
|
||||
(setf *asdf-version* asdf-version)
|
||||
(when (and existing-version (not (equal asdf-version existing-version)))
|
||||
|
|
|
|||
|
|
@ -712,6 +712,18 @@ EXTERN_C_BEGIN
|
|||
# define mach_type_known
|
||||
# endif
|
||||
|
||||
# if defined(__COSMOPOLITAN__)
|
||||
# if defined(__x86_64__)
|
||||
# define mach_type_known
|
||||
# define X86_64
|
||||
# define LINUX // optional?
|
||||
# elif defined(__aarch64__)
|
||||
# define mach_type_known
|
||||
# define AARCH64
|
||||
# define LINUX // optional?
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Feel free to add more clauses here */
|
||||
|
||||
/* Or manually define the machine type here. A machine type is */
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ ecl_def_string_array(feature_names,static,const) = {
|
|||
#if defined(ECL_MS_WINDOWS_HOST)
|
||||
ecl_def_string_array_elt("WINDOWS"),
|
||||
#endif
|
||||
#if defined(__COSMOPOLITAN__)
|
||||
ecl_def_string_array_elt("COSMO"),
|
||||
#endif
|
||||
#ifdef ECL_CMU_FORMAT
|
||||
ecl_def_string_array_elt("CMU-FORMAT"),
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -724,9 +724,8 @@ mp_process_run_function_wait(cl_narg narg, ...)
|
|||
process = cl_apply(2, @'mp::process-run-function',
|
||||
cl_grab_rest_args(args));
|
||||
if (!Null(process)) {
|
||||
ecl_def_ct_single_float(wait, 0.001, static, const);
|
||||
while (process->process.phase < ECL_PROCESS_ACTIVE) {
|
||||
cl_sleep(wait);
|
||||
ecl_musleep(0.001);
|
||||
}
|
||||
}
|
||||
ecl_va_end(args);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
# include <ecl/impl/math_fenv_msvc.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FENV_H
|
||||
#if defined(HAVE_FENV_H) && !defined(__COSMOPOLITAN__)
|
||||
# define ECL_WITHOUT_FPE_BEGIN do { fenv_t env; feholdexcept(&env);
|
||||
# define ECL_WITHOUT_FPE_END fesetenv(&env); } while (0)
|
||||
# if !defined(FE_DIVBYZERO)
|
||||
|
|
|
|||
|
|
@ -351,12 +351,15 @@ extern enum ecl_ffi_tag ecl_foreign_type_code(cl_object type);
|
|||
/* file.d */
|
||||
|
||||
/* Windows does not have this flag (POSIX thing) */
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
#endif
|
||||
#ifndef O_NONBLOCK
|
||||
#define O_NONBLOCK 0
|
||||
#ifndef __COSMOPOLITAN__
|
||||
# ifndef O_CLOEXEC
|
||||
# define O_CLOEXEC 0
|
||||
# endif
|
||||
# ifndef O_NONBLOCK
|
||||
# define O_NONBLOCK 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Windows needs to be told explicitely to open files in binary mode */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
|
|
@ -691,11 +694,10 @@ extern void ecl_interrupt_process(cl_object process, cl_object function);
|
|||
|
||||
/* Some old BSD systems don't have WCONTINUED / WIFCONTINUED */
|
||||
|
||||
#ifndef ECL_MS_WINDOWS_HOST
|
||||
#if !defined(ECL_MS_WINDOWS_HOST) && !defined(__COSMOPOLITAN__)
|
||||
# ifndef WCONTINUED
|
||||
# define WCONTINUED 0
|
||||
# endif
|
||||
|
||||
# ifndef WIFCONTINUED
|
||||
# define WIFCONTINUED(x) 0
|
||||
# endif
|
||||
|
|
|
|||
|
|
@ -54,11 +54,15 @@ ecl_mutex_init(ecl_mutex_t *mutex, bool recursive)
|
|||
{
|
||||
pthread_mutexattr_t mutexattr[1];
|
||||
pthread_mutexattr_init(mutexattr);
|
||||
#ifdef __COSMOPOLITAN__
|
||||
pthread_mutexattr_settype(mutexattr, PTHREAD_MUTEX_NORMAL);
|
||||
#else
|
||||
if (recursive) {
|
||||
pthread_mutexattr_settype(mutexattr, PTHREAD_MUTEX_RECURSIVE);
|
||||
} else {
|
||||
pthread_mutexattr_settype(mutexattr, PTHREAD_MUTEX_ERRORCHECK);
|
||||
}
|
||||
#endif
|
||||
pthread_mutex_init(mutex, mutexattr);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue