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
Unified · Split
| @@ -69,6 +69,7 @@ void exit(int code) · 68 unmodified lines | ||
| 69 | 69 | f.fp = 0; |
| 70 | 70 | f.ip = exit; |
| 71 | 71 | __rt_exit(&f, code); |
| 72 | + for (;;); // avoid noreturn warning | |
| 72 | 73 | } |
| 73 | 74 | |
| 74 | 75 | #ifndef _WIN32 |
| @@ -91,17 +91,6 @@ static void *win64_add_function_table(TCCState *s1); · 90 unmodified lines | ||
| 91 | 91 | static void win64_del_function_table(void *); |
| 92 | 92 | #endif |
| 93 | 93 | |
| 94 | −#ifdef __APPLE__ | |
| 95 | −# define CONFIG_RUNMEM_ALIGNED 0 | |
| 96 | −#else | |
| 97 | −# ifndef CONFIG_RUNMEM_ALIGNED | |
| 98 | −# define CONFIG_RUNMEM_ALIGNED 1 | |
| 99 | −# endif | |
| 100 | −# if CONFIG_RUNMEM_ALIGNED | |
| 101 | −# include <malloc.h> /* memalign() */ | |
| 102 | −# endif | |
| 103 | −#endif | |
| 104 | − | |
| 105 | 94 | #if !_WIN32 && !__APPLE__ |
| 106 | 95 | //#define HAVE_SELINUX 1 |
| 107 | 96 | #endif |
| @@ -286,7 +275,11 @@ static void cleanup_sections(TCCState *s1) · 178 unmodified lines | ||
| 286 | 275 | /* 0 = .text rwx other rw */ |
| 287 | 276 | /* 1 = .text rx .rdata r .data/.bss rw */ |
| 288 | 277 | #ifndef CONFIG_RUNMEM_RO |
| 289 | −# define CONFIG_RUNMEM_RO 0 | |
| 278 | +# ifdef _WIN32 | |
| 279 | +# define CONFIG_RUNMEM_RO 0 | |
| 280 | +# else | |
| 281 | +# define CONFIG_RUNMEM_RO 1 | |
| 282 | +# endif | |
| 290 | 283 | #endif |
| 291 | 284 | |
| 292 | 285 | /* 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) · 891 unmodified lines | ||
| 1184 | 1177 | } |
| 1185 | 1178 | rt_printf("\n"); |
| 1186 | 1179 | |
| 1180 | +#ifndef CONFIG_TCC_BACKTRACE_ONLY | |
| 1187 | 1181 | check_break: |
| 1182 | +#endif | |
| 1188 | 1183 | if (rc2 |
| 1189 | 1184 | && bi.func_pc |
| 1190 | 1185 | && bi.func_pc == (addr_t)rc2->top_func) |