241 lines · plain
1## This test checks that a universal object file is flattened correctly.2 3# RUN: yaml2obj %s -o %t-universal.o4# RUN: yaml2obj %S/Inputs/input1.yaml -o %t-input1.o5# RUN: yaml2obj %S/Inputs/input2.yaml -o %t-input2.o6 7# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arm648 9## Check that the binary is present:10# RUN: llvm-ar t %t.lib | \11# RUN: FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp12 13# CHECK-NAMES: [[PREFIX]]-universal.o14 15## Check that symbols are present:16# RUN: llvm-nm --print-armap %t.lib | \17# RUN: FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines18 19# CHECK-SYMBOLS: Archive map20# CHECK-SYMBOLS-NEXT: _arm64 in [[PREFIX]]-universal.o21# CHECK-SYMBOLS-EMPTY:22 23## Check that the output archive is in Darwin format:24# RUN: llvm-objdump --macho --archive-headers %t.lib | \25# RUN: FileCheck %s --check-prefix=FORMAT -DPREFIX=%basename_t.tmp -DARCHIVE=%t.lib26 27# FORMAT: Archive : [[ARCHIVE]]28# FORMAT-NEXT: __.SYMDEF29# FORMAT-NEXT: [[PREFIX]]-universal.o30# FORMAT-NOT: {{.}}31 32## Passing both a universal file and an object file:33# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o %t-input1.o -arch_only x86_6434# RUN: llvm-ar t %t.lib | \35# RUN: FileCheck %s --check-prefix=BOTH-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp36# RUN: llvm-nm --print-armap %t.lib | \37# RUN: FileCheck %s --check-prefix=BOTH-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines38 39# BOTH-NAMES: [[PREFIX]]-universal.o40# BOTH-NAMES-NEXT: [[PREFIX]]-input1.o41 42# BOTH-SYMBOLS: Archive map43# BOTH-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-universal.o44# BOTH-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o45# BOTH-SYMBOLS-EMPTY:46 47## Passing both a universal file and an object file but filtering out the object file:48# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o %t-input1.o -arch_only arm6449# RUN: llvm-ar t %t.lib | \50# RUN: FileCheck %s --check-prefix=CHECK-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp51# RUN: llvm-nm --print-armap %t.lib | \52# RUN: FileCheck %s --check-prefix=CHECK-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines53 54## Universal file containing an archive:55# RUN: rm -f %t.ar56# RUN: llvm-ar cr %t.ar %t-input1.o %t-input2.o57# RUN: llvm-lipo %t.ar -create -output %t-fat-with-archive.o58# RUN: llvm-libtool-darwin -static -o %t.lib %t-fat-with-archive.o -arch_only x86_6459# RUN: llvm-ar t %t.lib | \60# RUN: FileCheck %s --check-prefix=ARCHIVE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp61# RUN: llvm-nm --print-armap %t.lib | \62# RUN: FileCheck %s --check-prefix=ARCHIVE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines63 64# ARCHIVE-NAMES: [[PREFIX]]-input1.o65# ARCHIVE-NAMES-NEXT: [[PREFIX]]-input2.o66 67# ARCHIVE-SYMBOLS: Archive map68# ARCHIVE-SYMBOLS-NEXT: _symbol1 in [[PREFIX]]-input1.o69# ARCHIVE-SYMBOLS-NEXT: _symbol2 in [[PREFIX]]-input2.o70# ARCHIVE-SYMBOLS-EMPTY:71 72## Allow arch_only to be specified more than once (pick the last one):73# RUN: llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arm64 -arch_only x86_6474# RUN: llvm-ar t %t.lib | \75# RUN: FileCheck %s --check-prefix=DOUBLE-NAMES --implicit-check-not={{.}} -DPREFIX=%basename_t.tmp76# RUN: llvm-nm --print-armap %t.lib | \77# RUN: FileCheck %s --check-prefix=DOUBLE-SYMBOLS -DPREFIX=%basename_t.tmp --match-full-lines78 79# DOUBLE-NAMES: [[PREFIX]]-universal.o80 81# DOUBLE-SYMBOLS: Archive map82# DOUBLE-SYMBOLS-NEXT: _x86_64 in [[PREFIX]]-universal.o83# DOUBLE-SYMBOLS-EMPTY:84 85## Invalid architecture:86# RUN: not llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only arch101 2>&1 | \87# RUN: FileCheck %s --check-prefix=INVALID-ARCH88 89# INVALID-ARCH: invalid architecture 'arch101': valid architecture names are90 91## Empty architecture:92# RUN: not llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only "" 2>&1 | \93# RUN: FileCheck %s --check-prefix=EMPTY-ARCH94 95# EMPTY-ARCH: invalid architecture '': valid architecture names are96 97## Missing architecture:98# RUN: not llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only ppc 2>&1 | \99# RUN: FileCheck %s --check-prefix=MISSING-ARCH100 101# MISSING-ARCH: error: no library created (no object files in input files matching -arch_only ppc)102 103## arch_only missing argument:104# RUN: not llvm-libtool-darwin -static -o %t.lib %t-universal.o -arch_only 2>&1 | \105# RUN: FileCheck %s --check-prefix=REQUIRE-ARCH106 107# REQUIRE-ARCH: -arch_only: missing argument108 109## x86_64-arm64-universal.yaml110--- !fat-mach-o111FatHeader:112 magic: 0xCAFEBABE113 nfat_arch: 2114FatArchs:115 - cputype: 0x01000007116 cpusubtype: 0x00000003117 offset: 0x0000000000001000118 size: 352119 align: 12120 - cputype: 0x0100000C121 cpusubtype: 0x00000000122 offset: 0x0000000000004000123 size: 384124 align: 14125Slices:126 - !mach-o127 FileHeader:128 magic: 0xFEEDFACF129 cputype: 0x01000007130 cpusubtype: 0x00000003131 filetype: 0x00000001132 ncmds: 2133 sizeofcmds: 176134 flags: 0x00002000135 reserved: 0x00000000136 LoadCommands:137 - cmd: LC_SEGMENT_64138 cmdsize: 152139 segname: ''140 vmaddr: 0141 vmsize: 15142 fileoff: 312143 filesize: 15144 maxprot: 7145 initprot: 7146 nsects: 1147 flags: 0148 Sections:149 - sectname: __text150 segname: __TEXT151 addr: 0x0000000000000000152 size: 15153 offset: 0x00000138154 align: 4155 reloff: 0x00000000156 nreloc: 0157 flags: 0x80000400158 reserved1: 0x00000000159 reserved2: 0x00000000160 reserved3: 0x00000000161 content: 554889E531C0C745FC000000005DC3162 - cmd: LC_SYMTAB163 cmdsize: 24164 symoff: 328165 nsyms: 1166 stroff: 344167 strsize: 8168 LinkEditData:169 NameList:170 - n_strx: 1171 n_type: 0x0F172 n_sect: 1173 n_desc: 0174 n_value: 0175 StringTable:176 - ''177 - _x86_64178 - ''179 - !mach-o180 FileHeader:181 magic: 0xFEEDFACF182 cputype: 0x0100000C183 cpusubtype: 0x00000000184 filetype: 0x00000001185 ncmds: 2186 sizeofcmds: 176187 flags: 0x00002000188 reserved: 0x00000000189 LoadCommands:190 - cmd: LC_SEGMENT_64191 cmdsize: 152192 segname: ''193 vmaddr: 0194 vmsize: 24195 fileoff: 312196 filesize: 24197 maxprot: 7198 initprot: 7199 nsects: 1200 flags: 0201 Sections:202 - sectname: __text203 segname: __TEXT204 addr: 0x0000000000000000205 size: 24206 offset: 0x00000138207 align: 2208 reloff: 0x00000000209 nreloc: 0210 flags: 0x80000400211 reserved1: 0x00000000212 reserved2: 0x00000000213 reserved3: 0x00000000214 content: FF4300D1FF0F00B908008052E00308AAFF430091C0035FD6215 - cmd: LC_SYMTAB216 cmdsize: 24217 symoff: 336218 nsyms: 2219 stroff: 368220 strsize: 16221 LinkEditData:222 NameList:223 - n_strx: 7224 n_type: 0x0E225 n_sect: 1226 n_desc: 0227 n_value: 0228 - n_strx: 1229 n_type: 0x0F230 n_sect: 1231 n_desc: 0232 n_value: 0233 StringTable:234 - ''235 - _arm64236 - ltmp0237 - ''238 - ''239 - ''240...241