226 lines · plain
1## Tests that lld correctly resolves the custom personality referenced by objc code in an archive.2 3# REQUIRES: x864# RUN: rm -rf %t; split-file %s %t5# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-iossimulator %t/defined.s -o %t/defined.o6# RUN: yaml2obj %t/combined.yaml > %t/combined.o7# RUN: llvm-ar r %t/pack.a %t/defined.o %t/combined.o8# RUN: %no-arg-lld -dylib -arch x86_64 -platform_version ios-simulator 12.0.0 15.0 -ObjC %t/pack.a -o %t/a.dylib9# RUN: llvm-objdump --macho --syms %t/a.dylib | FileCheck %s10# RUN: %no-arg-lld -dylib -arch x86_64 -platform_version ios-simulator 12.0.0 15.0 -ObjC --start-lib %t/defined.o %t/combined.o --end-lib -o %t/a.dylib11# RUN: llvm-objdump --macho --syms %t/a.dylib | FileCheck %s12 13# CHECK: SYMBOL TABLE:14# CHECK: {{.*}} l F __TEXT,__text _my_personality15 16 17#--- defined.s18.private_extern _my_personality19 20.text21.no_dead_strip _my_personality22_my_personality:23.cfi_startproc24.cfi_def_cfa_offset 1625.cfi_endproc26nop27.subsections_via_symbols28 29## combined.yaml is produced from combined.o below:30## lvm-mc -filetype=obj -triple=x86_64-apple-iossimulator %t/objc.s -o %t/objc.o31## ld -r -o combined.o defined.o objc.o32## // objc.s:33## .section __TEXT,__text34## .global _OBJC_CLASS_$_MyTest35## .no_dead_strip _OBJC_CLASS_$_MyTest36## _OBJC_CLASS_$_MyTest:37## .cfi_startproc38## .cfi_personality 155, _my_personality39## .cfi_def_cfa_offset 1640## ret41## .cfi_endproc42##43## ret44## .subsections_via_symbols45 46#--- combined.yaml47--- !mach-o48FileHeader:49 magic: 0xFEEDFACF50 cputype: 0x100000751 cpusubtype: 0x352 filetype: 0x153 ncmds: 354 sizeofcmds: 35255 flags: 0x200056 reserved: 0x057LoadCommands:58 - cmd: LC_SEGMENT_6459 cmdsize: 31260 segname: ''61 vmaddr: 062 vmsize: 15263 fileoff: 41664 filesize: 15265 maxprot: 766 initprot: 767 nsects: 368 flags: 069 Sections:70 - sectname: __text71 segname: __TEXT72 addr: 0x073 size: 374 offset: 0x1A075 align: 076 reloff: 0x077 nreloc: 078 flags: 0x8000040079 reserved1: 0x080 reserved2: 0x081 reserved3: 0x082 content: 90C3C383 - sectname: __eh_frame84 segname: __TEXT85 addr: 0x886 size: 8087 offset: 0x1A888 align: 389 reloff: 0x23890 nreloc: 591 flags: 0x092 reserved1: 0x093 reserved2: 0x094 reserved3: 0x095 content: 1400000000000000017A520001781001100C0708900100001800000000000000017A505200017810069B04000000100C070890011800000004000000F8FFFFFFFFFFFFFF0100000000000000000E100096 relocations:97 - address: 0x2A98 symbolnum: 099 pcrel: true100 length: 2101 extern: true102 type: 4103 scattered: false104 value: 0105 - address: 0x38106 symbolnum: 2107 pcrel: false108 length: 2109 extern: true110 type: 5111 scattered: false112 value: 0113 - address: 0x38114 symbolnum: 3115 pcrel: false116 length: 2117 extern: true118 type: 0119 scattered: false120 value: 0121 - address: 0x3C122 symbolnum: 3123 pcrel: false124 length: 3125 extern: true126 type: 5127 scattered: false128 value: 0129 - address: 0x3C130 symbolnum: 4131 pcrel: false132 length: 3133 extern: true134 type: 0135 scattered: false136 value: 0137 - sectname: __compact_unwind138 segname: __LD139 addr: 0x58140 size: 64141 offset: 0x1F8142 align: 3143 reloff: 0x260144 nreloc: 3145 flags: 0x2000000146 reserved1: 0x0147 reserved2: 0x0148 reserved3: 0x0149 content: '00000000000000000100000000000202000000000000000000000000000000000000000000000000020000000000020200000000000000000000000000000000'150 relocations:151 - address: 0x0152 symbolnum: 0153 pcrel: false154 length: 3155 extern: true156 type: 0157 scattered: false158 value: 0159 - address: 0x20160 symbolnum: 4161 pcrel: false162 length: 3163 extern: true164 type: 0165 scattered: false166 value: 0167 - address: 0x30168 symbolnum: 0169 pcrel: false170 length: 3171 extern: true172 type: 0173 scattered: false174 value: 0175 - cmd: LC_SYMTAB176 cmdsize: 24177 symoff: 632178 nsyms: 5179 stroff: 712180 strsize: 64181 - cmd: LC_DATA_IN_CODE182 cmdsize: 16183 dataoff: 632184 datasize: 0185LinkEditData:186 NameList:187 - n_strx: 23188 n_type: 0x1E189 n_sect: 1190 n_desc: 32191 n_value: 0192 - n_strx: 39193 n_type: 0xE194 n_sect: 2195 n_desc: 0196 n_value: 8197 - n_strx: 39198 n_type: 0xE199 n_sect: 2200 n_desc: 0201 n_value: 32202 - n_strx: 49203 n_type: 0xE204 n_sect: 2205 n_desc: 0206 n_value: 60207 - n_strx: 2208 n_type: 0xF209 n_sect: 1210 n_desc: 32211 n_value: 1212 StringTable:213 - ' '214 - '_OBJC_CLASS_$_MyTest'215 - _my_personality216 - EH_Frame1217 - func.eh218 - ''219 - ''220 - ''221 - ''222 - ''223 - ''224 - ''225...226