Mach-O(Mach Object File Format,wiki,chs)是macOS、iOS、iPadOS上的可執行文件格式,類似於 Linux(UNIX )的ELF以及 Windows 上的PE。
具體格式包括:*.a(靜態庫) 、*.dylib(動態庫)、可執行文件、*.o(中間文件)、*.dSYM(調試符號)。一個Mach-O文件中,可以包含多個架構(如同時包含armv7、arm64)。
file ./Test1 // 通過file命令來查看當前目錄可執行二進制Test1的架構信息
admin@NICOCHEN-MC4 Test1.app % file Test1 Test1: Mach-O universal binary with 2 architectures: [arm_v7:Mach-O executable arm_v7] [arm64:Mach-O 64-bit executable arm64] Test1 (for architecture armv7): Mach-O executable arm_v7 Test1 (for architecture arm64): Mach-O 64-bit executable arm64
otool -f -V ./Test1 // 通過otool命令查看當前目錄可執行二進制Test1的架構信息
Fat headers fat_magic FAT_MAGIC nfat_arch 2 architecture armv7 cputype CPU_TYPE_ARM cpusubtype CPU_SUBTYPE_ARM_V7 capabilities 0x0 offset 16384 size 79488 align 2^14 (16384) architecture arm64 cputype CPU_TYPE_ARM64 cpusubtype CPU_SUBTYPE_ARM64_ALL capabilities 0x0 offset 98304 size 80208 align 2^14 (16384)
設置Test1的Architectures為armv7和arm4,目標設備設置為Any iOS Device(armv7, arm64)

/Users/admin/Library/Developer/Xcode/DerivedData/Test1-enpnmzugwpjxckbyiyimrjuwqjqk/Build/Products/Debug-iphoneos/Test1.app 注:Xcode輸出路徑在Preferences面板的Locations標簽中指定

lipo -thin armv7 ./Test1 -o Test1_v7 // 將當前目錄中Test1的armv7架構保存到獨立的Test1_v7可執行文件中 注:Test1_v7的架構僅包含armv7
lipo -remove arm64e ./Test1 -o Test2 // 去掉當前目錄中Test1的arm64e架構保存到獨立的Test2可執行文件中
MachO文件結構
以UAGame的shipping版iOS可執行文件為例

