diff --git a/src/common/objects/autosegs.cpp b/src/common/objects/autosegs.cpp index 4840d1319..4d5bdba74 100644 --- a/src/common/objects/autosegs.cpp +++ b/src/common/objects/autosegs.cpp @@ -49,6 +49,7 @@ #include #elif defined __MACH__ #include +#include #endif @@ -101,10 +102,12 @@ void FAutoSeg::Initialize() #elif defined __MACH__ - if (const struct section_64 *const section = getsectbyname(AUTOSEG_MACH_SEGMENT, name)) + unsigned long size; + + if (uint8_t *const section = getsectiondata(&_mh_execute_header, AUTOSEG_MACH_SEGMENT, name, &size)) { - begin = reinterpret_cast(section->addr); - end = reinterpret_cast(section->addr + section->size); + begin = reinterpret_cast(section); + end = reinterpret_cast(section + size); } #else // Linux and others with ELF executables