blob: 84cec7b95cce96ef77d8d40d59b8f9145ef6c649 [file] [log] [blame]
Chandler Carruthfde8d142011-10-03 06:41:08 +00001// General tests that ld invocations on Linux targets sane. Note that we use
2// sysroot to make these tests independent of the host system.
Chandler Carruthc4cc4032011-10-01 00:37:39 +00003//
Chandler Carruthfde8d142011-10-03 06:41:08 +00004// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00005// RUN: --target=i386-unknown-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07006// RUN: --gcc-toolchain="" \
Chandler Carruthfde8d142011-10-03 06:41:08 +00007// RUN: --sysroot=%S/Inputs/basic_linux_tree \
Chandler Carruthc4cc4032011-10-01 00:37:39 +00008// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
Chandler Carruth68f94db2013-03-04 02:07:55 +00009// CHECK-LD-32-NOT: warning:
Chandler Carruthfde8d142011-10-03 06:41:08 +000010// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +000011// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
Chandler Carruth663abc92011-10-03 08:02:58 +000012// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
Chandler Carruth621e6a62011-10-03 08:09:02 +000013// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
Chandler Carruth663abc92011-10-03 08:02:58 +000014// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
15// CHECK-LD-32: "-L[[SYSROOT]]/lib"
16// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
Chandler Carruthc4cc4032011-10-01 00:37:39 +000017//
Chandler Carruthfde8d142011-10-03 06:41:08 +000018// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +000019// RUN: --target=x86_64-unknown-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -070020// RUN: --gcc-toolchain="" \
Chandler Carruthfde8d142011-10-03 06:41:08 +000021// RUN: --sysroot=%S/Inputs/basic_linux_tree \
Chandler Carruthc4cc4032011-10-01 00:37:39 +000022// RUN: | FileCheck --check-prefix=CHECK-LD-64 %s
Chandler Carruth68f94db2013-03-04 02:07:55 +000023// CHECK-LD-64-NOT: warning:
Chandler Carruthfde8d142011-10-03 06:41:08 +000024// CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruth0074d382013-03-04 01:27:49 +000025// CHECK-LD-64: "--eh-frame-hdr"
26// CHECK-LD-64: "-m" "elf_x86_64"
27// CHECK-LD-64: "-dynamic-linker"
Rafael Espindolae4664a92013-06-24 22:07:15 +000028// CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
Chandler Carruth663abc92011-10-03 08:02:58 +000029// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
Chandler Carruth621e6a62011-10-03 08:09:02 +000030// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
Chandler Carruth663abc92011-10-03 08:02:58 +000031// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
32// CHECK-LD-64: "-L[[SYSROOT]]/lib"
33// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
Chandler Carruth0074d382013-03-04 01:27:49 +000034// CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
35// CHECK-LD-64: "-lc"
36// CHECK-LD-64: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
37//
38// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hinesc568f1e2014-07-21 00:47:37 -070039// RUN: --target=x86_64-unknown-linux-gnux32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -070040// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -070041// RUN: --sysroot=%S/Inputs/basic_linux_tree \
42// RUN: | FileCheck --check-prefix=CHECK-LD-X32 %s
43// CHECK-LD-X32-NOT: warning:
44// CHECK-LD-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
45// CHECK-LD-X32: "--eh-frame-hdr"
46// CHECK-LD-X32: "-m" "elf32_x86_64"
47// CHECK-LD-X32: "-dynamic-linker"
48// CHECK-LD-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
49// CHECK-LD-X32: "-lc"
50// CHECK-LD-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
51//
52// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +000053// RUN: --target=x86_64-unknown-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -070054// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -070055// RUN: --sysroot=%S/Inputs/basic_linux_tree \
56// RUN: --rtlib=compiler-rt \
57// RUN: | FileCheck --check-prefix=CHECK-LD-RT %s
58// CHECK-LD-RT-NOT: warning:
59// CHECK-LD-RT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
60// CHECK-LD-RT: "--eh-frame-hdr"
61// CHECK-LD-RT: "-m" "elf_x86_64"
62// CHECK-LD-RT: "-dynamic-linker"
63// CHECK-LD-RT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
64// CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
65// CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
66// CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
67// CHECK-LD-RT: "-L[[SYSROOT]]/lib"
68// CHECK-LD-RT: "-L[[SYSROOT]]/usr/lib"
Stephen Hines6bcf27b2014-05-29 04:14:42 -070069// CHECK-LD-RT: libclang_rt.builtins-x86_64.a" "-lgcc_s"
Stephen Hines651f13c2014-04-23 16:59:28 -070070// CHECK-LD-RT: "-lc"
Stephen Hines6bcf27b2014-05-29 04:14:42 -070071// CHECK-LD-RT: libclang_rt.builtins-x86_64.a" "-lgcc_s"
Stephen Hines651f13c2014-04-23 16:59:28 -070072//
73// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -070074// RUN: --target=arm-linux-androideabi \
75// RUN: --gcc-toolchain="" \
76// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
77// RUN: --rtlib=compiler-rt \
78// RUN: | FileCheck --check-prefix=CHECK-LD-RT-ANDROID %s
79// CHECK-LD-RT-ANDROID-NOT: warning:
80// CHECK-LD-RT-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
81// CHECK-LD-RT-ANDROID: "--eh-frame-hdr"
82// CHECK-LD-RT-ANDROID: "-m" "armelf_linux_eabi"
83// CHECK-LD-RT-ANDROID: "-dynamic-linker"
84// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s"
85// CHECK-LD-RT-ANDROID: "-lc"
86// CHECK-LD-RT-ANDROID: libclang_rt.builtins-arm-android.a" "-lgcc_s"
87//
88// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines651f13c2014-04-23 16:59:28 -070089// RUN: --target=x86_64-unknown-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -070090// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -070091// RUN: --sysroot=%S/Inputs/basic_linux_tree \
92// RUN: --rtlib=libgcc \
93// RUN: | FileCheck --check-prefix=CHECK-LD-GCC %s
94// CHECK-LD-GCC-NOT: warning:
95// CHECK-LD-GCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
96// CHECK-LD-GCC: "--eh-frame-hdr"
97// CHECK-LD-GCC: "-m" "elf_x86_64"
98// CHECK-LD-GCC: "-dynamic-linker"
99// CHECK-LD-GCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
100// CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
101// CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
102// CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
103// CHECK-LD-GCC: "-L[[SYSROOT]]/lib"
104// CHECK-LD-GCC: "-L[[SYSROOT]]/usr/lib"
105// CHECK-LD-GCC "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
106// CHECK-LD-GCC: "-lc"
107// CHECK-LD-GCC: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed"
108//
109// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
110// RUN: --target=x86_64-unknown-linux \
Chandler Carruth0074d382013-03-04 01:27:49 +0000111// RUN: -static-libgcc \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700112// RUN: --gcc-toolchain="" \
Chandler Carruth0074d382013-03-04 01:27:49 +0000113// RUN: --sysroot=%S/Inputs/basic_linux_tree \
114// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC-LIBGCC %s
Chandler Carruth68f94db2013-03-04 02:07:55 +0000115// CHECK-LD-64-STATIC-LIBGCC-NOT: warning:
Chandler Carruth0074d382013-03-04 01:27:49 +0000116// CHECK-LD-64-STATIC-LIBGCC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
117// CHECK-LD-64-STATIC-LIBGCC: "--eh-frame-hdr"
118// CHECK-LD-64-STATIC-LIBGCC: "-m" "elf_x86_64"
119// CHECK-LD-64-STATIC-LIBGCC: "-dynamic-linker"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000120// CHECK-LD-64-STATIC-LIBGCC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
Chandler Carruth0074d382013-03-04 01:27:49 +0000121// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
122// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
123// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
124// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/lib"
125// CHECK-LD-64-STATIC-LIBGCC: "-L[[SYSROOT]]/usr/lib"
126// CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
127// CHECK-LD-64-STATIC-LIBGCC: "-lc"
128// CHECK-LD-64-STATIC-LIBGCC: "-lgcc" "-lgcc_eh"
129//
130// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000131// RUN: --target=x86_64-unknown-linux \
Chandler Carruth0074d382013-03-04 01:27:49 +0000132// RUN: -static \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700133// RUN: --gcc-toolchain="" \
Chandler Carruth0074d382013-03-04 01:27:49 +0000134// RUN: --sysroot=%S/Inputs/basic_linux_tree \
135// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
Chandler Carruth68f94db2013-03-04 02:07:55 +0000136// CHECK-LD-64-STATIC-NOT: warning:
Chandler Carruth0074d382013-03-04 01:27:49 +0000137// CHECK-LD-64-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
138// CHECK-LD-64-STATIC-NOT: "--eh-frame-hdr"
139// CHECK-LD-64-STATIC: "-m" "elf_x86_64"
140// CHECK-LD-64-STATIC-NOT: "-dynamic-linker"
141// CHECK-LD-64-STATIC: "-static"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000142// CHECK-LD-64-STATIC: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbeginT.o"
Chandler Carruth0074d382013-03-04 01:27:49 +0000143// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
144// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
145// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
146// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/lib"
147// CHECK-LD-64-STATIC: "-L[[SYSROOT]]/usr/lib"
148// CHECK-LD-64-STATIC: "--start-group" "-lgcc" "-lgcc_eh" "-lc" "--end-group"
Chandler Carruth38ec5462011-10-03 09:00:50 +0000149//
Chandler Carruth68f94db2013-03-04 02:07:55 +0000150// Check that flags can be combined. The -static dominates.
151// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000152// RUN: --target=x86_64-unknown-linux \
Chandler Carruth68f94db2013-03-04 02:07:55 +0000153// RUN: -static-libgcc -static \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700154// RUN: --gcc-toolchain="" \
Chandler Carruth68f94db2013-03-04 02:07:55 +0000155// RUN: --sysroot=%S/Inputs/basic_linux_tree \
156// RUN: | FileCheck --check-prefix=CHECK-LD-64-STATIC %s
157//
Chandler Carruth38ec5462011-10-03 09:00:50 +0000158// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000159// RUN: --target=i386-unknown-linux -m32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700160// RUN: --gcc-toolchain="" \
Chandler Carruth38ec5462011-10-03 09:00:50 +0000161// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
162// RUN: | FileCheck --check-prefix=CHECK-32-TO-32 %s
163// CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000164// CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
Chandler Carruth38ec5462011-10-03 09:00:50 +0000165// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
Rafael Espindola9a478242013-10-28 23:14:34 +0000166// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32"
167// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32"
168// CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
169// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
Chandler Carruth38ec5462011-10-03 09:00:50 +0000170// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
171// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
172// CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
173// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
174//
175// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000176// RUN: --target=i386-unknown-linux -m64 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700177// RUN: --gcc-toolchain="" \
Chandler Carruth38ec5462011-10-03 09:00:50 +0000178// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
179// RUN: | FileCheck --check-prefix=CHECK-32-TO-64 %s
180// CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000181// CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64{{/|\\\\}}crtbegin.o"
Chandler Carruth38ec5462011-10-03 09:00:50 +0000182// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64"
183// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64"
184// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64"
185// CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
186// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
187// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
188// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
189// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
190// CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
191// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
Chandler Carruthc5306b02011-10-03 09:08:26 +0000192//
193// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000194// RUN: --target=x86_64-unknown-linux -m64 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700195// RUN: --gcc-toolchain="" \
Chandler Carruthc5306b02011-10-03 09:08:26 +0000196// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
197// RUN: | FileCheck --check-prefix=CHECK-64-TO-64 %s
198// CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000199// CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
Chandler Carruthc5306b02011-10-03 09:08:26 +0000200// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
Rafael Espindola9a478242013-10-28 23:14:34 +0000201// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
202// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
203// CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64"
204// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
Chandler Carruthc5306b02011-10-03 09:08:26 +0000205// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
206// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
207// CHECK-64-TO-64: "-L[[SYSROOT]]/lib"
208// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib"
209//
210// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000211// RUN: --target=x86_64-unknown-linux -m32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700212// RUN: --gcc-toolchain="" \
Chandler Carruthc5306b02011-10-03 09:08:26 +0000213// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
214// RUN: | FileCheck --check-prefix=CHECK-64-TO-32 %s
215// CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000216// CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
Chandler Carruthc5306b02011-10-03 09:08:26 +0000217// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
218// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
219// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
220// CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32"
221// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
222// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
223// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
224// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
225// CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
226// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
Chandler Carruth5058e3a2011-10-05 01:01:57 +0000227//
228// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700229// RUN: --target=x86_64-unknown-linux-gnux32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700230// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700231// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
232// RUN: | FileCheck --check-prefix=CHECK-X32 %s
233// CHECK-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
234// CHECK-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32{{/|\\\\}}crtbegin.o"
235// CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32"
236// CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../libx32"
237// CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../libx32"
238// CHECK-X32: "-L[[SYSROOT]]/lib/../libx32"
239// CHECK-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
240// CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
241// CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
242// CHECK-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
243// CHECK-X32: "-L[[SYSROOT]]/lib"
244// CHECK-X32: "-L[[SYSROOT]]/usr/lib"
245//
246// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines176edba2014-12-01 14:53:08 -0800247// RUN: --target=x86_64-unknown-linux -mx32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700248// RUN: --gcc-toolchain="" \
Stephen Hines176edba2014-12-01 14:53:08 -0800249// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
250// RUN: | FileCheck --check-prefix=CHECK-64-TO-X32 %s
251// CHECK-64-TO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
252// CHECK-64-TO-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32{{/|\\\\}}crtbegin.o"
253// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32"
254// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../libx32"
255// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../libx32"
256// CHECK-64-TO-X32: "-L[[SYSROOT]]/lib/../libx32"
257// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
258// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
259// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
260// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
261// CHECK-64-TO-X32: "-L[[SYSROOT]]/lib"
262// CHECK-64-TO-X32: "-L[[SYSROOT]]/usr/lib"
263//
264// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
265// RUN: --target=i386-unknown-linux -mx32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700266// RUN: --gcc-toolchain="" \
Stephen Hines176edba2014-12-01 14:53:08 -0800267// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
268// RUN: | FileCheck --check-prefix=CHECK-32-TO-X32 %s
269// CHECK-32-TO-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
270// CHECK-32-TO-X32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32{{/|\\\\}}crtbegin.o"
271// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/x32"
272// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../libx32"
273// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../libx32"
274// CHECK-32-TO-X32: "-L[[SYSROOT]]/lib/../libx32"
275// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
276// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
277// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
278// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
279// CHECK-32-TO-X32: "-L[[SYSROOT]]/lib"
280// CHECK-32-TO-X32: "-L[[SYSROOT]]/usr/lib"
281//
282// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
283// RUN: --target=x86_64-unknown-linux-gnux32 -m64 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700284// RUN: --gcc-toolchain="" \
Stephen Hines176edba2014-12-01 14:53:08 -0800285// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
286// RUN: | FileCheck --check-prefix=CHECK-X32-TO-64 %s
287// CHECK-X32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
288// CHECK-X32-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
289// CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
290// CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
291// CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
292// CHECK-X32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
293// CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
294// CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
295// CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
296// CHECK-X32-TO-64: "-L[[SYSROOT]]/lib"
297// CHECK-X32-TO-64: "-L[[SYSROOT]]/usr/lib"
298//
299// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
300// RUN: --target=x86_64-unknown-linux-gnux32 -m32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700301// RUN: --gcc-toolchain="" \
Stephen Hines176edba2014-12-01 14:53:08 -0800302// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
303// RUN: | FileCheck --check-prefix=CHECK-X32-TO-32 %s
304// CHECK-X32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
305// CHECK-X32-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
306// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
307// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
308// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
309// CHECK-X32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
310// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
311// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
312// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
313// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
314// CHECK-X32-TO-32: "-L[[SYSROOT]]/lib"
315// CHECK-X32-TO-32: "-L[[SYSROOT]]/usr/lib"
316//
317// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000318// RUN: --target=x86_64-unknown-linux -m32 \
319// RUN: --gcc-toolchain=%S/Inputs/multilib_64bit_linux_tree/usr \
Chandler Carruth9f314372012-04-06 16:32:06 +0000320// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
321// RUN: | FileCheck --check-prefix=CHECK-64-TO-32-SYSROOT %s
322// CHECK-64-TO-32-SYSROOT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000323// CHECK-64-TO-32-SYSROOT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32{{/|\\\\}}crtbegin.o"
Chandler Carruth9f314372012-04-06 16:32:06 +0000324// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
325// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib/../lib32"
326// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib/../lib32"
327// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
328// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib"
329// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib"
330//
331// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000332// RUN: --target=i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000333// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700334// RUN: --gcc-toolchain="" \
Chandler Carruth5058e3a2011-10-05 01:01:57 +0000335// RUN: --sysroot=%S/Inputs/basic_linux_tree \
336// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s
337// CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000338// CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0{{/|\\\\}}crtbegin.o"
Chandler Carruth12036002011-10-05 06:38:03 +0000339// CHECK-INSTALL-DIR-32: "-L{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0"
Chandler Carruth5058e3a2011-10-05 01:01:57 +0000340//
341// Check that with 64-bit builds, we don't actually use the install directory
342// as its version of GCC is lower than our sysrooted version.
343// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000344// RUN: --target=x86_64-unknown-linux -m64 \
Chandler Carruth12036002011-10-05 06:38:03 +0000345// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700346// RUN: --gcc-toolchain="" \
Chandler Carruth5058e3a2011-10-05 01:01:57 +0000347// RUN: --sysroot=%S/Inputs/basic_linux_tree \
348// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s
349// CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000350// CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtbegin.o"
Chandler Carruth5058e3a2011-10-05 01:01:57 +0000351// CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
Chandler Carruthdbc21442011-10-05 03:09:51 +0000352//
353// Check that we support unusual patch version formats, including missing that
354// component.
355// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000356// RUN: --target=i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000357// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700358// RUN: --gcc-toolchain="" \
Chandler Carruthdbc21442011-10-05 03:09:51 +0000359// RUN: --sysroot=%S/Inputs/basic_linux_tree \
360// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s
361// CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000362// CHECK-GCC-VERSION1: "{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7{{/|\\\\}}crtbegin.o"
Chandler Carruth12036002011-10-05 06:38:03 +0000363// CHECK-GCC-VERSION1: "-L{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7"
Chandler Carruthdbc21442011-10-05 03:09:51 +0000364// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000365// RUN: --target=i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000366// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing2/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700367// RUN: --gcc-toolchain="" \
Chandler Carruthdbc21442011-10-05 03:09:51 +0000368// RUN: --sysroot=%S/Inputs/basic_linux_tree \
369// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION2 %s
370// CHECK-GCC-VERSION2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000371// CHECK-GCC-VERSION2: "{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x{{/|\\\\}}crtbegin.o"
Chandler Carruth12036002011-10-05 06:38:03 +0000372// CHECK-GCC-VERSION2: "-L{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x"
Chandler Carruthdbc21442011-10-05 03:09:51 +0000373// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000374// RUN: --target=i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000375// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing3/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700376// RUN: --gcc-toolchain="" \
Chandler Carruthdbc21442011-10-05 03:09:51 +0000377// RUN: --sysroot=%S/Inputs/basic_linux_tree \
378// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION3 %s
379// CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000380// CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5{{/|\\\\}}crtbegin.o"
Chandler Carruth12036002011-10-05 06:38:03 +0000381// CHECK-GCC-VERSION3: "-L{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5"
Chandler Carruthcb2e00f2011-11-05 23:24:30 +0000382// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000383// RUN: --target=i386-unknown-linux -m32 \
Chandler Carruthcb2e00f2011-11-05 23:24:30 +0000384// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing4/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700385// RUN: --gcc-toolchain="" \
Chandler Carruthcb2e00f2011-11-05 23:24:30 +0000386// RUN: --sysroot=%S/Inputs/basic_linux_tree \
387// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION4 %s
388// CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000389// CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99{{/|\\\\}}crtbegin.o"
Chandler Carruthcb2e00f2011-11-05 23:24:30 +0000390// CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"
Chandler Carruthd936d9d2011-11-09 03:46:20 +0000391//
Stephen Hines651f13c2014-04-23 16:59:28 -0700392// Test a simulated installation of libc++ on Linux, both through sysroot and
393// the installation path of Clang.
394// RUN: %clangxx -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
395// RUN: -target x86_64-unknown-linux-gnu \
396// RUN: -stdlib=libc++ \
397// RUN: -ccc-install-dir %S/Inputs/basic_linux_tree/usr/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700398// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -0700399// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
400// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-SYSROOT %s
401// CHECK-BASIC-LIBCXX-SYSROOT: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
402// CHECK-BASIC-LIBCXX-SYSROOT: "-isysroot" "[[SYSROOT:[^"]+]]"
403// CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/include/c++/v1"
404// CHECK-BASIC-LIBCXX-SYSROOT: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
405// CHECK-BASIC-LIBCXX-SYSROOT: "--sysroot=[[SYSROOT]]"
406// RUN: %clang -no-canonical-prefixes -x c++ %s -### -o %t.o 2>&1 \
407// RUN: -target x86_64-unknown-linux-gnu \
408// RUN: -stdlib=libc++ \
409// RUN: -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700410// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -0700411// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
412// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-INSTALL %s
413// CHECK-BASIC-LIBCXX-INSTALL: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
414// CHECK-BASIC-LIBCXX-INSTALL: "-isysroot" "[[SYSROOT:[^"]+]]"
415// CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1"
416// CHECK-BASIC-LIBCXX-INSTALL: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
417// CHECK-BASIC-LIBCXX-INSTALL: "--sysroot=[[SYSROOT]]"
418// CHECK-BASIC-LIBCXX-INSTALL: "-L[[SYSROOT]]/usr/bin/../lib"
419//
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -0700420// Test that we can use -stdlib=libc++ in a build system even when it
421// occasionally links C code instead of C++ code.
422// RUN: %clang -no-canonical-prefixes -x c %s -### -o %t.o 2>&1 \
423// RUN: -target x86_64-unknown-linux-gnu \
424// RUN: -stdlib=libc++ \
425// RUN: -ccc-install-dir %S/Inputs/basic_linux_libcxx_tree/usr/bin \
426// RUN: --gcc-toolchain="" \
427// RUN: --sysroot=%S/Inputs/basic_linux_libcxx_tree \
428// RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBCXX-C-LINK %s
429// CHECK-BASIC-LIBCXX-C-LINK-NOT: warning:
430// CHECK-BASIC-LIBCXX-C-LINK: "{{[^"]*}}clang{{[^"]*}}" "-cc1"
431// CHECK-BASIC-LIBCXX-C-LINK: "-isysroot" "[[SYSROOT:[^"]+]]"
432// CHECK-BASIC-LIBCXX-C-LINK-NOT: "-internal-isystem" "[[SYSROOT]]/usr/bin/../include/c++/v1"
433// CHECK-BASIC-LIBCXX-C-LINK: "-internal-isystem" "[[SYSROOT]]/usr/local/include"
434// CHECK-BASIC-LIBCXX-C-LINK: "--sysroot=[[SYSROOT]]"
435// CHECK-BASIC-LIBCXX-C-LINK: "-L[[SYSROOT]]/usr/bin/../lib"
436//
Chandler Carruthd936d9d2011-11-09 03:46:20 +0000437// Test a very broken version of multiarch that shipped in Ubuntu 11.04.
438// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000439// RUN: --target=i386-unknown-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700440// RUN: --gcc-toolchain="" \
Chandler Carruthd936d9d2011-11-09 03:46:20 +0000441// RUN: --sysroot=%S/Inputs/ubuntu_11.04_multiarch_tree \
442// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s
443// CHECK-UBUNTU-11-04: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000444// CHECK-UBUNTU-11-04: "{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
Chandler Carruthd936d9d2011-11-09 03:46:20 +0000445// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
446// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu"
447// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
448// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
449// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib"
450// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib"
Hal Finkel39993dd2011-12-08 20:36:19 +0000451//
Jiangning Liuff104a12012-07-31 08:06:29 +0000452// Check multi arch support on Ubuntu 12.04 LTS.
453// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000454// RUN: --target=arm-unknown-linux-gnueabihf \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700455// RUN: --gcc-toolchain="" \
Jiangning Liuff104a12012-07-31 08:06:29 +0000456// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
457// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s
458// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000459// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crt1.o"
460// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crti.o"
461// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtbegin.o"
Jiangning Liuff104a12012-07-31 08:06:29 +0000462// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3"
463// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf"
464// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf"
465// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabihf"
466// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../.."
Rafael Espindolae4664a92013-06-24 22:07:15 +0000467// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3{{/|\\\\}}crtend.o"
468// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf{{/|\\\\}}crtn.o"
Jiangning Liuff104a12012-07-31 08:06:29 +0000469//
Chandler Carruth2a9b7582013-10-29 10:27:30 +0000470// Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabihf.
471// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
472// RUN: --target=arm-linux-gnueabihf \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700473// RUN: --gcc-toolchain="" \
Chandler Carruth2a9b7582013-10-29 10:27:30 +0000474// RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
475// RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM-HF %s
476// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
477// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-dynamic-linker" "/lib/ld-linux-armhf.so.3"
478// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crt1.o"
479// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crti.o"
480// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtbegin.o"
481// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8"
482// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib"
483// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/lib/../lib"
484// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/../lib"
485// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib"
486// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8{{/|\\\\}}crtend.o"
487// CHECK-X86-64-UBUNTU-13-10-ARM-HF: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabihf/4.8/../../../../arm-linux-gnueabihf/lib/../lib{{/|\\\\}}crtn.o"
488//
489// Check Ubuntu 13.10 on x86-64 targeting arm-linux-gnueabi.
490// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
491// RUN: --target=arm-linux-gnueabi \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700492// RUN: --gcc-toolchain="" \
Chandler Carruth2a9b7582013-10-29 10:27:30 +0000493// RUN: --sysroot=%S/Inputs/x86-64_ubuntu_13.10 \
494// RUN: | FileCheck --check-prefix=CHECK-X86-64-UBUNTU-13-10-ARM %s
495// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
496// CHECK-X86-64-UBUNTU-13-10-ARM: "-dynamic-linker" "/lib/ld-linux.so.3"
497// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crt1.o"
498// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crti.o"
499// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtbegin.o"
500// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7"
501// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib"
502// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/lib/../lib"
503// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/../lib"
504// CHECK-X86-64-UBUNTU-13-10-ARM: "-L[[SYSROOT]]/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib"
505// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7{{/|\\\\}}crtend.o"
506// CHECK-X86-64-UBUNTU-13-10-ARM: "{{.*}}/usr/lib/gcc-cross/arm-linux-gnueabi/4.7/../../../../arm-linux-gnueabi/lib/../lib{{/|\\\\}}crtn.o"
507//
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700508// Check Ubuntu 14.04 on powerpc64le.
509// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
510// RUN: --target=powerpc64le-unknown-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700511// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700512// RUN: --sysroot=%S/Inputs/ubuntu_14.04_multiarch_tree \
513// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-14-04-PPC64LE %s
514// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
515// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crt1.o"
516// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crti.o"
517// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtbegin.o"
518// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8"
519// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu"
520// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/lib/powerpc64le-linux-gnu"
521// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/powerpc64le-linux-gnu"
522// CHECK-UBUNTU-14-04-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../.."
523// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8{{/|\\\\}}crtend.o"
524// CHECK-UBUNTU-14-04-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.8/../../../powerpc64le-linux-gnu{{/|\\\\}}crtn.o"
525//
526// Check Ubuntu 14.04 on x32.
527// "/usr/lib/gcc/x86_64-linux-gnu/4.8/x32/crtend.o" "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32/crtn.o"
528// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
529// RUN: --target=x86_64-unknown-linux-gnux32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700530// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700531// RUN: --sysroot=%S/Inputs/ubuntu_14.04_multiarch_tree \
532// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-14-04-X32 %s
533// CHECK-UBUNTU-14-04-X32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
534// CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crt1.o"
535// CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crti.o"
536// CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/x32{{/|\\\\}}crtbegin.o"
537// CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/x32"
538// CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32"
539// CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/lib/../libx32"
540// CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/../libx32"
541// CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu/../../libx32"
542// CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8"
543// CHECK-UBUNTU-14-04-X32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../.."
544// CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/x32{{/|\\\\}}crtend.o"
545// CHECK-UBUNTU-14-04-X32: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../libx32{{/|\\\\}}crtn.o"
546//
Rafael Espindolad44d04f2013-04-14 10:14:21 +0000547// Check fedora 18 on arm.
548// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000549// RUN: --target=armv7-unknown-linux-gnueabihf \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700550// RUN: --gcc-toolchain="" \
Rafael Espindolad44d04f2013-04-14 10:14:21 +0000551// RUN: --sysroot=%S/Inputs/fedora_18_tree \
552// RUN: | FileCheck --check-prefix=CHECK-FEDORA-18-ARM-HF %s
553// CHECK-FEDORA-18-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruth2a9b7582013-10-29 10:27:30 +0000554// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crt1.o"
555// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crti.o"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000556// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtbegin.o"
Rafael Espindolad44d04f2013-04-14 10:14:21 +0000557// CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2"
Chandler Carruth2a9b7582013-10-29 10:27:30 +0000558// CHECK-FEDORA-18-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000559// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2{{/|\\\\}}crtend.o"
Chandler Carruth2a9b7582013-10-29 10:27:30 +0000560// CHECK-FEDORA-18-ARM-HF: "{{.*}}/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.7.2/../../../../lib{{/|\\\\}}crtn.o"
Rafael Espindolad44d04f2013-04-14 10:14:21 +0000561//
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700562// Check Fedora 21 on AArch64.
563// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
564// RUN: --target=arm64-unknown-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700565// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700566// RUN: --sysroot=%S/Inputs/fedora_21_tree \
567// RUN: | FileCheck --check-prefix=CHECK-FEDORA-21-AARCH64 %s
568// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
569// RUN: --target=aarch64-unknown-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700570// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700571// RUN: --sysroot=%S/Inputs/fedora_21_tree \
572// RUN: | FileCheck --check-prefix=CHECK-FEDORA-21-AARCH64 %s
573// CHECK-FEDORA-21-AARCH64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
574// CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crt1.o"
575// CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crti.o"
576// CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtbegin.o"
577// CHECK-FEDORA-21-AARCH64: "-L[[SYSROOT]]/usr/lib/gcc/aarch64-redhat-linux/4.9.0"
578// CHECK-FEDORA-21-AARCH64: "-L[[SYSROOT]]/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64"
579// CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtend.o"
580// CHECK-FEDORA-21-AARCH64: "{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crtn.o"
581//
Jiangning Liuff104a12012-07-31 08:06:29 +0000582// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000583// RUN: --target=arm-unknown-linux-gnueabi \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700584// RUN: --gcc-toolchain="" \
Jiangning Liuff104a12012-07-31 08:06:29 +0000585// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
586// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s
587// CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000588// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crt1.o"
589// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crti.o"
590// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtbegin.o"
Jiangning Liuff104a12012-07-31 08:06:29 +0000591// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1"
592// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi"
593// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi"
594// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi"
595// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../.."
Rafael Espindolae4664a92013-06-24 22:07:15 +0000596// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1{{/|\\\\}}crtend.o"
597// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi{{/|\\\\}}crtn.o"
Jiangning Liuff104a12012-07-31 08:06:29 +0000598//
Hal Finkel39993dd2011-12-08 20:36:19 +0000599// Test the setup that shipped in SUSE 10.3 on ppc64.
600// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000601// RUN: --target=powerpc64-suse-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700602// RUN: --gcc-toolchain="" \
Hal Finkel39993dd2011-12-08 20:36:19 +0000603// RUN: --sysroot=%S/Inputs/suse_10.3_ppc64_tree \
604// RUN: | FileCheck --check-prefix=CHECK-SUSE-10-3-PPC64 %s
605// CHECK-SUSE-10-3-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000606// CHECK-SUSE-10-3-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64{{/|\\\\}}crtbegin.o"
Hal Finkel39993dd2011-12-08 20:36:19 +0000607// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64"
608// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/../../../../lib64"
609// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
610// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000611//
Jiangning Liu6cc9dc82012-07-30 11:05:56 +0000612// Check dynamic-linker for different archs
613// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000614// RUN: --target=arm-linux-gnueabi \
Jiangning Liu6cc9dc82012-07-30 11:05:56 +0000615// RUN: | FileCheck --check-prefix=CHECK-ARM %s
616// CHECK-ARM: "{{.*}}ld{{(.exe)?}}"
617// CHECK-ARM: "-m" "armelf_linux_eabi"
618// CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3"
619//
620// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000621// RUN: --target=arm-linux-gnueabihf \
Jiangning Liu6cc9dc82012-07-30 11:05:56 +0000622// RUN: | FileCheck --check-prefix=CHECK-ARM-HF %s
623// CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}"
624// CHECK-ARM-HF: "-m" "armelf_linux_eabi"
625// CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
626//
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700627// RUN: %clang %s -### -o %t.o 2>&1 \
Stephen Hines176edba2014-12-01 14:53:08 -0800628// RUN: --target=powerpc64-linux-gnu \
629// RUN: | FileCheck --check-prefix=CHECK-PPC64 %s
630// CHECK-PPC64: "{{.*}}ld{{(.exe)?}}"
631// CHECK-PPC64: "-m" "elf64ppc"
632// CHECK-PPC64: "-dynamic-linker" "{{.*}}/lib64/ld64.so.1"
633//
634// RUN: %clang %s -### -o %t.o 2>&1 \
635// RUN: --target=powerpc64-linux-gnu -mabi=elfv1 \
636// RUN: | FileCheck --check-prefix=CHECK-PPC64-ELFv1 %s
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -0700637// RUN: %clang %s -### -o %t.o 2>&1 \
638// RUN: --target=powerpc64-linux-gnu -mabi=elfv1-qpx \
639// RUN: | FileCheck --check-prefix=CHECK-PPC64-ELFv1 %s
Stephen Hines176edba2014-12-01 14:53:08 -0800640// CHECK-PPC64-ELFv1: "{{.*}}ld{{(.exe)?}}"
641// CHECK-PPC64-ELFv1: "-m" "elf64ppc"
642// CHECK-PPC64-ELFv1: "-dynamic-linker" "{{.*}}/lib64/ld64.so.1"
643//
644// RUN: %clang %s -### -o %t.o 2>&1 \
645// RUN: --target=powerpc64-linux-gnu -mabi=elfv2 \
646// RUN: | FileCheck --check-prefix=CHECK-PPC64-ELFv2 %s
647// CHECK-PPC64-ELFv2: "{{.*}}ld{{(.exe)?}}"
648// CHECK-PPC64-ELFv2: "-m" "elf64ppc"
649// CHECK-PPC64-ELFv2: "-dynamic-linker" "{{.*}}/lib64/ld64.so.2"
650//
651// RUN: %clang %s -### -o %t.o 2>&1 \
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700652// RUN: --target=powerpc64le-linux-gnu \
653// RUN: | FileCheck --check-prefix=CHECK-PPC64LE %s
654// CHECK-PPC64LE: "{{.*}}ld{{(.exe)?}}"
655// CHECK-PPC64LE: "-m" "elf64lppc"
656// CHECK-PPC64LE: "-dynamic-linker" "{{.*}}/lib64/ld64.so.2"
657//
Stephen Hines176edba2014-12-01 14:53:08 -0800658// RUN: %clang %s -### -o %t.o 2>&1 \
659// RUN: --target=powerpc64le-linux-gnu -mabi=elfv1 \
660// RUN: | FileCheck --check-prefix=CHECK-PPC64LE-ELFv1 %s
661// CHECK-PPC64LE-ELFv1: "{{.*}}ld{{(.exe)?}}"
662// CHECK-PPC64LE-ELFv1: "-m" "elf64lppc"
663// CHECK-PPC64LE-ELFv1: "-dynamic-linker" "{{.*}}/lib64/ld64.so.1"
664//
665// RUN: %clang %s -### -o %t.o 2>&1 \
666// RUN: --target=powerpc64le-linux-gnu -mabi=elfv2 \
667// RUN: | FileCheck --check-prefix=CHECK-PPC64LE-ELFv2 %s
668// CHECK-PPC64LE-ELFv2: "{{.*}}ld{{(.exe)?}}"
669// CHECK-PPC64LE-ELFv2: "-m" "elf64lppc"
670// CHECK-PPC64LE-ELFv2: "-dynamic-linker" "{{.*}}/lib64/ld64.so.2"
671//
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000672// Check that we do not pass --hash-style=gnu and --hash-style=both to linker
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000673// and provide correct path to the dynamic linker and emulation mode when build
674// for MIPS platforms.
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000675// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000676// RUN: --target=mips-linux-gnu \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000677// RUN: | FileCheck --check-prefix=CHECK-MIPS %s
678// CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000679// CHECK-MIPS: "-m" "elf32btsmip"
680// CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000681// CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700682//
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000683// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000684// RUN: --target=mipsel-linux-gnu \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000685// RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s
686// CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000687// CHECK-MIPSEL: "-m" "elf32ltsmip"
688// CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000689// CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700690//
691// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-gnu -mnan=2008 \
692// RUN: | FileCheck --check-prefix=CHECK-MIPSEL-NAN2008 %s
693// CHECK-MIPSEL-NAN2008: "{{.*}}ld{{(.exe)?}}"
694// CHECK-MIPSEL-NAN2008: "-m" "elf32ltsmip"
695// CHECK-MIPSEL-NAN2008: "-dynamic-linker" "{{.*}}/lib/ld-linux-mipsn8.so.1"
696// CHECK-MIPSEL-NAN2008-NOT: "--hash-style={{gnu|both}}"
697//
698// RUN: %clang %s -### -o %t.o 2>&1 --target=mipsel-linux-gnu -mcpu=mips32r6 \
699// RUN: | FileCheck --check-prefix=CHECK-MIPS32R6EL %s
700// CHECK-MIPS32R6EL: "{{.*}}ld{{(.exe)?}}"
701// CHECK-MIPS32R6EL: "-m" "elf32ltsmip"
702// CHECK-MIPS32R6EL: "-dynamic-linker" "{{.*}}/lib/ld-linux-mipsn8.so.1"
703// CHECK-MIPS32R6EL-NOT: "--hash-style={{gnu|both}}"
704//
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000705// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000706// RUN: --target=mips64-linux-gnu \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000707// RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s
708// CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000709// CHECK-MIPS64: "-m" "elf64btsmip"
710// CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000711// CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700712//
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000713// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000714// RUN: --target=mips64el-linux-gnu \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000715// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s
716// CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000717// CHECK-MIPS64EL: "-m" "elf64ltsmip"
718// CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000719// CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700720//
721// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-gnu -mnan=2008 \
722// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-NAN2008 %s
723// CHECK-MIPS64EL-NAN2008: "{{.*}}ld{{(.exe)?}}"
724// CHECK-MIPS64EL-NAN2008: "-m" "elf64ltsmip"
725// CHECK-MIPS64EL-NAN2008: "-dynamic-linker" "{{.*}}/lib64/ld-linux-mipsn8.so.1"
726// CHECK-MIPS64EL-NAN2008-NOT: "--hash-style={{gnu|both}}"
727//
728// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-gnu -mcpu=mips64r6 \
729// RUN: | FileCheck --check-prefix=CHECK-MIPS64R6EL %s
730// CHECK-MIPS64R6EL: "{{.*}}ld{{(.exe)?}}"
731// CHECK-MIPS64R6EL: "-m" "elf64ltsmip"
732// CHECK-MIPS64R6EL: "-dynamic-linker" "{{.*}}/lib64/ld-linux-mipsn8.so.1"
733// CHECK-MIPS64R6EL-NOT: "--hash-style={{gnu|both}}"
734//
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000735// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000736// RUN: --target=mips64-linux-gnu -mabi=n32 \
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000737// RUN: | FileCheck --check-prefix=CHECK-MIPS64-N32 %s
738// CHECK-MIPS64-N32: "{{.*}}ld{{(.exe)?}}"
739// CHECK-MIPS64-N32: "-m" "elf32btsmipn32"
740// CHECK-MIPS64-N32: "-dynamic-linker" "{{.*}}/lib32/ld.so.1"
741// CHECK-MIPS64-N32-NOT: "--hash-style={{gnu|both}}"
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700742//
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000743// RUN: %clang %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000744// RUN: --target=mips64el-linux-gnu -mabi=n32 \
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000745// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL-N32 %s
746// CHECK-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}"
747// CHECK-MIPS64EL-N32: "-m" "elf32ltsmipn32"
748// CHECK-MIPS64EL-N32: "-dynamic-linker" "{{.*}}/lib32/ld.so.1"
749// CHECK-MIPS64EL-N32-NOT: "--hash-style={{gnu|both}}"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000750//
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700751// RUN: %clang %s -### -o %t.o 2>&1 --target=mips64el-linux-gnu -mabi=n32 \
752// RUN: -mnan=2008 | FileCheck --check-prefix=CHECK-MIPS64EL-N32-NAN2008 %s
753// CHECK-MIPS64EL-N32-NAN2008: "{{.*}}ld{{(.exe)?}}"
754// CHECK-MIPS64EL-N32-NAN2008: "-m" "elf32ltsmipn32"
755// CHECK-MIPS64EL-N32-NAN2008: "-dynamic-linker" "{{.*}}/lib32/ld-linux-mipsn8.so.1"
756// CHECK-MIPS64EL-N32-NAN2008-NOT: "--hash-style={{gnu|both}}"
757//
Stephen Hines651f13c2014-04-23 16:59:28 -0700758// RUN: %clang %s -### -o %t.o 2>&1 \
759// RUN: --target=sparc-linux-gnu \
760// RUN: | FileCheck --check-prefix=CHECK-SPARCV8 %s
761// CHECK-SPARCV8: "{{.*}}ld{{(.exe)?}}"
762// CHECK-SPARCV8: "-m" "elf32_sparc"
763// CHECK-SPARCV8: "-dynamic-linker" "/lib/ld-linux.so.2"
764//
765// RUN: %clang %s -### -o %t.o 2>&1 \
766// RUN: --target=sparcv9-linux-gnu \
767// RUN: | FileCheck --check-prefix=CHECK-SPARCV9 %s
768// CHECK-SPARCV9: "{{.*}}ld{{(.exe)?}}"
769// CHECK-SPARCV9: "-m" "elf64_sparc"
770// CHECK-SPARCV9: "-dynamic-linker" "/lib64/ld-linux.so.2"
771//
Chandler Carruth155c54c2012-02-26 09:03:21 +0000772// Thoroughly exercise the Debian multiarch environment.
773// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000774// RUN: --target=i686-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700775// RUN: --gcc-toolchain="" \
Chandler Carruth155c54c2012-02-26 09:03:21 +0000776// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
777// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s
778// CHECK-DEBIAN-X86: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000779// CHECK-DEBIAN-X86: "{{.*}}/usr/lib/gcc/i686-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000780// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5"
781// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../i386-linux-gnu"
782// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
783// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../.."
784// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/lib"
785// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib"
786// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000787// RUN: --target=x86_64-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700788// RUN: --gcc-toolchain="" \
Chandler Carruth155c54c2012-02-26 09:03:21 +0000789// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
790// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s
791// CHECK-DEBIAN-X86-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000792// CHECK-DEBIAN-X86-64: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000793// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5"
794// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../x86_64-linux-gnu"
795// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu"
796// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../.."
797// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/lib"
798// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib"
799// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000800// RUN: --target=powerpc-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700801// RUN: --gcc-toolchain="" \
Chandler Carruth155c54c2012-02-26 09:03:21 +0000802// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
803// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
804// CHECK-DEBIAN-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000805// CHECK-DEBIAN-PPC: "{{.*}}/usr/lib/gcc/powerpc-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000806// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5"
807// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../powerpc-linux-gnu"
808// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/powerpc-linux-gnu"
809// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../.."
810// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/lib"
811// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib"
812// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000813// RUN: --target=powerpc64-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700814// RUN: --gcc-toolchain="" \
Chandler Carruth155c54c2012-02-26 09:03:21 +0000815// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
816// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
817// CHECK-DEBIAN-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000818// CHECK-DEBIAN-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000819// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5"
820// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../powerpc64-linux-gnu"
821// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/powerpc64-linux-gnu"
822// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.."
823// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib"
824// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib"
Simon Atanasyan4f148d92012-04-26 08:35:58 +0000825// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000826// RUN: --target=mips-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700827// RUN: --gcc-toolchain="" \
Simon Atanasyan4f148d92012-04-26 08:35:58 +0000828// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
829// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS %s
830// CHECK-DEBIAN-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000831// CHECK-DEBIAN-MIPS: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
Simon Atanasyan4f148d92012-04-26 08:35:58 +0000832// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
833// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../../mips-linux-gnu"
834// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/mips-linux-gnu"
835// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
836// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/lib"
837// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib"
838// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000839// RUN: --target=mipsel-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700840// RUN: --gcc-toolchain="" \
Simon Atanasyan4f148d92012-04-26 08:35:58 +0000841// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
842// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPSEL %s
843// CHECK-DEBIAN-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000844// CHECK-DEBIAN-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5{{/|\\\\}}crtbegin.o"
Simon Atanasyan4f148d92012-04-26 08:35:58 +0000845// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
846// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../../mipsel-linux-gnu"
847// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/mipsel-linux-gnu"
848// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
849// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/lib"
850// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib"
Simon Atanasyanb8c43812012-04-26 19:57:02 +0000851// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000852// RUN: --target=mips64-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700853// RUN: --gcc-toolchain="" \
Simon Atanasyanb8c43812012-04-26 19:57:02 +0000854// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
855// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64 %s
856// CHECK-DEBIAN-MIPS64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000857// CHECK-DEBIAN-MIPS64: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/64{{/|\\\\}}crtbegin.o"
Simon Atanasyanb8c43812012-04-26 19:57:02 +0000858// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/64"
859// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
860// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
861// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/lib"
862// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib"
863// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000864// RUN: --target=mips64el-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700865// RUN: --gcc-toolchain="" \
Simon Atanasyanb8c43812012-04-26 19:57:02 +0000866// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
867// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL %s
868// CHECK-DEBIAN-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000869// CHECK-DEBIAN-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/64{{/|\\\\}}crtbegin.o"
Simon Atanasyanb8c43812012-04-26 19:57:02 +0000870// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/64"
871// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
872// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
873// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/lib"
874// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000875// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000876// RUN: --target=mips64-linux-gnu -mabi=n32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700877// RUN: --gcc-toolchain="" \
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000878// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
879// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64-N32 %s
880// CHECK-DEBIAN-MIPS64-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000881// CHECK-DEBIAN-MIPS64-N32: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/n32{{/|\\\\}}crtbegin.o"
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000882// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/n32"
883// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
884// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
885// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/lib"
886// CHECK-DEBIAN-MIPS64-N32: "-L[[SYSROOT]]/usr/lib"
887// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000888// RUN: --target=mips64el-linux-gnu -mabi=n32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700889// RUN: --gcc-toolchain="" \
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000890// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
891// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL-N32 %s
892// CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000893// CHECK-DEBIAN-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/n32{{/|\\\\}}crtbegin.o"
Simon Atanasyanf4bd3292012-10-21 11:44:57 +0000894// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/n32"
895// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
896// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
897// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
898// CHECK-DEBIAN-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000899//
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000900// Test linker invocation on Android.
901// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000902// RUN: --target=arm-linux-androideabi \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700903// RUN: --gcc-toolchain="" \
Evgeniy Stepanov1d01afe2012-09-03 09:05:50 +0000904// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000905// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
Logan Chien94a71422012-09-02 09:30:11 +0000906// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000907// RUN: --target=arm-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700908// RUN: --gcc-toolchain="" \
Evgeniy Stepanov1d01afe2012-09-03 09:05:50 +0000909// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
Logan Chien94a71422012-09-02 09:30:11 +0000910// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +0000911// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700912// RUN: --target=aarch64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700913// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700914// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
915// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
916// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
917// RUN: --target=arm64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700918// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700919// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
920// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
921// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000922// RUN: --target=mipsel-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700923// RUN: --gcc-toolchain="" \
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +0000924// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
925// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
Rafael Espindola715852c2012-11-02 20:41:30 +0000926// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines651f13c2014-04-23 16:59:28 -0700927// RUN: --target=mips64el-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700928// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -0700929// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
930// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
931// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
932// RUN: --target=i686-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700933// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -0700934// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
935// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
936// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
937// RUN: --target=x86_64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700938// RUN: --gcc-toolchain="" \
Rafael Espindola715852c2012-11-02 20:41:30 +0000939// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
940// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000941// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000942// CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000943// CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
944// CHECK-ANDROID-NOT: "gcc_s"
945// CHECK-ANDROID: "-lgcc"
Logan Chien529a73d2012-11-19 12:04:11 +0000946// CHECK-ANDROID: "-ldl"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000947// CHECK-ANDROID-NOT: "gcc_s"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000948// CHECK-ANDROID: "{{.*}}{{/|\\\\}}crtend_android.o"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000949// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000950// RUN: --target=arm-linux-androideabi \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700951// RUN: --gcc-toolchain="" \
Evgeniy Stepanov1d01afe2012-09-03 09:05:50 +0000952// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000953// RUN: -shared \
954// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
Logan Chien94a71422012-09-02 09:30:11 +0000955// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000956// RUN: --target=arm-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700957// RUN: --gcc-toolchain="" \
Evgeniy Stepanov1d01afe2012-09-03 09:05:50 +0000958// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
Logan Chien94a71422012-09-02 09:30:11 +0000959// RUN: -shared \
960// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +0000961// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700962// RUN: --target=aarch64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700963// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -0700964// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
965// RUN: -shared \
966// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
967// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
968// RUN: --target=arm64-linux-android \
969// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
970// RUN: -shared \
971// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
972// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +0000973// RUN: --target=mipsel-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700974// RUN: --gcc-toolchain="" \
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +0000975// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
976// RUN: -shared \
977// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
Rafael Espindola715852c2012-11-02 20:41:30 +0000978// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines651f13c2014-04-23 16:59:28 -0700979// RUN: --target=mips64el-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700980// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -0700981// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
982// RUN: -shared \
983// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
984// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
985// RUN: --target=i686-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700986// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -0700987// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
988// RUN: -shared \
989// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
990// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
991// RUN: --target=x86_64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -0700992// RUN: --gcc-toolchain="" \
Rafael Espindola715852c2012-11-02 20:41:30 +0000993// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
994// RUN: -shared \
995// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000996// CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Stephen Hinesc568f1e2014-07-21 00:47:37 -0700997// CHECK-ANDROID-SO-NOT: "-Bsymbolic"
Rafael Espindolae4664a92013-06-24 22:07:15 +0000998// CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtbegin_so.o"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000999// CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
1000// CHECK-ANDROID-SO-NOT: "gcc_s"
1001// CHECK-ANDROID-SO: "-lgcc"
Logan Chien529a73d2012-11-19 12:04:11 +00001002// CHECK-ANDROID-SO: "-ldl"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +00001003// CHECK-ANDROID-SO-NOT: "gcc_s"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001004// CHECK-ANDROID-SO: "{{.*}}{{/|\\\\}}crtend_so.o"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +00001005// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001006// RUN: --target=arm-linux-androideabi \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001007// RUN: --gcc-toolchain="" \
Evgeniy Stepanov1d01afe2012-09-03 09:05:50 +00001008// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +00001009// RUN: -static \
1010// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
Logan Chien94a71422012-09-02 09:30:11 +00001011// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001012// RUN: --target=arm-linux-android \
Evgeniy Stepanov1d01afe2012-09-03 09:05:50 +00001013// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
Logan Chien94a71422012-09-02 09:30:11 +00001014// RUN: -static \
1015// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +00001016// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001017// RUN: --target=aarch64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001018// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001019// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1020// RUN: -static \
1021// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1022// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1023// RUN: --target=arm64-linux-android \
1024// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1025// RUN: -static \
1026// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1027// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001028// RUN: --target=mipsel-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001029// RUN: --gcc-toolchain="" \
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +00001030// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1031// RUN: -static \
1032// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
Rafael Espindola715852c2012-11-02 20:41:30 +00001033// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines651f13c2014-04-23 16:59:28 -07001034// RUN: --target=mips64el-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001035// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001036// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1037// RUN: -static \
1038// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1039// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1040// RUN: --target=i686-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001041// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001042// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1043// RUN: -static \
1044// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
1045// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines176edba2014-12-01 14:53:08 -08001046// RUN: --target=x86_64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001047// RUN: --gcc-toolchain="" \
Rafael Espindola715852c2012-11-02 20:41:30 +00001048// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1049// RUN: -static \
1050// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +00001051// CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001052// CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtbegin_static.o"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +00001053// CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib"
1054// CHECK-ANDROID-STATIC-NOT: "gcc_s"
1055// CHECK-ANDROID-STATIC: "-lgcc"
Logan Chien529a73d2012-11-19 12:04:11 +00001056// CHECK-ANDROID-STATIC-NOT: "-ldl"
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +00001057// CHECK-ANDROID-STATIC-NOT: "gcc_s"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001058// CHECK-ANDROID-STATIC: "{{.*}}{{/|\\\\}}crtend_android.o"
Evgeniy Stepanova92983d2012-09-10 10:30:12 +00001059// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001060// RUN: --target=arm-linux-androideabi \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001061// RUN: --gcc-toolchain="" \
Evgeniy Stepanova92983d2012-09-10 10:30:12 +00001062// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1063// RUN: -pie \
1064// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1065// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001066// RUN: --target=arm-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001067// RUN: --gcc-toolchain="" \
Evgeniy Stepanova92983d2012-09-10 10:30:12 +00001068// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1069// RUN: -pie \
1070// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +00001071// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001072// RUN: --target=aarch64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001073// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001074// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1075// RUN: -pie \
1076// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1077// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1078// RUN: --target=arm64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001079// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001080// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1081// RUN: -pie \
1082// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1083// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001084// RUN: --target=mipsel-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001085// RUN: --gcc-toolchain="" \
Simon Atanasyanf8d9bd52012-10-03 17:46:38 +00001086// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1087// RUN: -pie \
1088// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
Rafael Espindola715852c2012-11-02 20:41:30 +00001089// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines651f13c2014-04-23 16:59:28 -07001090// RUN: --target=mips64el-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001091// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001092// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1093// RUN: -pie \
1094// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1095// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1096// RUN: --target=i686-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001097// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001098// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1099// RUN: -pie \
1100// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
1101// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1102// RUN: --target=x86_64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001103// RUN: --gcc-toolchain="" \
Rafael Espindola715852c2012-11-02 20:41:30 +00001104// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1105// RUN: -pie \
1106// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PIE %s
Evgeniy Stepanova92983d2012-09-10 10:30:12 +00001107// CHECK-ANDROID-PIE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001108// CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtbegin_dynamic.o"
Evgeniy Stepanova92983d2012-09-10 10:30:12 +00001109// CHECK-ANDROID-PIE: "-L[[SYSROOT]]/usr/lib"
1110// CHECK-ANDROID-PIE-NOT: "gcc_s"
1111// CHECK-ANDROID-PIE: "-lgcc"
1112// CHECK-ANDROID-PIE-NOT: "gcc_s"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001113// CHECK-ANDROID-PIE: "{{.*}}{{/|\\\\}}crtend_android.o"
Stephen Hines651f13c2014-04-23 16:59:28 -07001114// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1115// RUN: --target=arm-linux-androideabi \
Pirama Arumuga Nainar3ea9e332015-04-08 08:57:32 -07001116// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1117// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1118// RUN: --target=arm-linux-android \
1119// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1120// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1121// RUN: --target=aarch64-linux-android \
1122// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1123// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1124// RUN: --target=arm64-linux-android \
1125// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1126// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1127// RUN: --target=mipsel-linux-android \
1128// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1129// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1130// RUN: --target=mips64el-linux-android \
1131// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1132// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1133// RUN: --target=i686-linux-android \
1134// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1135// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1136// RUN: --target=x86_64-linux-android \
1137// RUN: | FileCheck --check-prefix=CHECK-ANDROID-NO-DEFAULT-PIE %s
1138// CHECK-ANDROID-NO-DEFAULT-PIE-NOT: -pie
1139// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1140// RUN: --target=arm-linux-androideabi \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001141// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001142// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1143// RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1144// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1145// RUN: --target=arm-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001146// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001147// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1148// RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1149// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1150// RUN: --target=mipsel-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001151// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001152// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1153// RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1154// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001155// RUN: --target=aarch64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001156// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001157// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1158// RUN: | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1159// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1160// RUN: --target=arm64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001161// RUN: --gcc-toolchain="" \
Stephen Hines6bcf27b2014-05-29 04:14:42 -07001162// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1163// RUN: | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1164// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Stephen Hines651f13c2014-04-23 16:59:28 -07001165// RUN: --target=mips64el-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001166// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001167// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1168// RUN: | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1169// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1170// RUN: --target=i686-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001171// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001172// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1173// RUN: | FileCheck --check-prefix=CHECK-ANDROID-32 %s
1174// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1175// RUN: --target=x86_64-linux-android \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001176// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001177// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1178// RUN: | FileCheck --check-prefix=CHECK-ANDROID-64 %s
1179// CHECK-ANDROID-32: "-dynamic-linker" "/system/bin/linker"
1180// CHECK-ANDROID-64: "-dynamic-linker" "/system/bin/linker64"
Simon Atanasyan7a918882012-09-14 11:27:24 +00001181//
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001182// Test that -pthread does not add -lpthread on Android.
1183// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1184// RUN: --target=arm-linux-androideabi -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001185// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001186// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1187// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1188// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1189// RUN: --target=arm-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001190// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001191// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1192// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1193// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1194// RUN: --target=aarch64-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001195// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001196// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1197// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1198// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1199// RUN: --target=arm64-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001200// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001201// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1202// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1203// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1204// RUN: --target=mipsel-linux-android -pthread \
1205// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1206// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1207// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1208// RUN: --target=mips64el-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001209// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001210// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1211// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1212// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1213// RUN: --target=i686-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001214// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001215// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1216// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1217// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1218// RUN: --target=x86_64-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001219// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001220// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1221// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1222// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1223// RUN: --target=arm-linux-androideabi -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001224// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001225// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1226// RUN: -shared \
1227// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1228// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1229// RUN: --target=arm-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001230// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001231// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1232// RUN: -shared \
1233// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1234// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1235// RUN: --target=aarch64-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001236// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001237// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1238// RUN: -shared \
1239// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1240// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1241// RUN: --target=arm64-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001242// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001243// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1244// RUN: -shared \
1245// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1246// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1247// RUN: --target=mipsel-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001248// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001249// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1250// RUN: -shared \
1251// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1252// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1253// RUN: --target=mips64el-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001254// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001255// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1256// RUN: -shared \
1257// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1258// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1259// RUN: --target=i686-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001260// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001261// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1262// RUN: -shared \
1263// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1264// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1265// RUN: --target=x86_64-linux-android -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001266// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001267// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1268// RUN: -shared \
1269// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
1270// CHECK-ANDROID-PTHREAD-NOT: -lpthread
1271//
1272// RUN: %clang -no-canonical-prefixes %t.o -### -o %t 2>&1 \
1273// RUN: --target=arm-linux-androideabi -pthread \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001274// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001275// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
1276// RUN: | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD-LINK %s
1277// CHECK-ANDROID-PTHREAD-LINK-NOT: argument unused during compilation: '-pthread'
1278//
Simon Atanasyan7a918882012-09-14 11:27:24 +00001279// Check linker invocation on Debian 6 MIPS 32/64-bit.
1280// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001281// RUN: --target=mipsel-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001282// RUN: --gcc-toolchain="" \
Simon Atanasyan7a918882012-09-14 11:27:24 +00001283// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
1284// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPSEL %s
1285// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001286// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crt1.o"
1287// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib{{/|\\\\}}crti.o"
1288// CHECK-DEBIAN-ML-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4{{/|\\\\}}crtbegin.o"
Simon Atanasyan7a918882012-09-14 11:27:24 +00001289// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4"
1290// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib"
1291// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib/../lib"
1292// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/../lib"
1293// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
1294// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/lib"
1295// CHECK-DEBIAN-ML-MIPSEL: "-L[[SYSROOT]]/usr/lib"
1296//
1297// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001298// RUN: --target=mips64el-linux-gnu \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001299// RUN: --gcc-toolchain="" \
Simon Atanasyan7a918882012-09-14 11:27:24 +00001300// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
1301// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL %s
1302// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001303// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crt1.o"
1304// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64{{/|\\\\}}crti.o"
1305// CHECK-DEBIAN-ML-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/64{{/|\\\\}}crtbegin.o"
Simon Atanasyan7a918882012-09-14 11:27:24 +00001306// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/64"
1307// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib64"
1308// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib/../lib64"
1309// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/../lib64"
1310// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
1311// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib"
1312// CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
Hal Finkel02014b42012-09-18 22:25:07 +00001313//
Simon Atanasyanf4bd3292012-10-21 11:44:57 +00001314// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001315// RUN: --target=mips64el-linux-gnu -mabi=n32 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001316// RUN: --gcc-toolchain="" \
Simon Atanasyanf4bd3292012-10-21 11:44:57 +00001317// RUN: --sysroot=%S/Inputs/debian_6_mips_tree \
1318// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-N32 %s
1319// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001320// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crt1.o"
1321// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32{{/|\\\\}}crti.o"
1322// CHECK-DEBIAN-ML-MIPS64EL-N32: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.4/n32{{/|\\\\}}crtbegin.o"
Simon Atanasyanf4bd3292012-10-21 11:44:57 +00001323// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/n32"
1324// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../../../lib32"
1325// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib/../lib32"
1326// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/../lib32"
1327// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.4/../../.."
1328// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/lib"
1329// CHECK-DEBIAN-ML-MIPS64EL-N32: "-L[[SYSROOT]]/usr/lib"
1330//
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001331// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1332// RUN: --target=mips64-linux-gnuabi64 -mabi=n64 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001333// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001334// RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
1335// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64-GNUABI %s
1336// CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1337// CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64{{/|\\\\}}crt1.o"
1338// CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64{{/|\\\\}}crti.o"
1339// CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9{{/|\\\\}}crtbegin.o"
1340// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9"
1341// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64"
1342// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/lib/mips64-linux-gnuabi64"
1343// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/mips64-linux-gnuabi64"
1344// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9"
1345// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../.."
1346// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/lib"
1347// CHECK-DEBIAN-ML-MIPS64-GNUABI: "-L[[SYSROOT]]/usr/lib"
1348// CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9{{/|\\\\}}crtend.o"
1349// CHECK-DEBIAN-ML-MIPS64-GNUABI: "{{.*}}/usr/lib/gcc/mips64-linux-gnuabi64/4.9/../../../mips64-linux-gnuabi64{{/|\\\\}}crtn.o"
1350//
1351// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1352// RUN: --target=mips64el-linux-gnuabi64 -mabi=n64 \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001353// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001354// RUN: --sysroot=%S/Inputs/debian_6_mips64_tree \
1355// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-ML-MIPS64EL-GNUABI %s
1356// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1357// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64{{/|\\\\}}crt1.o"
1358// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64{{/|\\\\}}crti.o"
1359// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9{{/|\\\\}}crtbegin.o"
1360// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9"
1361// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64"
1362// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/lib/mips64el-linux-gnuabi64"
1363// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/mips64el-linux-gnuabi64"
1364// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9"
1365// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../.."
1366// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/lib"
1367// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "-L[[SYSROOT]]/usr/lib"
1368// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9{{/|\\\\}}crtend.o"
1369// CHECK-DEBIAN-ML-MIPS64EL-GNUABI: "{{.*}}/usr/lib/gcc/mips64el-linux-gnuabi64/4.9/../../../mips64el-linux-gnuabi64{{/|\\\\}}crtn.o"
1370//
Hal Finkel02014b42012-09-18 22:25:07 +00001371// Test linker invocation for Freescale SDK (OpenEmbedded).
1372// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001373// RUN: --target=powerpc-fsl-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001374// RUN: --gcc-toolchain="" \
Hal Finkel02014b42012-09-18 22:25:07 +00001375// RUN: --sysroot=%S/Inputs/freescale_ppc_tree \
1376// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC %s
1377// CHECK-FSL-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1378// CHECK-FSL-PPC: "-m" "elf32ppclinux"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001379// CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crt1.o"
1380// CHECK-FSL-PPC: "{{.*}}{{/|\\\\}}crtbegin.o"
Hal Finkel02014b42012-09-18 22:25:07 +00001381// CHECK-FSL-PPC: "-L[[SYSROOT]]/usr/lib"
1382// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruthfbd41162013-06-20 09:42:40 +00001383// RUN: --target=powerpc64-fsl-linux \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001384// RUN: --gcc-toolchain="" \
Hal Finkel02014b42012-09-18 22:25:07 +00001385// RUN: --sysroot=%S/Inputs/freescale_ppc64_tree \
1386// RUN: | FileCheck --check-prefix=CHECK-FSL-PPC64 %s
1387// CHECK-FSL-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1388// CHECK-FSL-PPC64: "-m" "elf64ppc"
Rafael Espindolae4664a92013-06-24 22:07:15 +00001389// CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crt1.o"
1390// CHECK-FSL-PPC64: "{{.*}}{{/|\\\\}}crtbegin.o"
Hal Finkel02014b42012-09-18 22:25:07 +00001391// CHECK-FSL-PPC64: "-L[[SYSROOT]]/usr/lib64/powerpc64-fsl-linux/4.6.2/../.."
Benjamin Kramere20e5082012-10-04 19:42:20 +00001392//
Stephen Hines651f13c2014-04-23 16:59:28 -07001393// Check that crtfastmath.o is linked with -ffast-math and with -Ofast.
Chandler Carruthfbd41162013-06-20 09:42:40 +00001394// RUN: %clang --target=x86_64-unknown-linux -### %s \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001395// RUN: --gcc-toolchain="" \
Benjamin Kramere20e5082012-10-04 19:42:20 +00001396// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1397// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
Chandler Carruthfbd41162013-06-20 09:42:40 +00001398// RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001399// RUN: --gcc-toolchain="" \
Benjamin Kramere20e5082012-10-04 19:42:20 +00001400// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1401// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
Chandler Carruthfbd41162013-06-20 09:42:40 +00001402// RUN: %clang --target=x86_64-unknown-linux -### %s -funsafe-math-optimizations\
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001403// RUN: --gcc-toolchain="" \
Benjamin Kramere20e5082012-10-04 19:42:20 +00001404// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1405// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
Stephen Hines651f13c2014-04-23 16:59:28 -07001406// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast\
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001407// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001408// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1409// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1410// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -O3\
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001411// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001412// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1413// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
1414// RUN: %clang --target=x86_64-unknown-linux -### %s -O3 -Ofast\
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001415// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001416// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1417// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
Chandler Carruthfbd41162013-06-20 09:42:40 +00001418// RUN: %clang --target=x86_64-unknown-linux -### %s -ffast-math -fno-fast-math \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001419// RUN: --gcc-toolchain="" \
Benjamin Kramere20e5082012-10-04 19:42:20 +00001420// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1421// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
Stephen Hines651f13c2014-04-23 16:59:28 -07001422// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -fno-fast-math \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001423// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001424// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1425// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1426// RUN: %clang --target=x86_64-unknown-linux -### %s -Ofast -fno-unsafe-math-optimizations \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001427// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001428// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1429// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1430// RUN: %clang --target=x86_64-unknown-linux -### %s -fno-fast-math -Ofast \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001431// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001432// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1433// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
1434// RUN: %clang --target=x86_64-unknown-linux -### %s -fno-unsafe-math-optimizations -Ofast \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001435// RUN: --gcc-toolchain="" \
Stephen Hines651f13c2014-04-23 16:59:28 -07001436// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1437// RUN: | FileCheck --check-prefix=CHECK-CRTFASTMATH %s
Benjamin Kramere20e5082012-10-04 19:42:20 +00001438// We don't have crtfastmath.o in the i386 tree, use it to check that file
1439// detection works.
Chandler Carruthfbd41162013-06-20 09:42:40 +00001440// RUN: %clang --target=i386-unknown-linux -### %s -ffast-math \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001441// RUN: --gcc-toolchain="" \
Benjamin Kramere20e5082012-10-04 19:42:20 +00001442// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>&1 \
1443// RUN: | FileCheck --check-prefix=CHECK-NOCRTFASTMATH %s
Rafael Espindolae4664a92013-06-24 22:07:15 +00001444// CHECK-CRTFASTMATH: usr/lib/gcc/x86_64-unknown-linux/4.6.0{{/|\\\\}}crtfastmath.o
Benjamin Kramere20e5082012-10-04 19:42:20 +00001445// CHECK-NOCRTFASTMATH-NOT: crtfastmath.o
Eric Christopher61f08682013-06-07 23:25:01 +00001446
1447// Check that we link in gcrt1.o when compiling with -pg
Chandler Carruthfbd41162013-06-20 09:42:40 +00001448// RUN: %clang -pg --target=x86_64-unknown-linux -### %s \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001449// RUN: --gcc-toolchain="" \
Eric Christopher61f08682013-06-07 23:25:01 +00001450// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
1451// RUN: | FileCheck --check-prefix=CHECK-PG %s
1452// CHECK-PG: gcrt1.o
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001453
1454// GCC forwards -u to the linker.
1455// RUN: %clang -u asdf --target=x86_64-unknown-linux -### %s \
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001456// RUN: --gcc-toolchain="" \
Stephen Hinesc568f1e2014-07-21 00:47:37 -07001457// RUN: --sysroot=%S/Inputs/basic_linux_tree 2>& 1 \
1458// RUN: | FileCheck --check-prefix=CHECK-u %s
1459// CHECK-u: "-u" "asdf"
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001460
1461// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1462// RUN: --target=armeb-unknown-linux \
1463// RUN: --gcc-toolchain="" \
1464// RUN: --sysroot=%S/Inputs/basic_linux_tree \
1465// RUN: | FileCheck --check-prefix=CHECK-ARMEB %s
1466// CHECK-ARMEB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1467// CHECK-ARMEB-NOT: "--be8"
1468// CHECK-ARMEB: "-m" "armebelf_linux_eabi"
1469
1470// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
1471// RUN: --target=armebv7-unknown-linux \
1472// RUN: --gcc-toolchain="" \
1473// RUN: --sysroot=%S/Inputs/basic_linux_tree \
1474// RUN: | FileCheck --check-prefix=CHECK-ARMV7EB %s
1475// CHECK-ARMV7EB: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
1476// CHECK-ARMV7EB: "--be8"
1477// CHECK-ARMV7EB: "-m" "armebelf_linux_eabi"