Clang Project

clang_source_code/test/Driver/arm-abi.c
1// The default ABI is aapcs
2// RUN: %clang -target arm--- %s -### -o %t.o 2>&1 \
3// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
4// RUN: %clang -target armeb--- %s -### -o %t.o 2>&1 \
5// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
6// RUN: %clang -target thumb--- %s -### -o %t.o 2>&1 \
7// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
8// RUN: %clang -target thumbeb--- %s -### -o %t.o 2>&1 \
9// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
10
11// MachO targets default to apcs-gnu, except for m-class processors
12// RUN: %clang -target arm--darwin- -arch armv7s %s -### -o %t.o 2>&1 \
13// RUN:   | FileCheck -check-prefix=CHECK-APCS-GNU %s
14// RUN: %clang -target thumb--darwin- -arch armv7s %s -### -o %t.o 2>&1 \
15// RUN:   | FileCheck -check-prefix=CHECK-APCS-GNU %s
16// RUN: %clang -target thumb--darwin- -arch armv7m %s -### -o %t.o 2>&1 \
17// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
18
19// Windows targets default to AAPCS, regardless of environment
20// RUN: %clang -target arm--windows-gnueabi %s -### -o %t.o 2>&1 \
21// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
22
23// NetBSD defaults to apcs-gnu, but can also use aapcs
24// RUN: %clang -target arm--netbsd- %s -### -o %t.o 2>&1 \
25// RUN:   | FileCheck -check-prefix=CHECK-APCS-GNU %s
26// RUN: %clang -target arm--netbsd-eabi %s -### -o %t.o 2>&1 \
27// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
28// RUN: %clang -target arm--netbsd-eabihf %s -### -o %t.o 2>&1 \
29// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
30
31// OpenBSD defaults to aapcs-linux
32// RUN: %clang -target arm--openbsd- %s -### -o %t.o 2>&1 \
33// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
34
35// Otherwise, ABI is selected based on environment
36// RUN: %clang -target arm---android %s -### -o %t.o 2>&1 \
37// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
38// RUN: %clang -target arm---gnueabi %s -### -o %t.o 2>&1 \
39// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
40// RUN: %clang -target arm---gnueabihf %s -### -o %t.o 2>&1 \
41// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
42// RUN: %clang -target arm---musleabi %s -### -o %t.o 2>&1 \
43// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
44// RUN: %clang -target arm---musleabihf %s -### -o %t.o 2>&1 \
45// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
46// RUN: %clang -target arm---eabi %s -### -o %t.o 2>&1 \
47// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
48// RUN: %clang -target arm---eabihf %s -### -o %t.o 2>&1 \
49// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
50
51// ABI can be overridden by the -mabi= option
52// RUN: %clang -target arm---eabi -mabi=apcs-gnu %s -### -o %t.o 2>&1 \
53// RUN:   | FileCheck -check-prefix=CHECK-APCS-GNU %s
54// RUN: %clang -target arm---gnueabi -mabi=aapcs %s -### -o %t.o 2>&1 \
55// RUN:   | FileCheck -check-prefix=CHECK-AAPCS %s
56// RUN: %clang -target arm---eabi -mabi=aapcs-linux %s -### -o %t.o 2>&1 \
57// RUN:   | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
58
59// CHECK-APCS-GNU: "-target-abi" "apcs-gnu"
60// CHECK-AAPCS: "-target-abi" "aapcs"
61// CHECK-AAPCS-LINUX: "-target-abi" "aapcs-linux"
62