Work around broken atomics in tinycc (#669)

This commit is contained in:
Ben Noordhuis 2024-11-12 01:01:52 +01:00 committed by GitHub
parent c41ee4f15f
commit 487129055f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -62,7 +62,10 @@
#define NO_TM_GMTOFF
#endif
#if !defined(EMSCRIPTEN) && !defined(__wasi__) && !__STDC_NO_ATOMICS__
// atomic_store etc. are completely busted in recent versions of tcc;
// somehow the compiler forgets to load |ptr| into %rdi when calling
// the __atomic_*() helpers in its lib/stdatomic.c and lib/atomic.S
#if !defined(__TINYC__) && !defined(EMSCRIPTEN) && !defined(__wasi__) && !__STDC_NO_ATOMICS__
#include "quickjs-c-atomics.h"
#define CONFIG_ATOMICS
#endif

View file

@ -50,6 +50,14 @@ typedef pthread_t js_thread_t;
#define CMD_NAME "run-test262"
// not quite correct because in theory someone could compile quickjs.c
// with a different compiler but in practice no one does that, right?
#ifdef __TINYC__
#define CC_IS_TCC 1
#else
#define CC_IS_TCC 0
#endif
typedef struct {
js_mutex_t agent_mutex;
js_cond_t agent_cond;
@ -1219,7 +1227,7 @@ void load_config(const char *filename, const char *ignore)
namelist_add(&exclude_list, base_name, p);
break;
case SECTION_FEATURES:
if (!q || str_equal(q, "yes"))
if (!q || str_equal(q, "yes") || (!CC_IS_TCC && str_equal(q, "!tcc")))
str_append(&harness_features, " ", p);
else
str_append(&harness_skip_features, " ", p);

View file

@ -62,7 +62,8 @@ arraybuffer-transfer
arrow-function
async-functions
async-iteration
Atomics
# atomics are broken in recent versions of tcc
Atomics=!tcc
Atomics.pause=skip
Atomics.waitAsync=skip
BigInt