-
Notifications
You must be signed in to change notification settings - Fork 1
四 Mach O的文件类型
Kevin775263419 edited this page Mar 7, 2019
·
1 revision
-
Mach-O是Mach object的缩写,是Mac\iOS上用于存储程序、库的标准格式。
-
属于Mach-O格式的文件类型有.,大致有这么多类型
-
#define MH_OBJECT 0x1 /* relocatable object file */ #define MH_EXECUTE 0x2 /* demand paged executable file */ #define MH_FVMLIB 0x3 /* fixed VM shared library file */ #define MH_CORE 0x4 /* core file */ #define MH_PRELOAD 0x5 /* preloaded executable file */ #define MH_DYLIB 0x6 /* dynamically bound shared library */ #define MH_DYLINKER 0x7 /* dynamic link editor */ #define MH_BUNDLE 0x8 /* dynamically bound bundle file */ #define MH_DYLIB_STUB 0x9 /* shared library stub for static */ /* linking only, no section contents */ #define MH_DSYM 0xa /* companion file with only debug */ /* sections */
-
可以在xnu源码中,查看到Mach-O格式的详细(https://opensource.apple.com/tarballs/xnu/)
- EXTERNAL_HEADERS/mach-o/fat.h
- EXTERNAL_HEADERS/mach-o/loader.h
- MH_OBJECT
- 目标文件(.o)
- 静态库文件(.a),静态库其实就是N个.o合并在一起
- MH_EXECUTE:可执行文件
- .app/x
- MH_DYLIB:动态库文件
- .dylib
- .framework/xx
- MH_DYLINKER:动态链接编辑器
- /usr/lib/dyld
- MH_DSYM:存储着二进制文件符号信息的文件
- .dSYM/Contents/Resources/DWARF/xx(常用于分析APP的崩溃信息)
- .o文件是中间文件,1.c 编译成1.o 很多的.o文件可以链接成一个可执行文件
- 在Xcode中查看target的Mach-O类型,build settings 搜索Mach -O 可以查看可执行文件的类型,xCode可以看到是Executable类型。