-
Notifications
You must be signed in to change notification settings - Fork 30
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
Support of OCaml 5.0 (cleaned version) #124
Closed
Closed
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
abfa48b
Add -Wl,--start-group & -Wl,--end-group
dinosaure 32633a8
Delete the usage of `sed -i` (and replace it by `sed && mv`)
dinosaure d2e4a0b
Specify the architecture into the OCaml's `./configure` script
dinosaure 0f97e4d
Add $$PTHREAD_LIB into our pattern to modify nativecclibs
dinosaure 6a0fc20
Add runtime/primitives as a dependency for the coldstart rule
dinosaure 453e289
ocamlrun{,d,i} are located into the runtime directory
dinosaure 10f2f9b
Delete fake libcamlrun{,d,i}.a from the Makefile
dinosaure 7975a11
/runtime/Makefile was deleted (OCaml 5.0) and everything is into /Mak…
dinosaure 5480611
Replace ocamlyacc by $$(ocamlyacc_PROGRAM)
dinosaure b45acbd
Replace the number of domains into our OCaml runtime
dinosaure a87ca82
Disable debug runtime
dinosaure a817e26
Delete unecessary tweak Makefile rule about objinfo_helper
dinosaure 0c86e1a
Add a missing / into our nolibc's test-include/%.c rule
dinosaure 9f94617
Add the -p option when we use mkdir (nolibc's Makefile)
dinosaure b89d736
Set NATIVE_COMPILER to true into the OCaml's Makefile.config
dinosaure 230213d
Add test-include/sys/ as a dependency for test-headers (nolibc's Make…
dinosaure d912fb0
Define EBUSY
dinosaure a0b57c0
Define O_RDWR
dinosaure 81b73f9
Define SIG_BLOCK/SIG_SETMASK
dinosaure 7d021b8
Define S_{IR,IW}USR
dinosaure d96e157
Stub pthread
dinosaure 5dab641
Stub sigfillset
dinosaure 8188ff9
Stub fputs, fopen and fclose and implement puts and putchar
dinosaure 57cea73
Stub strerror_r
dinosaure 2e94e8c
Stub ftruncate
dinosaure d2704ed
Stub usleep
dinosaure f694bb4
Export stdrup & strcpy
dinosaure f1a4264
Export qsort and mktemp
dinosaure 221d3c7
Export fstat
dinosaure e43f6e5
Export islanum and tolower
dinosaure c1cf5d1
Add longjmp & setjmp
dinosaure d4bfcfa
Add the sched.h interface (and the CPU_ZERO value)
dinosaure 924cbf5
Add the stdatomic.h
dinosaure 50f066a
Add sysconf.c (to let OCaml to know the _SC_PAGE{,_}SIZE)
dinosaure f9d621e
Add the mmap() function
dinosaure f3f662e
Initialise the Thread Local Store
dinosaure 93f3506
Upgrade ocaml-solo5 with OCaml 5.0
dinosaure 9c45880
Upgrade GitHub workflow and Cirrus CI with OCaml 5.0
dinosaure 256805f
Fix the example & the test program
dinosaure d5ef317
Use __c11 atomic macros when they are available (and fix the LLVM sup…
dinosaure 88b0c71
Update to the new Solo5 API.
palainp d7f336b
minor change to trigger CI
hannesm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#ifndef _PTHREAD_H | ||
#define _PTHREAD_H | ||
|
||
#include <stddef.h> | ||
#include <signal.h> | ||
|
||
typedef unsigned long int pthread_t; | ||
typedef int cpu_set_t; | ||
|
||
int pthread_getaffinity_np(pthread_t, size_t, cpu_set_t *); | ||
|
||
pthread_t pthread_self(void); | ||
|
||
typedef int pthread_attr_t; | ||
|
||
int pthread_create(pthread_t *, const pthread_attr_t *, void *(*)(void *), void *); | ||
int pthread_join(pthread_t, void **); | ||
int pthread_attr_init(pthread_attr_t *); | ||
void pthread_cleanup_push(void (*)(void *), void *); | ||
void pthread_cleanup_pop(int); | ||
|
||
typedef int pthread_mutex_t; | ||
typedef int pthread_cond_t; | ||
|
||
int pthread_mutex_lock(pthread_mutex_t *); | ||
int pthread_mutex_trylock(pthread_mutex_t *); | ||
int pthread_mutex_unlock(pthread_mutex_t *); | ||
|
||
#define PTHREAD_MUTEX_INITIALIZER 0 | ||
#define PTHREAD_COND_INITIALIZER 0 | ||
|
||
int pthread_sigmask(int, const sigset_t *, sigset_t *); | ||
int pthread_detach(pthread_t); | ||
int pthread_equal(pthread_t, pthread_t); | ||
|
||
typedef int pthread_mutexattr_t; | ||
|
||
int pthread_mutexattr_init(pthread_mutexattr_t *); | ||
int pthread_mutexattr_settype(pthread_mutexattr_t *, int); | ||
|
||
#define PTHREAD_MUTEX_ERRORCHECK 0 | ||
|
||
int pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *); | ||
int pthread_mutexattr_destroy(pthread_mutexattr_t *); | ||
int pthread_mutex_destroy(pthread_mutex_t *); | ||
|
||
typedef int pthread_condattr_t; | ||
|
||
int pthread_condattr_init(pthread_condattr_t *); | ||
int pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *); | ||
|
||
int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); | ||
int pthread_cond_broadcast(pthread_cond_t *); | ||
int pthread_cond_signal(pthread_cond_t *); | ||
int pthread_cond_destroy(pthread_cond_t *); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef _SCHED_H | ||
#define _SCHED_H | ||
|
||
typedef int cpu_set_t; | ||
|
||
#define CPU_ZERO (x) 0 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
#include <signal.h> | ||
|
||
void longjmp(int, int) __attribute__ ((__noreturn__)); | ||
|
||
#define setjmp(buf) 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,14 +4,24 @@ | |||||||||||||
typedef int jmp_buf; | ||||||||||||||
int setjmp(jmp_buf); | ||||||||||||||
void (*signal(int sig, void (*func)(int)))(int); | ||||||||||||||
#define SIG_DFL NULL | ||||||||||||||
#define SIG_IGN NULL | ||||||||||||||
#define SIG_ERR NULL | ||||||||||||||
#define SIG_DFL 0 | ||||||||||||||
#define SIG_IGN 0 | ||||||||||||||
#define SIG_ERR 0 | ||||||||||||||
#define SIG_BLOCK 0 | ||||||||||||||
#define SIG_SETMASK 0 | ||||||||||||||
/* | ||||||||||||||
* The following definitions are not required by the OCaml runtime, but are | ||||||||||||||
* needed to build the freestanding version of GMP used by Mirage. | ||||||||||||||
* For OCaml 5.0.0, it's not totally true. SIG_{BLOCK,SETMASK,IGN,DFL) are | ||||||||||||||
* needed by the OCaml runtime. | ||||||||||||||
Comment on lines
13
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We rephrased part of the comment that was outdated by OCaml 5.0.0 support. |
||||||||||||||
* | ||||||||||||||
* NOTE: Solo5 does not implement signals, but we should not trigger | ||||||||||||||
* a situation where these values are really used. | ||||||||||||||
*/ | ||||||||||||||
#define SIGFPE 1 | ||||||||||||||
int raise(int); | ||||||||||||||
|
||||||||||||||
typedef int sigset_t; | ||||||||||||||
int sigfillset(sigset_t *); | ||||||||||||||
|
||||||||||||||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#ifndef _STDATOMIC_H | ||
#define _STDATOMIC_H | ||
|
||
// Compatibility with non-clang compilers | ||
#ifndef __has_builtin | ||
# define __has_builtin(x) 0 | ||
#endif | ||
|
||
#define atomic_load_explicit(x, mode) ( *x ) | ||
#define atomic_load(x) ( *x ) | ||
|
||
extern int memory_order_release; | ||
extern int memory_order_acquire; | ||
extern int memory_order_relaxed; | ||
extern int memory_order_seq_cst; | ||
|
||
#if __has_builtin(__c11_atomic_fetch_add) | ||
#define atomic_fetch_add(X, Y) __c11_atomic_fetch_add(X, Y, __ATOMIC_SEQ_CST) | ||
#else | ||
#define atomic_fetch_add(X, Y) ({ __auto_type tmp = *X; *X = tmp + Y; tmp; }) | ||
#endif | ||
|
||
#define atomic_fetch_add_explicit(X, Y, MOD) atomic_fetch_add(X, Y) | ||
|
||
#define atomic_thread_fence(MO) do {} while (0) | ||
|
||
typedef unsigned long long atomic_uint_fast64_t; | ||
|
||
#if __has_builtin(__c11_atomic_compare_exchange_strong) | ||
#define atomic_compare_exchange_strong(OBJ, EXPECTED, DESIRED) \ | ||
__c11_atomic_compare_exchange_strong(OBJ, EXPECTED, DESIRED, \ | ||
__ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) | ||
#else | ||
#define atomic_compare_exchange_strong(OBJ, EXPECTED, DESIRED) \ | ||
({ int ret = 0; \ | ||
if (*OBJ == *EXPECTED) { \ | ||
*OBJ = DESIRED; \ | ||
ret = 1; \ | ||
} \ | ||
ret; \ | ||
}) | ||
#endif | ||
|
||
#if __has_builtin(__c11_atomic_exchange) | ||
#define atomic_exchange(OBJ, DESIRED) \ | ||
__c11_atomic_exchange(OBJ, DESIRED, __ATOMIC_SEQ_CST) | ||
#else | ||
#define atomic_exchange(OBJ, DESIRED) \ | ||
({ __auto_type tmp = *OBJ; \ | ||
*OBJ = DESIRED; \ | ||
tmp; \ | ||
}) | ||
#endif | ||
|
||
#define atomic_store(OBJ, DESIRED) do { *OBJ = DESIRED; } while(0) | ||
#define atomic_store_explicit(OBJ, DESIRED, ORDER) atomic_store(OBJ, DESIRED) | ||
|
||
#if __has_builtin(__c11_atomic_fetch_or) | ||
#define atomic_fetch_or(OBJ, ARG) \ | ||
__c11_atomic_fetch_or(OBJ, ARG, __ATOMIC_SEQ_CST) | ||
#else | ||
#define atomic_fetch_or(OBJ, ARG) \ | ||
({ __auto_type tmp = *OBJ; \ | ||
*OBJ = *OBJ | ARG; \ | ||
tmp; \ | ||
}) | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dependency on
test-include/sys/
is order only.