Skip to content

Commit 43e5b6f

Browse files
committed
rpi baremetal build fix
1 parent 7d4f032 commit 43e5b6f

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

quickjs.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static int gettimeofday(struct timeval* tp, struct timezone* tzp)
8080

8181
#define OPTIMIZE 1
8282
#define SHORT_OPCODES 1
83-
#if defined(EMSCRIPTEN) || defined(_MSC_VER)
83+
#if defined(EMSCRIPTEN) || defined(_MSC_VER) || defined(POOR_CLIB)
8484
#define DIRECT_DISPATCH 0
8585
#else
8686
#define DIRECT_DISPATCH 1
@@ -99,15 +99,21 @@ static int gettimeofday(struct timeval* tp, struct timezone* tzp)
9999

100100
/* define to include Atomics.* operations which depend on the OS
101101
threads */
102-
#if !defined(EMSCRIPTEN) && !defined(_MSC_VER)
102+
#if !defined(EMSCRIPTEN) && !defined(_MSC_VER) && !defined(POOR_CLIB)
103103
#define CONFIG_ATOMICS
104104
#endif
105105

106-
#if !defined(EMSCRIPTEN) && !defined(_MSC_VER)
106+
#if !defined(EMSCRIPTEN) && !defined(_MSC_VER) && !defined(POOR_CLIB)
107107
/* enable stack limitation */
108108
#define CONFIG_STACK_CHECK
109109
#endif
110110

111+
#if defined(POOR_CLIB)
112+
#define FE_DOWNWARD 1
113+
#define FE_TONEAREST 0
114+
#define FE_TOWARDZERO 3
115+
#define FE_UPWARD 2
116+
#endif
111117

112118
/* dump object free */
113119
//#define DUMP_FREE
@@ -1723,7 +1729,7 @@ static inline size_t js_def_malloc_usable_size(void *ptr)
17231729
return malloc_size(ptr);
17241730
#elif defined(_WIN32)
17251731
return _msize(ptr);
1726-
#elif defined(EMSCRIPTEN)
1732+
#elif defined(EMSCRIPTEN) || defined(POOR_CLIB)
17271733
return 0;
17281734
#elif defined(__linux__)
17291735
return malloc_usable_size(ptr);
@@ -1797,13 +1803,13 @@ static const JSMallocFunctions def_malloc_funcs = {
17971803
malloc_size,
17981804
#elif defined(_WIN32)
17991805
(size_t (*)(const void *))_msize,
1800-
#elif defined(EMSCRIPTEN)
1806+
#elif defined(EMSCRIPTEN) || defined(POOR_CLIB)
18011807
NULL,
18021808
#elif defined(__linux__)
18031809
(size_t (*)(const void *))malloc_usable_size,
18041810
#else
18051811
/* change this to `NULL,` if compilation fails */
1806-
NULL,
1812+
malloc_usable_size,
18071813
#endif
18081814
};
18091815

@@ -42064,7 +42070,7 @@ static JSValue js___date_clock(JSContext *ctx, JSValueConst this_val,
4206442070
/* OS dependent. d = argv[0] is in ms from 1970. Return the difference
4206542071
between UTC time and local time 'd' in minutes */
4206642072
static int getTimezoneOffset(int64_t time) {
42067-
#if defined(_WIN32)
42073+
#if defined(_WIN32) || defined(POOR_CLIB)
4206842074
/* XXX: TODO */
4206942075
return 0;
4207042076
#else

0 commit comments

Comments
 (0)