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 | #ifndef CONFIG_RUNMEM_RO | 324 | #ifndef CONFIG_RUNMEM_RO |
| 325 | # ifdef __APPLE__ | 325 | # ifdef __APPLE__ |
| 326 | # define CONFIG_RUNMEM_RO 2 | 326 | # define CONFIG_RUNMEM_RO 1 |
| 327 | # else | 327 | # else |
| 328 | # define CONFIG_RUNMEM_RO 0 | 328 | # define CONFIG_RUNMEM_RO 0 |
| 329 | # endif | 329 | # endif |
| @@ -359,23 +359,13 @@ redo: · 29 unmodified lines | |||
| 359 | if (copy == 3) | 359 | if (copy == 3) |
| 360 | return 0; | 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 | for (k = 0; k < 4; ++k) { /* 0:rx, 1:ro, 2:ro debug , 3:rw sections */ | 362 | for (k = 0; k < 4; ++k) { /* 0:rx, 1:ro, 2:ro debug , 3:rw sections */ |
| 366 | #endif | ||
| 367 | n = 0; addr = 0; | 363 | n = 0; addr = 0; |
| 368 | for(i = 1; i < s1->nb_sections; i++) { | 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 | static const char shf[] = { | 365 | static const char shf[] = { |
| 375 | SHF_ALLOC|SHF_EXECINSTR, SHF_ALLOC, 0, SHF_ALLOC|SHF_WRITE | 366 | SHF_ALLOC|SHF_EXECINSTR, SHF_ALLOC, 0, SHF_ALLOC|SHF_WRITE |
| 376 | }; | 367 | }; |
| 377 | if (k == 2 && s1->do_debug == 0) continue; | 368 | if (k == 2 && s1->do_debug == 0) continue; |
| 378 | #endif | ||
| 379 | s = s1->sections[i]; | 369 | s = s1->sections[i]; |
| 380 | if (shf[k] != (s->sh_flags & (SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR))) | 370 | if (shf[k] != (s->sh_flags & (SHF_ALLOC|SHF_WRITE|SHF_EXECINSTR))) |
| 381 | continue; | 371 | continue; |