[X86][MC,LLD][NFC] Rename R_X86_64_REX2_GOTPCRELX (#116737)
[llvm-project.git] / lld / test / MachO / ignore-incompat-arch.s
blob676b5e56f619278b1b53fc97a467b94bff806c31
1 # REQUIRES: x86, aarch64
2 ## Test that LLD correctly ignored archives with incompatible architecture without crashing.
4 # RUN: rm -rf %t; split-file %s %t
6 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos %t/callee.s -o %t/callee_arm64.o
7 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/callee.s -o %t/callee_x86_64.o
9 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos %t/caller.s -o %t/caller_arm64.o
10 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/caller.s -o %t/caller_x86_64.o
12 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos %t/main.s -o %t/main_arm64.o
13 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %t/main.s -o %t/main_x86_64.o
15 # RUN: llvm-ar rc %t/libcallee_arm64.a %t/callee_arm64.o
16 # RUN: llvm-ar r %t/libcallee_x86.a %t/callee_x86_64.o
18 # RUN: llvm-ar r %t/libcaller_arm64.a %t/caller_arm64.o
19 # RUN: llvm-ar r %t/libcaller_x86.a %t/caller_x86_64.o
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 %s
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 %s
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 %s
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 %s
34 ## Verify that the output doesn't take any symbol from the in-compat archive
35 # RUN: FileCheck --check-prefix=SYM-X86 %s --input-file=%t/x86_a.map
36 # RUN: FileCheck --check-prefix=SYM-X86 %s --input-file=%t/x86_b.map
38 # RUN: FileCheck --check-prefix=SYM-ARM64 %s --input-file=%t/arm64_a.map
39 # RUN: FileCheck --check-prefix=SYM-ARM64 %s --input-file=%t/arm64_b.map
42 # X86-WARNING: libcallee_arm64.a has architecture arm64 which is incompatible with target architecture x86_64
44 # ARM64-WARNING: libcallee_x86.a has architecture x86_64 which is incompatible with target architecture arm64
46 # SYM-X86-NOT: libcallee_arm64.a
47 # SYM-X86: {{.+}}main_x86_64.o
48 # SYM-X86: {{.+}}libcallee_x86.a(callee_x86_64.o)
49 # SYM-X86: {{.+}}libcaller_x86.a(caller_x86_64.o)
51 # SYM-ARM64-NOT: libcallee_x86.a
52 # SYM-ARM64: {{.+}}main_arm64.o
53 # SYM-ARM64: {{.+}}libcallee_arm64.a(callee_arm64.o)
54 # SYM-ARM64: {{.+}}libcaller_arm64.a(caller_arm64.o)
57 #--- callee.s
58 .globl _callee
59 _callee:
60 ret
62 #--- caller.s
63 .globl _caller
64 _caller:
65 .quad _callee
66 ret
68 #--- main.s
69 .globl _main
70 _main:
71 .quad _caller
72 ret