[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / incompatible.s
blob0d25acd857610bd2361f01946d245e2b6e49fae3
1 // REQUIRES: x86,aarch64
2 // RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %ta.o
3 // RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %tb.o
4 // RUN: ld.lld -shared %tb.o -o %ti686.so
5 // RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %tc.o
7 // RUN: not ld.lld %ta.o %tb.o -o /dev/null 2>&1 | \
8 // RUN: FileCheck --check-prefix=A-AND-B %s
9 // A-AND-B: error: {{.*}}b.o is incompatible with {{.*}}a.o
11 // RUN: ld.lld --noinhibit-exec %tb.o %tc.o -o /dev/null 2>&1 | \
12 // RUN: FileCheck --check-prefix=B-AND-C %s
13 // B-AND-C: warning: {{.*}}c.o is incompatible with {{.*}}b.o
15 // RUN: not ld.lld %ta.o %ti686.so -o /dev/null 2>&1 | \
16 // RUN: FileCheck --check-prefix=A-AND-SO %s
17 // A-AND-SO: i686.so is incompatible with {{.*}}a.o
19 // RUN: not ld.lld %tc.o %ti686.so -o /dev/null 2>&1 | \
20 // RUN: FileCheck --check-prefix=C-AND-SO %s
21 // C-AND-SO: i686.so is incompatible with {{.*}}c.o
23 // RUN: not ld.lld %ti686.so %tc.o -o /dev/null 2>&1 | \
24 // RUN: FileCheck --check-prefix=SO-AND-C %s
25 // SO-AND-C: c.o is incompatible with {{.*}}i686.so
27 // RUN: not ld.lld -m elf64ppc %ta.o -o /dev/null 2>&1 | \
28 // RUN: FileCheck --check-prefix=A-ONLY %s
29 // A-ONLY: a.o is incompatible with elf64ppc
31 // RUN: not ld.lld -m elf64ppc %tb.o -o /dev/null 2>&1 | \
32 // RUN: FileCheck --check-prefix=B-ONLY %s
33 // B-ONLY: b.o is incompatible with elf64ppc
35 // RUN: not ld.lld -m elf64ppc %tc.o -o /dev/null 2>&1 | \
36 // RUN: FileCheck --check-prefix=C-ONLY %s
37 // C-ONLY: c.o is incompatible with elf64ppc
39 // RUN: not ld.lld -m elf_i386 %tc.o %ti686.so -o /dev/null 2>&1 | \
40 // RUN: FileCheck --check-prefix=C-AND-SO-I386 %s
41 // C-AND-SO-I386: c.o is incompatible with elf_i386
43 // RUN: not ld.lld -m elf_i386 %ti686.so %tc.o -o /dev/null 2>&1 | \
44 // RUN: FileCheck --check-prefix=SO-AND-C-I386 %s
45 // SO-AND-C-I386: c.o is incompatible with elf_i386
47 // RUN: echo 'OUTPUT_FORMAT(elf32-i386)' > %t.script
48 // RUN: not ld.lld %t.script %ta.o -o /dev/null 2>&1 | \
49 // RUN: FileCheck --check-prefix=A-AND-SCRIPT %s
50 // RUN: not ld.lld %ta.o %t.script -o /dev/null 2>&1 | \
51 // RUN: FileCheck --check-prefix=A-AND-SCRIPT %s
52 // RUN: not ld.lld -m elf_x86_64 %ta.o %t.script -o /dev/null 2>&1 | \
53 // RUN: FileCheck --check-prefix=A-AND-SCRIPT %s
54 // A-AND-SCRIPT: a.o is incompatible with elf32-i386
56 // RUN: echo 'OUTPUT_FORMAT(elf32-i386-freebsd)' > %t-freebsd.script
57 // RUN: not ld.lld %t-freebsd.script %ta.o -o /dev/null 2>&1 | \
58 // RUN: FileCheck --check-prefix=A-AND-FREEBSD-SCRIPT %s
59 // A-AND-FREEBSD-SCRIPT: a.o is incompatible with elf32-i386-freebsd
61 /// %tb.a is not extracted, but we report an error anyway.
62 // RUN: rm -f %tb.a && llvm-ar rc %tb.a %tb.o
63 // RUN: not ld.lld %ta.o %tb.a -o /dev/null 2>&1 | FileCheck --check-prefix=UNEXTRACTED-ARCHIVE %s
64 // UNEXTRACTED-ARCHIVE: {{.*}}.a({{.*}}b.o) is incompatible with {{.*}}a.o
66 // We used to fail to identify this incompatibility and crash trying to
67 // read a 64 bit file as a 32 bit one.
68 // RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/archive2.s -o %tc.o
69 // RUN: rm -f %t.a
70 // RUN: llvm-ar rc %t.a %tc.o
71 // RUN: llvm-mc -filetype=obj -triple=i686-linux %s -o %td.o
72 // RUN: ld.lld --noinhibit-exec %t.a %td.o 2>&1 -o /dev/null | FileCheck --check-prefix=ARCHIVE %s
73 // ARCHIVE: warning: {{.*}}d.o is incompatible{{$}}
74 .global _start
75 _start:
76 .data
77 .long foo