summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorherman ten brugge <hermantenbrugge@home.nl>2024-02-26 07:18:07 +0100
committerherman ten brugge <hermantenbrugge@home.nl>2024-02-26 07:18:07 +0100
commitf9cb198aa889b011b45f14bb8a79ceba843a1700 (patch)
treefd3b543af808ee9ea492c21a1d9ec4b082ebf93e
parent4e91d38ddcdb659a4b2c298850c6ccf115073748 (diff)
tccrun: update for apple and openbsd
Apple needs CONFIG_RUNMEM_RO=1 I now only set CONFIG_RUNMEM_RO=0 on _WIN32 Openbsd does not have malloc.h so remove some code Also fix some warnings when compiling lib with gcc
-rw-r--r--lib/runmain.c1
-rw-r--r--tccrun.c19
2 files changed, 8 insertions, 12 deletions
diff --git a/lib/runmain.c b/lib/runmain.c
index 53cbe6d..1cbf6dd 100644
--- a/lib/runmain.c
+++ b/lib/runmain.c
@@ -69,6 +69,7 @@ void exit(int code)
f.fp = 0;
f.ip = exit;
__rt_exit(&f, code);
+ for (;;); // avoid noreturn warning
}
#ifndef _WIN32
diff --git a/tccrun.c b/tccrun.c
index 94c61ce..b27ccc5 100644
--- a/tccrun.c
+++ b/tccrun.c
@@ -91,17 +91,6 @@ static void *win64_add_function_table(TCCState *s1);
static void win64_del_function_table(void *);
#endif
-#ifdef __APPLE__
-# define CONFIG_RUNMEM_ALIGNED 0
-#else
-# ifndef CONFIG_RUNMEM_ALIGNED
-# define CONFIG_RUNMEM_ALIGNED 1
-# endif
-# if CONFIG_RUNMEM_ALIGNED
-# include <malloc.h> /* memalign() */
-# endif
-#endif
-
#if !_WIN32 && !__APPLE__
//#define HAVE_SELINUX 1
#endif
@@ -286,7 +275,11 @@ static void cleanup_sections(TCCState *s1)
/* 0 = .text rwx other rw */
/* 1 = .text rx .rdata r .data/.bss rw */
#ifndef CONFIG_RUNMEM_RO
-# define CONFIG_RUNMEM_RO 0
+# ifdef _WIN32
+# define CONFIG_RUNMEM_RO 0
+# else
+# define CONFIG_RUNMEM_RO 1
+# endif
#endif
/* relocate code. Return -1 on error, required size if ptr is NULL,
@@ -1184,7 +1177,9 @@ int _tcc_backtrace(rt_frame *f, const char *fmt, va_list ap)
}
rt_printf("\n");
+#ifndef CONFIG_TCC_BACKTRACE_ONLY
check_break:
+#endif
if (rc2
&& bi.func_pc
&& bi.func_pc == (addr_t)rc2->top_func)