Sorry about last commit. I had no access to a macos machine for a for weeks.
Unified · Split
| @@ -323,7 +323,7 @@ static void cleanup_sections(TCCState *s1) · 322 unmodified lines | ||
| 323 | 323 | |
| 324 | 324 | #ifndef CONFIG_RUNMEM_RO |
| 325 | 325 | # ifdef __APPLE__ |
| 326 | −# define CONFIG_RUNMEM_RO 2 | |
| 326 | +# define CONFIG_RUNMEM_RO 1 | |
| 327 | 327 | # else |
| 328 | 328 | # define CONFIG_RUNMEM_RO 0 |
| 329 | 329 | # endif |
| @@ -359,23 +359,13 @@ redo: · 29 unmodified lines | ||
| 359 | 359 | if (copy == 3) |
| 360 | 360 | return 0; |
| 361 | 361 | |
| 362 | −#if defined TCC_TARGET_MACHO | |
| 363 | − for (k = 0; k < 3; ++k) { /* 0:rx, 1:ro, 3:rw sections */ | |
| 364 | −#else | |
| 365 | 362 | for (k = 0; k < 4; ++k) { /* 0:rx, 1:ro, 2:ro debug , 3:rw sections */ |
| 366 | −#endif | |
| 367 | 363 | n = 0; addr = 0; |
| 368 | 364 | for(i = 1; i < s1->nb_sections; i++) { |
| 369 | −#if defined TCC_TARGET_MACHO | |
| 370 | − static const char shf[] = { | |
| 371 | − SHF_ALLOC|SHF_EXECINSTR, SHF_ALLOC, SHF_ALLOC|SHF_WRITE | |
| 372 | − }; | |
| 373 | −#else | |
| 374 | 365 | static const char shf[] = { |
| 375 | 366 | SHF_ALLOC|SHF_EXECINSTR, SHF_ALLOC, 0, SHF_ALLOC|SHF_WRITE |
| 376 | 367 | }; |
| 377 | 368 | if (k == 2 && s1->do_debug == 0) continue; |
| 378 | −#endif | |
| 379 | 369 | s = s1->sections[i]; |
| 380 | 370 | if (shf[k] != (s->sh_flags & (SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR))) |
| 381 | 371 | continue; |