73 lines · plain
1# REQUIRES: x86, aarch642## Test that LLD correctly ignored archives with incompatible architecture without crashing.3 4# RUN: rm -rf %t; split-file %s %t5 6# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos %t/callee.s -o %t/callee_arm64.o7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/callee.s -o %t/callee_x86_64.o8 9# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos %t/caller.s -o %t/caller_arm64.o10# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/caller.s -o %t/caller_x86_64.o11 12# RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos %t/main.s -o %t/main_arm64.o13# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/main.s -o %t/main_x86_64.o14 15# RUN: llvm-ar rc %t/libcallee_arm64.a %t/callee_arm64.o16# RUN: llvm-ar r %t/libcallee_x86.a %t/callee_x86_64.o17 18# RUN: llvm-ar r %t/libcaller_arm64.a %t/caller_arm64.o19# RUN: llvm-ar r %t/libcaller_x86.a %t/caller_x86_64.o20 21## Symbol from the arm64 archive should be ignored even tho it appears before the x86 archive.22# RUN: %no-fatal-warnings-lld -map %t/x86_a.map -arch x86_64 %t/main_x86_64.o %t/libcallee_arm64.a %t/libcallee_x86.a %t/libcaller_x86.a -o %t/x86_a.out 2>&1 \23# RUN: | FileCheck -check-prefix=X86-WARNING %s24 25# RUN: %no-fatal-warnings-lld -map %t/x86_b.map -arch x86_64 %t/main_x86_64.o %t/libcallee_x86.a %t/libcallee_arm64.a %t/libcaller_x86.a -o %t/x86_b.out 2>&1 \26# RUN: | FileCheck -check-prefix=X86-WARNING %s27 28# RUN: %no-fatal-warnings-lld -map %t/arm64_a.map -arch arm64 %t/main_arm64.o %t/libcallee_x86.a %t/libcallee_arm64.a %t/libcaller_arm64.a -o %t/arm64_a.out 2>&1 \29# RUN: | FileCheck -check-prefix=ARM64-WARNING %s30 31# RUN: %no-fatal-warnings-lld -map %t/arm64_b.map -arch arm64 %t/main_arm64.o %t/libcallee_arm64.a %t/libcallee_x86.a %t/libcaller_arm64.a -o %t/arm64_b.out 2>&1 \32# RUN: | FileCheck -check-prefix=ARM64-WARNING %s33 34## Verify that the output doesn't take any symbol from the in-compat archive35# RUN: FileCheck --check-prefix=SYM-X86 %s --input-file=%t/x86_a.map36# RUN: FileCheck --check-prefix=SYM-X86 %s --input-file=%t/x86_b.map37 38# RUN: FileCheck --check-prefix=SYM-ARM64 %s --input-file=%t/arm64_a.map39# RUN: FileCheck --check-prefix=SYM-ARM64 %s --input-file=%t/arm64_b.map40 41 42# X86-WARNING: libcallee_arm64.a has architecture arm64 which is incompatible with target architecture x86_6443 44# ARM64-WARNING: libcallee_x86.a has architecture x86_64 which is incompatible with target architecture arm6445 46# SYM-X86-NOT: libcallee_arm64.a47# SYM-X86: {{.+}}main_x86_64.o48# SYM-X86: {{.+}}libcallee_x86.a(callee_x86_64.o)49# SYM-X86: {{.+}}libcaller_x86.a(caller_x86_64.o)50 51# SYM-ARM64-NOT: libcallee_x86.a52# SYM-ARM64: {{.+}}main_arm64.o53# SYM-ARM64: {{.+}}libcallee_arm64.a(callee_arm64.o)54# SYM-ARM64: {{.+}}libcaller_arm64.a(caller_arm64.o)55 56 57#--- callee.s58.globl _callee59_callee:60 ret61 62#--- caller.s63.globl _caller64_caller:65 .quad _callee66 ret67 68#--- main.s69.globl _main70_main:71 .quad _caller72 ret73