1# This test verifies that llvm-objcopy copies a univeral Mach-O object file properly. 2 3# RUN: yaml2obj %p/Inputs/i386.yaml -o %t.i386 4# RUN: yaml2obj %p/Inputs/x86_64.yaml -o %t.x86_64 5 6## Case 1: copy a universal object containing regular Mach-O objects. 7# RUN: llvm-lipo %t.i386 %t.x86_64 -create -output %t.universal 8# RUN: llvm-objcopy %t.universal %t.universal.copy 9# RUN: llvm-lipo %t.universal.copy -archs | FileCheck --check-prefix=VERIFY_ARCHS %s 10# RUN: llvm-lipo %t.universal.copy -thin i386 -output %t.i386.copy 11# RUN: llvm-lipo %t.universal.copy -thin x86_64 -output %t.x86_64.copy 12# RUN: cmp %t.i386 %t.i386.copy 13# RUN: cmp %t.x86_64 %t.x86_64.copy 14 15## Case 2: copy a universal object file containing an archive with darwin specific timestamps. 16# RUN: rm -f %t.archive.i386 17# RUN: llvm-ar --format=darwin cr %t.archive.i386 %t.i386 %t.i386 18# RUN: llvm-lipo %t.archive.i386 %t.x86_64 -create -output %t.universal.containing.archive 19# RUN: llvm-objcopy %t.universal.containing.archive %t.universal.containing.archive.copy 20# RUN: llvm-lipo %t.universal.containing.archive.copy -archs | FileCheck --check-prefix=VERIFY_ARCHS %s 21# RUN: llvm-lipo %t.universal.containing.archive.copy -thin i386 -output %t.archive.i386.copy 22# RUN: llvm-lipo %t.universal.containing.archive.copy -thin x86_64 -output %t.archive.x86_64.copy 23# RUN: cmp %t.archive.i386 %t.archive.i386.copy 24# RUN: cmp %t.x86_64 %t.archive.x86_64.copy 25 26## Case 3: copy an archive containing a universal object. 27# RUN: llvm-ar cr %t.archive.containing.universal %t.universal 28# RUN: llvm-objcopy %t.archive.containing.universal %t.archive.containing.universal.copy 29 30## Case 4: try to copy a universal object file contaning a bitcode slice. 31# RUN: echo 'target triple = "arm64-apple-ios8.0.0"' | llvm-as -o %t.bitcode 32# RUN: llvm-lipo %t.bitcode %t.x86_64 -create -output %t.universal.containing.bitcode 33# RUN: not llvm-objcopy %t.universal.containing.bitcode %t.universal.containing.bitcode.copy 2>&1 \ 34# RUN: | FileCheck --check-prefix=UNSUPPORTED_UNIVERSAL_OBJECT %s 35 36## Case 5: try to copy an archive containing an unsupported universal object. 37# RUN: llvm-ar cr %t.archive.universal.bitcode %t.universal.containing.bitcode 38# RUN: not llvm-objcopy %t.archive.universal.bitcode %t.archive.universal.bitcode.copy 2>&1 \ 39# RUN: | FileCheck --check-prefix=UNSUPPORTED_UNIVERSAL_OBJECT %s 40 41# VERIFY_ARCHS: i386 x86_64 42# UNSUPPORTED_UNIVERSAL_OBJECT: slice for 'arm64' of the universal Mach-O binary {{.*}} is not a Mach-O object or an archive 43