From 9675c1e245ccd7c0ded72cab9a95831faa3f3d97 Mon Sep 17 00:00:00 2001 From: herman ten brugge Date: Sun, 3 Mar 2024 06:41:27 +0100 Subject: [PATCH] Use CONFIG_RUNMEM_RO=1 on apple --- tccrun.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tccrun.c b/tccrun.c index 03e752aa..95d667cb 100644 --- a/tccrun.c +++ b/tccrun.c @@ -289,8 +289,16 @@ static void cleanup_sections(TCCState *s1) /* 0 = .text rwx other rw */ /* 1 = .text rx .rdata r .data/.bss rw */ +/* Some targets implement secutiry options that do not allow write in + executable code. These targets need CONFIG_RUNMEM_RO=1. + The disadvantage of this is that it requires a little bit more memory. */ + #ifndef CONFIG_RUNMEM_RO -# define CONFIG_RUNMEM_RO 0 +# ifdef __APPLE__ +# define CONFIG_RUNMEM_RO 1 +# else +# define CONFIG_RUNMEM_RO 0 +# endif #endif /* relocate code. Return -1 on error, required size if ptr is NULL,