diff --git a/src/binary/mach-o.hpp b/src/binary/mach-o.hpp index 66046fe..658f6c1 100644 --- a/src/binary/mach-o.hpp +++ b/src/binary/mach-o.hpp @@ -153,9 +153,9 @@ namespace detail { } else { fat_index = 0; if(is_magic_64(magic)) { - load_mach<64>(false); + load_mach<64>(); } else { - load_mach<32>(false); + load_mach<32>(); } } } @@ -393,9 +393,7 @@ namespace detail { private: template - void load_mach( - bool allow_arch_mismatch - ) { + void load_mach() { static_assert(Bits == 32 || Bits == 64, "Unexpected Bits argument"); bits = Bits; using Mach_Header = typename std::conditional::type; @@ -405,17 +403,6 @@ namespace detail { if(should_swap()) { swap_mach_header(header); } - thread_local static struct LP(mach_header)* mhp = _NSGetMachExecuteHeader(); - if( - header.cputype != mhp->cputype || - static_cast(mhp->cpusubtype & ~CPU_SUBTYPE_MASK) != header.cpusubtype - ) { - if(allow_arch_mismatch) { - return; - } else { - throw std::runtime_error("Mach-O file cpu type and subtype do not match current machine " + object_path); - } - } cputype = header.cputype; cpusubtype = header.cpusubtype; filetype = header.filetype; @@ -496,9 +483,9 @@ namespace detail { fat_index = best - fat_arches.data(); fprintf(stderr, "INDEX: %llu\n", to_ull(fat_index)); if(is_magic_64(magic)) { - load_mach<64>(true); + load_mach<64>(); } else { - load_mach<32>(true); + load_mach<32>(); } return; }