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
69 f.fp = 0;69 f.fp = 0;
70 f.ip = exit;70 f.ip = exit;
71 __rt_exit(&f, code);71 __rt_exit(&f, code);
72 for (;;); // avoid noreturn warning
72}73}
73 74
74#ifndef _WIN3275#ifndef _WIN32
tccrun.c+7−12
@@ -91,17 +91,6 @@ static void *win64_add_function_table(TCCState *s1); · 90 unmodified lines
91static void win64_del_function_table(void *);91static void win64_del_function_table(void *);
92#endif92#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#if !_WIN32 && !__APPLE__94#if !_WIN32 && !__APPLE__
106//#define HAVE_SELINUX 195//#define HAVE_SELINUX 1
107#endif96#endif
@@ -286,7 +275,11 @@ static void cleanup_sections(TCCState *s1) · 178 unmodified lines
286/* 0 = .text rwx other rw */275/* 0 = .text rwx other rw */
287/* 1 = .text rx .rdata r .data/.bss rw */276/* 1 = .text rx .rdata r .data/.bss rw */
288#ifndef CONFIG_RUNMEM_RO277#ifndef CONFIG_RUNMEM_RO
289# define CONFIG_RUNMEM_RO 0278# ifdef _WIN32
279# define CONFIG_RUNMEM_RO 0
280# else
281# define CONFIG_RUNMEM_RO 1
282# endif
290#endif283#endif
291 284
292/* relocate code. Return -1 on error, required size if ptr is NULL,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 rt_printf("\n");1178 rt_printf("\n");
1186 1179
1180#ifndef CONFIG_TCC_BACKTRACE_ONLY
1187 check_break:1181 check_break:
1182#endif
1188 if (rc21183 if (rc2
1189 && bi.func_pc1184 && bi.func_pc
1190 && bi.func_pc == (addr_t)rc2->top_func)1185 && 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