History

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

herman ten brugge committed 2 years ago

Commit f9cb1981 parent 4e91d382 files · +8 −12Browse files

Unified · Split

2 files
  1. lib/runmain.c +1 −0
  2. tccrun.c +7 −12
lib/runmain.c+1−0
@@ -69,6 +69,7 @@ void exit(int code) · 68 unmodified lines
6969 f.fp = 0;
7070 f.ip = exit;
7171 __rt_exit(&f, code);
72+ for (;;); // avoid noreturn warning
7273 }
7374
7475 #ifndef _WIN32
tccrun.c+7−12
@@ -91,17 +91,6 @@ static void *win64_add_function_table(TCCState *s1); · 90 unmodified lines
9191 static void win64_del_function_table(void *);
9292 #endif
9393
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−
10594 #if !_WIN32 && !__APPLE__
10695 //#define HAVE_SELINUX 1
10796 #endif
@@ -286,7 +275,11 @@ static void cleanup_sections(TCCState *s1) · 178 unmodified lines
286275 /* 0 = .text rwx other rw */
287276 /* 1 = .text rx .rdata r .data/.bss rw */
288277 #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
290283 #endif
291284
292285 /* 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
11841177 }
11851178 rt_printf("\n");
11861179
1180+#ifndef CONFIG_TCC_BACKTRACE_ONLY
11871181 check_break:
1182+#endif
11881183 if (rc2
11891184 && bi.func_pc
11901185 && bi.func_pc == (addr_t)rc2->top_func)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t