From f9c580b8a02712ac7e445f22b45bda6919790d9a Mon Sep 17 00:00:00 2001 From: Christian Jullien Date: Tue, 8 Dec 2020 06:55:50 +0100 Subject: [PATCH] FreeBSD: start to reintroduce support - WIP --- lib/bcheck.c | 3 +++ libtcc.c | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/bcheck.c b/lib/bcheck.c index 2887a576..2008a262 100644 --- a/lib/bcheck.c +++ b/lib/bcheck.c @@ -223,6 +223,9 @@ typedef struct alloca_list_struct { #elif defined(__OpenBSD__) #define BOUND_TID_TYPE pid_t #define BOUND_GET_TID syscall (SYS_getthrid) +#elif defined(__FreeBSD__) +#define BOUND_TID_TYPE pid_t +#define BOUND_GET_TID 0 #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/libtcc.c b/libtcc.c index 2b3c58e4..edac4bcf 100644 --- a/libtcc.c +++ b/libtcc.c @@ -937,8 +937,10 @@ LIBTCCAPI TCCState *tcc_new(void) # ifdef __FreeBSD__ /* define __GNUC__ to have some useful stuff from sys/cdefs.h that are unconditionally used in FreeBSDs other system headers :/ */ - tcc_define_symbol(s, "__GNUC__", "2"); - tcc_define_symbol(s, "__GNUC_MINOR__", "7"); + tcc_define_symbol(s, "__GNUC__", "9"); + tcc_define_symbol(s, "__GNUC_MINOR__", "3"); + tcc_define_symbol(s, "__GNUC_PATCHLEVEL__", "0"); + tcc_define_symbol(s, "__amd64__", "1"); tcc_define_symbol(s, "__builtin_alloca", "alloca"); # endif # else