注: 可執行文件被簽名后,會增加一個Code Signature段,如上圖最后面的那個段
字段說明
| 字段 | 含義 |
| Mach64 Header | 描述了 Mach-O 的魔數、CPU 架構、文件類型以及加載命令(Load Commands)等信息 注:魔數為MH_MAGIC_64表示大端序,為MH_CIGAM_64表示小端序 |
| Load Commands | load commands會指導動態加載器(dyld)該如何加載Mach-O文件 |
| __PAGEZERO | Catch訪問NULL指針的非法操作的段 |
| __TEXT | 為代碼段、只讀數據段 |
| __DATA | 可讀寫數據段 |
| LC_LOAD_DYLINKER | 指定了dyld所在的路徑為/usr/lib/dyld |
| LC_UUID | 記錄了當前MachO文件的uuid值 |
| LC_VERSION_MIN_IPHONEOS | 最小可運行的iphone os版本 |
| LC_MAIN | main函數地址(entry point) |
| LC_LOAD_DYLIB | 類似於強引用當前庫。如果無法成功load當前庫,就會報錯,導致啟動失敗 |
| LC_LOAD_WEAK_DYLIB | 類似於弱引用,如果加載路徑下有這個庫,就引入;否則可以不引入。不影響使用 |
| LC_SYMTAB | 指向symbol table和string table。symbol table包含了可執行的鏡像文件所用到的所有符號信息。 注:符號名在symbol table只存了一個string index索引值,具體的字符串存放在string table中。 |
| LC_DYSYMTAB | 指向indirect symbol table,為一個index 數組,即每個條目的內容是一個 index 值,該index 值(從 0 開始)指向到symbol table中的條目。 該表是為__stubs、__nl_symbol_ptr、__got、__la_symbol_ptr段服務的 Indirect symbols for (__TEXT,__stubs) 1 entries Indirect symbols for (__DATA,__nl_symbol_ptr) 2 entries 0x0000000000002008 ABSOLUTE Indirect symbols for (__DATA,__got) 1 entries Indirect symbols for (__DATA,__la_symbol_ptr) 1 entries 可通過otool -I ./UAGame-IOS-Shipping命令來查看其內容 |
otool -L ./UAGame-IOS-Shipping // 查看可執行文件UAGame-IOS-Shipping依賴的第三方動態鏈接庫 注:該命令會讀取LC_LOAD_DYLIB和LC_LOAD_WEAK_DYLIB的信息
./UAGame-IOS-Shipping: /System/Library/Frameworks/QuartzCore.framework/QuartzCore (compatibility version 1.2.0, current version 1.11.0) /System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 5067.3.107) /System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1854.0.0) /System/Library/Frameworks/AudioToolbox.framework/AudioToolbox (compatibility version 1.0.0, current version 1000.0.0) /System/Library/Frameworks/AVFoundation.framework/AVFoundation (compatibility version 1.0.0, current version 2.0.0) /System/Library/Frameworks/GameKit.framework/GameKit (compatibility version 1.0.0, current version 810.63.3) /System/Library/Frameworks/StoreKit.framework/StoreKit (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/CoreVideo.framework/CoreVideo (compatibility version 1.2.0, current version 1.5.0) /System/Library/Frameworks/CoreMedia.framework/CoreMedia (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/CoreGraphics.framework/CoreGraphics (compatibility version 64.0.0, current version 1548.1.3) /System/Library/Frameworks/GameController.framework/GameController (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/SystemConfiguration.framework/SystemConfiguration (compatibility version 1.0.0, current version 1163.10.2) /System/Library/Frameworks/DeviceCheck.framework/DeviceCheck (compatibility version 1.0.0, current version 1.0.0, weak) /System/Library/Frameworks/UserNotifications.framework/UserNotifications (compatibility version 1.0.0, current version 1.0.0, weak) /System/Library/Frameworks/CoreMotion.framework/CoreMotion (compatibility version 1.0.0, current version 2663.0.3) /System/Library/Frameworks/AdSupport.framework/AdSupport (compatibility version 1.0.0, current version 1.0.0, weak) /System/Library/Frameworks/WebKit.framework/WebKit (compatibility version 1.0.0, current version 612.1.27) /System/Library/Frameworks/iAd.framework/iAd (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/CoreAudio.framework/CoreAudio (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/CoreTelephony.framework/CoreTelephony (compatibility version 1.0.0, current version 0.0.0) /System/Library/Frameworks/Security.framework/Security (compatibility version 1.0.0, current version 60157.12.1) /System/Library/Frameworks/CFNetwork.framework/CFNetwork (compatibility version 1.0.0, current version 1312.0.0) /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore (compatibility version 1.0.0, current version 612.1.27) /System/Library/Frameworks/CoreText.framework/CoreText (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/CoreImage.framework/CoreImage (compatibility version 1.0.0, current version 5.0.0) /System/Library/Frameworks/ImageIO.framework/ImageIO (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AssetsLibrary.framework/AssetsLibrary (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/Accelerate.framework/Accelerate (compatibility version 1.0.0, current version 4.0.0) /System/Library/Frameworks/VideoToolbox.framework/VideoToolbox (compatibility version 1.0.0, current version 1.0.0, weak) /System/Library/Frameworks/MobileCoreServices.framework/MobileCoreServices (compatibility version 1.0.0, current version 1141.1.0) /System/Library/Frameworks/EventKit.framework/EventKit (compatibility version 1.0.0, current version 1716.0.0) /System/Library/Frameworks/Photos.framework/Photos (compatibility version 1.0.0, current version 402.5.140) /System/Library/Frameworks/MediaPlayer.framework/MediaPlayer (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/MapKit.framework/MapKit (compatibility version 1.0.0, current version 14.0.0) /System/Library/Frameworks/CoreLocation.framework/CoreLocation (compatibility version 1.0.0, current version 2663.0.3) /System/Library/Frameworks/CoreData.framework/CoreData (compatibility version 1.0.0, current version 1132.0.0) /System/Library/Frameworks/EventKitUI.framework/EventKitUI (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/MessageUI.framework/MessageUI (compatibility version 1.0.0, current version 3693.0.2) /System/Library/Frameworks/Social.framework/Social (compatibility version 1.0.0, current version 87.0.0) /System/Library/Frameworks/Metal.framework/Metal (compatibility version 1.0.0, current version 257.25.0, weak) /System/Library/Frameworks/OpenAL.framework/OpenAL (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/OpenGLES.framework/OpenGLES (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/MediaToolbox.framework/MediaToolbox (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AdServices.framework/AdServices (compatibility version 1.0.0, current version 1.0.0, weak) /System/Library/Frameworks/AppTrackingTransparency.framework/AppTrackingTransparency (compatibility version 1.0.0, current version 1.0.0, weak) /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0) /usr/lib/libsqlite3.dylib (compatibility version 9.0.0, current version 329.0.0) /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1200.3.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11) /usr/lib/libresolv.9.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0) /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.8) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.0.0) /System/Library/Frameworks/AVKit.framework/AVKit (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1854.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
注1:Frameworks是一種打包方式,里面既可以是動態庫也可以是靜態庫。它將庫的二進制文件,頭文件和有關的資源文件打包到一起,方便管理和分發。
注2:如果ipa也可以帶有自己的Frameworks動態庫,這些動態庫會被打進ipa包的Frameworks目錄中。

注3:打進ipa包中的動態庫Framework的可執行二進制,都需要單獨簽名,且簽名要與應用可執行二進制(UAGame)一致,否則在加載這些動態庫時會報如下錯誤:
'/private/var/containers/Bundle/Application/A0ABF211-972C-4EA3-B60C-5A7CBF0C0C64/UAGame.app/Frameworks/VideoRecord.framework/VideoRecord' (code signature in <26506C81-57B4-320A-956D-46F033F8B76C> '/private/var/containers/Bundle/Application/A0ABF211-972C-4EA3-B60C-5A7CBF0C0C64/UAGame.app/Frameworks/VideoRecord.framework/VideoRecord' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs),
xcrun size -lm UAGame-IOS-Shipping // 查看可執行文件UAGame-IOS-Shipping各段的size、起始地址和offset信息
Segment __PAGEZERO: 4294967296 (zero fill) (vmaddr 0x0 fileoff 0) Segment __TEXT: 140509184 (vmaddr 0x100000000 fileoff 0) Section __text: 123041436 (addr 0x100004000 offset 16384) Section __stubs: 96420 (addr 0x10755b69c offset 123057820) Section __stub_helper: 17496 (addr 0x107572f40 offset 123154240) Section __gcc_except_tab: 1825508 (addr 0x107577398 offset 123171736) Section __objc_classname: 67062 (addr 0x107734e7c offset 124997244) Section __objc_methname: 596059 (addr 0x107745472 offset 125064306) Section __objc_methtype: 389599 (addr 0x1077d6ccd offset 125660365) Section __cstring: 4263151 (addr 0x107835eb0 offset 126049968) Section __const: 4527489 (addr 0x107c46bc0 offset 130313152) Section __ustring: 4655330 (addr 0x108098142 offset 134840642) Section __unwind_info: 648680 (addr 0x108508a24 offset 139495972) Section __eh_frame: 359932 (addr 0x1085a7010 offset 140144656) total 140488162 Segment __DATA: 31440896 (vmaddr 0x108600000 fileoff 140509184) Section __got: 18528 (addr 0x108600000 offset 140509184) Section __la_symbol_ptr: 64280 (addr 0x108604860 offset 140527712) Section __mod_init_func: 19480 (addr 0x108614378 offset 140591992) Section __const: 14553312 (addr 0x108619000 offset 140611584) Section __cfstring: 473664 (addr 0x1093fa0e0 offset 155164896) Section __objc_classlist: 22648 (addr 0x10946db20 offset 155638560) Section __objc_nlclslist: 536 (addr 0x109473398 offset 155661208) Section __objc_catlist: 280 (addr 0x1094735b0 offset 155661744) Section __objc_nlcatlist: 48 (addr 0x1094736c8 offset 155662024) Section __objc_protolist: 2872 (addr 0x1094736f8 offset 155662072) Section __objc_imageinfo: 8 (addr 0x109474230 offset 155664944) Section __objc_const: 2242360 (addr 0x109474238 offset 155664952) Section __objc_selrefs: 146928 (addr 0x109697970 offset 157907312) Section __objc_protorefs: 320 (addr 0x1096bb760 offset 158054240) Section __objc_classrefs: 20936 (addr 0x1096bb8a0 offset 158054560) Section __objc_superrefs: 13120 (addr 0x1096c0a68 offset 158075496) Section __objc_ivar: 46420 (addr 0x1096c3da8 offset 158088616) Section __objc_data: 282008 (addr 0x1096cf300 offset 158135040) Section __data: 1099512 (addr 0x1097140a0 offset 158417056) Section __thread_vars: 96 (addr 0x109820798 offset 159516568) Section __thread_bss: 69 (addr 0x1098207f8 zerofill) Section __bss: 10328904 (addr 0x109820840 zerofill) Section __common: 2087360 (addr 0x10a1fb000 zerofill) total 31423689 Segment __LINKEDIT: 5301728 (vmaddr 0x10a3fc000 fileoff 159531008) total 4472219104
不同段的說明
| 段名 | 類別 | 說明 |
| __text | __TEXT | 主程序代碼 otool -tv ./UAGame-IOS-Shipping // 查看可執行文件UAGame-IOS-Shipping代碼段反編譯內容 |
| __stubs | __TEXT | __stubs是一個表,每項是一小段會直接跳入laze binding的表對應項指針指向地址的代碼(樁代碼),存儲外部函數 otool ./UAGame-IOS-Shipping -s __TEXT __stubs |
| __stub_helper | __TEXT | 輔助函數,上述提到的laze binding的表中對應項的指針在沒有找到真正的符號地址的時候,都指向這里 otool -v ./UAGame-IOS-Shipping -s __TEXT __stub_helper |
| __gcc_except_tab | __TEXT | gcc異常表 |
| __objc_classname | __TEXT | OC類名和用到的系統Protocol名稱 |
| __objc_methname | __TEXT | OC方法名稱 |
| __objc_methtype | __TEXT | OC方法類型 |
| __cstring | __TEXT | C語言字符串 |
| __const | __TEXT | const 關鍵字修飾的常量 |
| __ustring | __TEXT | unicode字符串 |
| __unwind_info | __TEXT | 用來存儲處理異常情況信息 |
| __eh_frame | __TEXT | 調試符號信息 |
| __got | __DATA | 用來存放外部全局變量/常量的最終地址值。在程序運行前(加載時)就會被綁定(non-lazy binding) 對於程序段__text里的代碼,對外部數據型符號的引用,會指向__got段 otool ./UAGame-IOS-Shipping -s __DATA __got |
| __la_symbol_ptr | __DATA | lazy綁定符號指針,表中的指針一開始都指向__stub_helper otool ./UAGame-IOS-Shipping -s __DATA __la_symbol_ptr |
| __nl_symbol_ptr | __DATA | 非lazy綁定符號指針,表中的數據為綁定后的地址(在加載時綁定好) 注:__got是為__text代碼段中的符號服務的,而__nl_symbol_ptr不是 |
| __mod_init_func | __DATA | 初始化函數,C++靜態初始化、attribute等 |
| __mod_term_func | __DATA | 終止函數,main函數返回之后調用 |
| __const | __DATA | 未初始化過的常量 |
| __cfstring | __DATA | CFStringRefs字符串 |
| __objc_classlist | __DATA | OC類列表 |
| __objc_nlclslist | __DATA | 實現了+(void)load方法的類 注1:load方法是OC中一個特殊方法,在main函數之前,裝載類信息時就會調用執行 注2:load方法可以繼承。調用子類的load方法之前,會先調用父類的load方法。 |
| __objc_catlist | __DATA | 記錄所有Category(分類) 注:Category只能為已經存在的類添加方法,而不能添加成員變量 |
| __objc_nlcatlist | __DATA | 實現了+(void)load方法的Category(分類) 注1:Category(分類)也可以有load方法 注2:優先調用類的load方法,之后再調用Category(分類)的load方法 |
| __objc_protolist | __DATA | OC原型列表 |
| __objc_imageinfo | __DATA | OC二進制信息 |
| __objc_const | __DATA | OC常量 |
| __objc_selrefs | __DATA | OC self引用 |
| __objc_protorefs | __DATA | OC原型引用 |
| __objc_classrefs | __DATA | OC原型引用(類方法) |
| __objc_superrefs | __DATA | OC超類引用 |
| __objc_ivar | __DATA | OC成員變量 |
| __objc_data | __DATA | OC類信息,包括Meta_Class |
| __data | __DATA | 初始化過的全局變量 |
| __thread_vars | __DATA | 與線程局部存儲(TLS)有關 |
| __thread_data | __DATA | 同上 |
| __thread_bss | __DATA | 同上 |
| __bss | __BSS | 未初始化過或初始化為0的全局變量 |
| __common | __BSS | 未初始化過的符號聲明 |
| Dynamic Loader Info | 動態加載信息 ① Rebase info:修復的是指向當前鏡像內部的資源指針(mach-o每次加載到內存中不是固定的地址) ② Binding info:將外部符號進行綁定的過程 ③ Weak Binding Info:針對弱符號進行綁定的過程, 在c語言中,函數、初始化的全局變量、static變量是強符號,未初始化的全局變量是弱符號。 weakBinding這一步會把鏡像中所有含有弱符號的映像合並成一個列表,再進行binding.。所以這一步放在最后,等加載完成后在做操作。 ④ Lazy Binding Info:在加載動態庫的時候不會立即binding, 當時當第一次調用這個方法的時候再實施binding。 ⑤ Export Info:導出的函數 |
|
| Function Starts | 入口函數
|
|
| Data in Code Entries | 代碼入口數據
|
|
| Symbol Table | 所有符號表信息。包含調試符號、導出符號(MachOView中底色為黃色)和導入符號(MachOView中底色為綠色) 注:debug版在該Table中會包含大量調試符號
nm UAGame-IOS-Shipping // 查看可執行文件UAGame-IOS-Shipping中的符號 注:從Xcode8開始,蘋果在mac上nm工具使用的就是llvm-nm工具 // 更多詳見:mac下nm命令詳解 0000000100d523f8 T __Z11fMultIfloorii // T為導出符號(函數) 0000000100d57da0 T __Z12cplxMultDiv2PiS_ii8FIXP_DPK 0000000100d4e044 T __Z12cplxMultDiv2PiS_iiii 0000000100d4dfdc T __Z12fMultAddDiv2iii 0000000100d23f7c T __Z12fPow2AddDiv2ii 0000000100d2d770 T __Z13fixmuldiv2_DDii 0000000100d61ed0 T __Z13fixmuldiv2_DSis 0000000100d31978 T __Z13fixmuldiv2_SDsi 0000000100d42d7c T __Z13fixmuldiv2_SSss 0000000100d23fa8 T __Z13fixpadddiv2_Dii 0000000100d322b4 T __Z13fixpow2div2_Di 。。。 。。。 000000010a874a50 D _gSimd4fEpsilon // D為導出符號(變量) 000000010a874a60 D _gSimd4fFloatMax 000000010a874a20 D _gSimd4fHalf 000000010a874a70 D _gSimd4fMaskX 000000010a874a90 D _gSimd4fMaskXYZ 000000010a874a10 D _gSimd4fMinusOne 000000010a874a40 D _gSimd4fPi 000000010a874a30 D _gSimd4fTwo 000000010a874aa8 D _gSimd4iOne 。。。 。。。 U _xmlReadMemory // U為導入符號 U _xmlSearchNs U _xmlSearchNsByHref U _xmlSetNs U _xmlSetTreeDoc U _xmlStrEqual |
|
| Dynamic Symbol Table | 動態符號表。只包含導出符號和導入符號 | |
| String Table | 符號名表 |
Category(分類)
運行時(runtime)會將Category(分類)結構體中的instanceMethods(實例方法), protocols(協議),instanceProperties(實例屬性 注:實例屬性不是實例變量)添加到target class的實例方法列表,協議列表,屬性列表中,
會將Category(分類)結構體中的classMethods(類方法)添加到target class所對應的元類的實例方法列表中。
經過這一番修改,Category(分類)中的方法,就變成了target class方法列表中的一部分。
Lazy Binding
首次訪問外部的_say函數時:
① _say對應的__la_symbol_ptr條目內容指向到__stub_helper
② __stub_helper里的代碼邏輯,通過各種輾轉最終調用dyld_stub_binder函數(dyld_stub_binder函數定義於dyld_stub_binder.S,由 dyld 提供)
③ dyld_stub_binder函數通過調用 dyld 內部的函數找到_say符號的真實地址
④ dyld_stub_binder將地址寫入__la_symbol_ptr條目
⑤ dyld_stub_binder跳轉到_say符號的真實地址
之后再次訪問_say函數時,__stubs 里的 jmp 指令直接跳轉符號的真實地址,因為該地址已經被寫到__la_symbol_ptr條目中。
不同配置的統計項的大小
| 統計項 | Debug | Development | Test | Shipping |
| 可執行文件大小 | 879 MB | 509 MB | 396 MB | 154 MB |
| __text | 0cf739a0 | 0a13058c | 08df86d4 | 07274780 |
| __stubs | 00018eac | 00014040 | 00014004 | 00013db8 |
| __stub_helper | 00004704 | 00004680 | 00004644 | 00004404 |
| __gcc_except_tab | 001ad780 | 001cd528 | 001c9d4c | 001b96a0 |
| __objc_classname | 00010020 | 000101a6 | 00010020 | 00010020 |
| __objc_methname | 000919bc | 00091bf3 | 00091956 | 00091848 |
| __objc_methtype | 0006127c | 000624bc | 000610e7 | 000610e7 |
| __cstring | 0050d00d | 004c5dff | 00426edd | 003b40ac |
| __const | 00652f31 | 0068d781 | 0067c0e1 | 0043a741 |
| __ustring | 0065e7ea | 0065b7d2 | 00536e38 | 0045e17c |
| __unwind_info | 000d49bc | 000c51d0 | 000c2f44 | 000998ac |
| __eh_frame | 000c5bbc | 000c5eb8 | 000c5eb8 | 00057dfc |
| __got | 00003cc8 | 00003c98 | 00003c58 | 00003460 |
| __la_symbol_ptr | 000109c8 | 0000d580 | 0000d558 | 0000d3d0 |
| __nl_symbol_ptr | 無 | 無 | 無 | 無 |
| __mod_init_func | 00005220 | 00005188 | 00005100 | 00004c48 |
| __mod_term_func | 無 | 無 | 無 | 無 |
| __const | 00f29278 | 00ec7088 | 00e6cd40 | 00d9d1d0 |
| __cfstring | 00074f00 | 00074fe0 | 00074e80 | 00074a00 |
| __objc_classlist | 000056a0 | 00005700 | 000056a0 | 000056a0 |
| __objc_nlclslist | 00000218 | 00000218 | 00000218 | 00000218 |
| __objc_catlist | 00000118 | 00000118 | 00000118 | 00000118 |
| __objc_nlcatlist | 00000030 | 00000030 | 00000030 | 00000030 |
| __objc_protolist | 00000b30 | 00000b40 | 00000b30 | 00000b30 |
| __objc_imageinfo | 00000008 | 00000008 | 00000008 | 00000008 |
| __objc_const | 00223148 | 00224790 | 00223068 | 00222ec8 |
| __objc_selrefs | 00024248 | 00024288 | 00024238 | 000241d8 |
| __objc_protorefs | 00000140 | 00000148 | 00000140 | 00000140 |
| __objc_classrefs | 00005048 | 000050a0 | 00005040 | 00005038 |
| __objc_superrefs | 00003208 | 00003258 | 00003208 | 00003208 |
| __objc_ivar | 0000b04c | 0000b0fc | 0000b030 | 0000b024 |
| __objc_data | 00036240 | 00036600 | 00036240 | 00036240 |
| __data | 001a1af8 | 0017cfd0 | 0015b6c8 | 0010fec8 |
| __thread_vars | 00000138 | 00000138 | 00000138 | 00000060 |
| __thread_data | 00000008 | 00000008 | 00000008 | 00000000 |
| __thread_bss | 00000070 | 00000070 | 00000068 | 00000045 |
| __bss | 0119fff0 | 0118b8c8 | 01134148 | 009ce578 |
| __common | 00426b88 | 00424b88 | 003e4b88 | 002049c0 |
注:UE4的shipping包的可執行二進制在生成完dSYM符號文件之后,會執行strip命令清除調試相關的信息 詳見:IOSToolChain.cs中的PostBuild函數
參考
How to optimize today’s headline IOS installation package
今日頭條優化實踐: iOS 包大小二進制優化,一行代碼減少 60 MB 下載大小
[今日頭條]iOS 包大小二進制優化,一行代碼減少 60 MB 下載大小



