去除PIE后:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL 0x00 EXECUTE 17 1384 0x00000000
添加PIE后:
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC_64 X86_64 ALL 0x00 EXECUTE 17 1384 PIE
去除代码如下:
#include <mach-o/loader.h>
#include <stdio.h>
int main(int argc, const char * argv[]) {
struct mach_header header;
FILE *file;
if((file =