Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / emulation-aarch64.s
blob68db8b4fefb0666c0994a9e9d4d86b5921941193
1 # REQUIRES: aarch64
2 # RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-readobj --file-headers %t | FileCheck --check-prefixes=AARCH64,LE %s
5 # RUN: ld.lld -m aarch64linux %t.o -o %t1
6 # RUN: llvm-readobj --file-headers %t1 | FileCheck --check-prefixes=AARCH64,LE %s
7 # RUN: ld.lld -m aarch64elf %t.o -o %t2
8 # RUN: llvm-readobj --file-headers %t2 | FileCheck --check-prefixes=AARCH64,LE %s
9 # RUN: echo 'OUTPUT_FORMAT(elf64-littleaarch64)' > %t.script
10 # RUN: ld.lld %t.script %t.o -o %t3
11 # RUN: llvm-readobj --file-headers %t3 | FileCheck --check-prefixes=AARCH64,LE %s
13 # RUN: llvm-mc -filetype=obj -triple=aarch64_be %s -o %t.be.o
14 # RUN: ld.lld %t.be.o -o %t
15 # RUN: llvm-readobj --file-headers %t | FileCheck --check-prefixes=AARCH64,BE %s
16 # RUN: ld.lld -m aarch64linuxb %t.be.o -o %t1.be
17 # RUN: llvm-readobj --file-headers %t1.be | FileCheck --check-prefixes=AARCH64,BE %s
18 # RUN: ld.lld -m aarch64elfb %t.be.o -o %t2.be
19 # RUN: llvm-readobj --file-headers %t2.be | FileCheck --check-prefixes=AARCH64,BE %s
20 # RUN: echo 'OUTPUT_FORMAT(elf64-bigaarch64)' > %t.script
21 # RUN: ld.lld %t.script %t.be.o -o %t3.be
22 # RUN: llvm-readobj --file-headers %t3.be | FileCheck --check-prefixes=AARCH64,BE %s
24 ## Test OUTPUT_FORMAT(default, big, little).
25 # RUN: echo 'OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64")' > %t.script
26 # RUN: ld.lld -EL -T %t.script %t.o -o %t4.le
27 # RUN: llvm-readobj --file-headers %t4.le | FileCheck --check-prefixes=AARCH64,LE %s
28 # RUN: not ld.lld -EB -T %t.script %t.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR_BE %s
30 # RUN: not ld.lld -T %t.script %t.be.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR_LE %s
31 # RUN: not ld.lld -EL -T %t.script %t.be.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR_LE %s
32 # RUN: ld.lld -EB -T %t.script %t.be.o -o %t4.be
33 # RUN: llvm-readobj --file-headers %t4.be | FileCheck --check-prefixes=AARCH64,BE %s
35 # ERR_LE: error: {{.*}}.o is incompatible with elf64-littleaarch64
36 # ERR_BE: error: {{.*}}.o is incompatible with elf64-bigaarch64
38 # AARCH64: ElfHeader {
39 # AARCH64-NEXT: Ident {
40 # AARCH64-NEXT: Magic: (7F 45 4C 46)
41 # AARCH64-NEXT: Class: 64-bit (0x2)
42 # LE-NEXT: DataEncoding: LittleEndian (0x1)
43 # BE-NEXT: DataEncoding: BigEndian (0x2)
44 # AARCH64-NEXT: FileVersion: 1
45 # AARCH64-NEXT: OS/ABI: SystemV (0x0)
46 # AARCH64-NEXT: ABIVersion: 0
47 # AARCH64-NEXT: Unused: (00 00 00 00 00 00 00)
48 # AARCH64-NEXT: }
49 # AARCH64-NEXT: Type: Executable (0x2)
50 # AARCH64-NEXT: Machine: EM_AARCH64 (0xB7)
51 # AARCH64-NEXT: Version: 1
52 # AARCH64-NEXT: Entry:
53 # AARCH64-NEXT: ProgramHeaderOffset: 0x40
54 # AARCH64-NEXT: SectionHeaderOffset:
55 # AARCH64-NEXT: Flags [ (0x0)
56 # AARCH64-NEXT: ]
58 # RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %tfbsd.o
59 # RUN: echo 'OUTPUT_FORMAT(elf64-aarch64-freebsd)' > %tfbsd.script
60 # RUN: ld.lld %tfbsd.script %tfbsd.o -o %tfbsd
61 # RUN: llvm-readobj --file-headers %tfbsd | FileCheck --check-prefix=AARCH64-FBSD %s
62 # AARCH64-FBSD: ElfHeader {
63 # AARCH64-FBSD-NEXT: Ident {
64 # AARCH64-FBSD-NEXT: Magic: (7F 45 4C 46)
65 # AARCH64-FBSD-NEXT: Class: 64-bit (0x2)
66 # AARCH64-FBSD-NEXT: DataEncoding: LittleEndian (0x1)
67 # AARCH64-FBSD-NEXT: FileVersion: 1
68 # AARCH64-FBSD-NEXT: OS/ABI: FreeBSD (0x9)
69 # AARCH64-FBSD-NEXT: ABIVersion: 0
70 # AARCH64-FBSD-NEXT: Unused: (00 00 00 00 00 00 00)
71 # AARCH64-FBSD-NEXT: }
72 # AARCH64-FBSD-NEXT: Type: Executable (0x2)
73 # AARCH64-FBSD-NEXT: Machine: EM_AARCH64 (0xB7)
74 # AARCH64-FBSD-NEXT: Version: 1
75 # AARCH64-FBSD-NEXT: Entry:
76 # AARCH64-FBSD-NEXT: ProgramHeaderOffset: 0x40
77 # AARCH64-FBSD-NEXT: SectionHeaderOffset:
78 # AARCH64-FBSD-NEXT: Flags [ (0x0)
79 # AARCH64-FBSD-NEXT: ]
81 .globl _start
82 _start: