tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] [PATCH] freebsd support update proposal


From: Christian Jullien
Subject: Re: [Tinycc-devel] [PATCH] freebsd support update proposal
Date: Sat, 29 Jan 2022 07:03:19 +0100

Hi David,

 

I think you can simplify your patch, using syscall as with other systems, with:

 

[jullien@freebsd64 ~/tinycc]$ git diff

diff --git a/lib/bcheck.c b/lib/bcheck.c

index 0379b6e..8dbb8be 100644

--- a/lib/bcheck.c

+++ b/lib/bcheck.c

@@ -226,9 +226,12 @@ typedef struct alloca_list_struct {

#elif defined(__OpenBSD__)

#define BOUND_TID_TYPE   pid_t

#define BOUND_GET_TID    syscall (SYS_getthrid)

-#elif defined(__FreeBSD__) || defined(__NetBSD__)

+#elif defined(__FreeBSD__)

#define BOUND_TID_TYPE   pid_t

-#define BOUND_GET_TID    0

+#define BOUND_GET_TID    syscall (SYS_thr_self)

+#elif  defined(__NetBSD__)

+#define BOUND_TID_TYPE   pid_t

+#define BOUND_GET_TID    syscall (SYS_lwp_self)

#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || defined(__riscv)

#define BOUND_TID_TYPE   pid_t

#define BOUND_GET_TID    syscall (SYS_gettid)

diff --git a/tccpp.c b/tccpp.c

index 6b828c9..0a1b0fd 100644

--- a/tccpp.c

+++ b/tccpp.c

@@ -3743,6 +3743,10 @@ static void tcc_predefs(TCCState *s1, CString *cs, int is_asm)

#endif

     cstr_printf(cs, "#define __SIZEOF_POINTER__ %d\n", PTR_SIZE);

     cstr_printf(cs, "#define __SIZEOF_LONG__ %d\n", LONG_SIZE);

+#ifdef TARGETOS_FreeBSD

+    cstr_printf(cs, "#define __SIZEOF_SIZE_T__ %d\n", LONG_SIZE);

+    cstr_printf(cs, "#define __SIZEOF_PTRDIFF_T__ %d\n", PTR_SIZE);

+#endif

     if (!is_asm) {

       putdef(cs, "__STDC__");

       cstr_printf(cs, "#define __STDC_VERSION__ %dL\n", s1->cversion);

 

 

I see that the test suite on latest FreeBSD 13.x (using this patch) raises errors like:

 

--- 97_utf8_string_literal.expect       2022-01-29 06:29:33.110372000 +0100

+++ 97_utf8_string_literal.output       2022-01-29 06:57:36.509445000 +0100

@@ -1 +1,4 @@

-0068 0065 006C 006C 006F 0024 0024 4F60 597D 00A2 00A2 4E16 754C 20AC 20AC 0077 006F 0072 006C 0064

+In file included from 97_utf8_string_literal.c:3:

+In file included from /usr/include/wchar.h:69:

+In file included from /usr/include/_ctype.h:97:

+/usr/include/runetype.h:94: error: ';' expected (got "const")

gmake[3]: *** [Makefile:133: 97_utf8_string_literal.test] Error 1

 

Which are related to TLS declaration on runetype.h

 

extern _Thread_local const _RuneLocale *_ThreadRuneLocale;

 

 

-----Original Message-----
From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of David CARLIER
Sent: Saturday, January 29, 2022 01:19
To: tinycc-devel@nongnu.org
Subject: [Tinycc-devel] [PATCH] freebsd support update proposal

 

adding few constants for compile time and fetching thread id for bound check.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]