diff --git a/src/Makefile b/src/Makefile index 9e69ce91..552535cb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,7 +10,7 @@ export SHELL = /bin/sh # build configuration options for this Makefile BUILD_TYPE_DEBUG ?= 1 -BUILD_TYPE_SANITIZE ?= 1 +BUILD_TYPE_SANITIZE ?= 0 BUILD_USE_DEPEND ?= 1 ifndef srcdir diff --git a/src/p_mach.cpp b/src/p_mach.cpp index c8ce9db7..69cfccae 100644 --- a/src/p_mach.cpp +++ b/src/p_mach.cpp @@ -1844,6 +1844,17 @@ bool PackMachBase::canPack() headway -= ((Mach_command const *)ptr)->cmdsize; if (lc_seg == segptr->cmd) { msegcmd[j] = *segptr; + if (!strcmp("__TEXT", segptr->segname)) { + Mach_section_command const *secp = + (Mach_section_command const *)(const void*)(const char*)(1+ segptr); + unsigned const offset = secp->offset; + if (offset < file_size) { + struct l_info h; + fi->seek(offset, SEEK_SET); + fi->readx(&h, sizeof(h)); + checkAlreadyPacked(&h, sizeof(h)); + } + } if (!strcmp("__DATA", segptr->segname)) { prev_mod_init_func = get_mod_init_func(segptr); } @@ -1896,7 +1907,7 @@ bool PackMachBase::canPack() if (vma_max < t) { vma_max = t; } - // Segments need not be contigous {esp. "rust") + // Segments need not be contigous (esp. "rust"/"go") sz_segment = msegcmd[j].filesize + msegcmd[j].fileoff - msegcmd[0].fileoff; } }