blob: a6831b62a9045227d792665533665d7c4770e8dd [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 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +00005// RUN: -target i386-unknown-linux \
Chandler Carruthfde8d142011-10-03 06:41:08 +00006// RUN: --sysroot=%S/Inputs/basic_linux_tree \
Chandler Carruthc4cc4032011-10-01 00:37:39 +00007// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
Chandler Carruthfde8d142011-10-03 06:41:08 +00008// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruthb6fdf8f2011-10-03 08:16:09 +00009// CHECK-LD-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o"
Chandler Carruth663abc92011-10-03 08:02:58 +000010// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
Chandler Carruth621e6a62011-10-03 08:09:02 +000011// 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 +000012// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
13// CHECK-LD-32: "-L[[SYSROOT]]/lib"
14// CHECK-LD-32: "-L[[SYSROOT]]/usr/lib"
Chandler Carruthc4cc4032011-10-01 00:37:39 +000015//
Chandler Carruthfde8d142011-10-03 06:41:08 +000016// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +000017// RUN: -target x86_64-unknown-linux \
Chandler Carruthfde8d142011-10-03 06:41:08 +000018// RUN: --sysroot=%S/Inputs/basic_linux_tree \
Chandler Carruthc4cc4032011-10-01 00:37:39 +000019// RUN: | FileCheck --check-prefix=CHECK-LD-64 %s
Chandler Carruthfde8d142011-10-03 06:41:08 +000020// CHECK-LD-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruthb6fdf8f2011-10-03 08:16:09 +000021// CHECK-LD-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
Chandler Carruth663abc92011-10-03 08:02:58 +000022// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
Chandler Carruth621e6a62011-10-03 08:09:02 +000023// 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 +000024// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
25// CHECK-LD-64: "-L[[SYSROOT]]/lib"
26// CHECK-LD-64: "-L[[SYSROOT]]/usr/lib"
Chandler Carruth38ec5462011-10-03 09:00:50 +000027//
28// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +000029// RUN: -target i386-unknown-linux -m32 \
Chandler Carruth38ec5462011-10-03 09:00:50 +000030// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
31// RUN: | FileCheck --check-prefix=CHECK-32-TO-32 %s
32// CHECK-32-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
33// CHECK-32-TO-32: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/crtbegin.o"
34// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
35// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib32"
36// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib32"
37// CHECK-32-TO-32: "-L[[SYSROOT]]/lib/../lib32"
38// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
39// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
40// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
41// CHECK-32-TO-32: "-L[[SYSROOT]]/lib"
42// CHECK-32-TO-32: "-L[[SYSROOT]]/usr/lib"
43//
44// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +000045// RUN: -target i386-unknown-linux -m64 \
Chandler Carruth38ec5462011-10-03 09:00:50 +000046// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
47// RUN: | FileCheck --check-prefix=CHECK-32-TO-64 %s
48// CHECK-32-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
49// CHECK-32-TO-64: "{{.*}}/usr/lib/gcc/i386-unknown-linux/4.6.0/64/crtbegin.o"
50// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/64"
51// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib/../lib64"
52// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../lib64"
53// CHECK-32-TO-64: "-L[[SYSROOT]]/lib/../lib64"
54// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
55// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0"
56// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../../../i386-unknown-linux/lib"
57// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/i386-unknown-linux/4.6.0/../../.."
58// CHECK-32-TO-64: "-L[[SYSROOT]]/lib"
59// CHECK-32-TO-64: "-L[[SYSROOT]]/usr/lib"
Chandler Carruthc5306b02011-10-03 09:08:26 +000060//
61// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +000062// RUN: -target x86_64-unknown-linux -m64 \
Chandler Carruthc5306b02011-10-03 09:08:26 +000063// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
64// RUN: | FileCheck --check-prefix=CHECK-64-TO-64 %s
65// CHECK-64-TO-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
66// CHECK-64-TO-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
67// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
68// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib64"
69// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib64"
70// CHECK-64-TO-64: "-L[[SYSROOT]]/lib/../lib64"
71// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/../lib64"
72// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
73// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
74// CHECK-64-TO-64: "-L[[SYSROOT]]/lib"
75// CHECK-64-TO-64: "-L[[SYSROOT]]/usr/lib"
76//
77// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +000078// RUN: -target x86_64-unknown-linux -m32 \
Chandler Carruthc5306b02011-10-03 09:08:26 +000079// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree \
80// RUN: | FileCheck --check-prefix=CHECK-64-TO-32 %s
81// CHECK-64-TO-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
82// CHECK-64-TO-32: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o"
83// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
84// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib/../lib32"
85// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../lib32"
86// CHECK-64-TO-32: "-L[[SYSROOT]]/lib/../lib32"
87// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/../lib32"
88// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
89// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../../../x86_64-unknown-linux/lib"
90// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0/../../.."
91// CHECK-64-TO-32: "-L[[SYSROOT]]/lib"
92// CHECK-64-TO-32: "-L[[SYSROOT]]/usr/lib"
Chandler Carruth5058e3a2011-10-05 01:01:57 +000093//
94// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Chandler Carruth9f314372012-04-06 16:32:06 +000095// RUN: -target x86_64-unknown-linux -m32 \
96// RUN: -gcc-toolchain %S/Inputs/multilib_64bit_linux_tree/usr \
97// RUN: --sysroot=%S/Inputs/multilib_32bit_linux_tree \
98// RUN: | FileCheck --check-prefix=CHECK-64-TO-32-SYSROOT %s
99// CHECK-64-TO-32-SYSROOT: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
100// CHECK-64-TO-32-SYSROOT: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32/crtbegin.o"
101// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0/32"
102// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib/../lib32"
103// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib/../lib32"
104// CHECK-64-TO-32-SYSROOT: "-L{{[^"]*}}/Inputs/multilib_64bit_linux_tree/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
105// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/lib"
106// CHECK-64-TO-32-SYSROOT: "-L[[SYSROOT]]/usr/lib"
107//
108// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000109// RUN: -target i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000110// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
Chandler Carruth5058e3a2011-10-05 01:01:57 +0000111// RUN: --sysroot=%S/Inputs/basic_linux_tree \
112// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-32 %s
113// CHECK-INSTALL-DIR-32: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruth12036002011-10-05 06:38:03 +0000114// CHECK-INSTALL-DIR-32: "{{.*}}/Inputs/fake_install_tree/bin/../lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o"
115// 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 +0000116//
117// Check that with 64-bit builds, we don't actually use the install directory
118// as its version of GCC is lower than our sysrooted version.
119// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000120// RUN: -target x86_64-unknown-linux -m64 \
Chandler Carruth12036002011-10-05 06:38:03 +0000121// RUN: -ccc-install-dir %S/Inputs/fake_install_tree/bin \
Chandler Carruth5058e3a2011-10-05 01:01:57 +0000122// RUN: --sysroot=%S/Inputs/basic_linux_tree \
123// RUN: | FileCheck --check-prefix=CHECK-INSTALL-DIR-64 %s
124// CHECK-INSTALL-DIR-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
125// CHECK-INSTALL-DIR-64: "{{.*}}/usr/lib/gcc/x86_64-unknown-linux/4.6.0/crtbegin.o"
126// CHECK-INSTALL-DIR-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux/4.6.0"
Chandler Carruthdbc21442011-10-05 03:09:51 +0000127//
128// Check that we support unusual patch version formats, including missing that
129// component.
130// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000131// RUN: -target i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000132// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing1/bin \
Chandler Carruthdbc21442011-10-05 03:09:51 +0000133// RUN: --sysroot=%S/Inputs/basic_linux_tree \
134// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION1 %s
135// CHECK-GCC-VERSION1: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruth12036002011-10-05 06:38:03 +0000136// CHECK-GCC-VERSION1: "{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7/crtbegin.o"
137// CHECK-GCC-VERSION1: "-L{{.*}}/Inputs/gcc_version_parsing1/bin/../lib/gcc/i386-unknown-linux/4.7"
Chandler Carruthdbc21442011-10-05 03:09:51 +0000138// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000139// RUN: -target i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000140// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing2/bin \
Chandler Carruthdbc21442011-10-05 03:09:51 +0000141// RUN: --sysroot=%S/Inputs/basic_linux_tree \
142// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION2 %s
143// CHECK-GCC-VERSION2: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruth12036002011-10-05 06:38:03 +0000144// CHECK-GCC-VERSION2: "{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x/crtbegin.o"
145// CHECK-GCC-VERSION2: "-L{{.*}}/Inputs/gcc_version_parsing2/bin/../lib/gcc/i386-unknown-linux/4.7.x"
Chandler Carruthdbc21442011-10-05 03:09:51 +0000146// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000147// RUN: -target i386-unknown-linux -m32 \
Chandler Carruth12036002011-10-05 06:38:03 +0000148// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing3/bin \
Chandler Carruthdbc21442011-10-05 03:09:51 +0000149// RUN: --sysroot=%S/Inputs/basic_linux_tree \
150// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION3 %s
151// CHECK-GCC-VERSION3: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
Chandler Carruth12036002011-10-05 06:38:03 +0000152// CHECK-GCC-VERSION3: "{{.*}}/Inputs/gcc_version_parsing3/bin/../lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o"
153// 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 +0000154// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000155// RUN: -target i386-unknown-linux -m32 \
Chandler Carruthcb2e00f2011-11-05 23:24:30 +0000156// RUN: -ccc-install-dir %S/Inputs/gcc_version_parsing4/bin \
157// RUN: --sysroot=%S/Inputs/basic_linux_tree \
158// RUN: | FileCheck --check-prefix=CHECK-GCC-VERSION4 %s
159// CHECK-GCC-VERSION4: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
160// CHECK-GCC-VERSION4: "{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o"
161// CHECK-GCC-VERSION4: "-L{{.*}}/Inputs/gcc_version_parsing4/bin/../lib/gcc/i386-unknown-linux/4.7.99"
Chandler Carruthd936d9d2011-11-09 03:46:20 +0000162//
163// Test a very broken version of multiarch that shipped in Ubuntu 11.04.
164// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000165// RUN: -target i386-unknown-linux \
Chandler Carruthd936d9d2011-11-09 03:46:20 +0000166// RUN: --sysroot=%S/Inputs/ubuntu_11.04_multiarch_tree \
167// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-11-04 %s
168// CHECK-UBUNTU-11-04: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
169// CHECK-UBUNTU-11-04: "{{.*}}/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/crtbegin.o"
170// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5"
171// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../../i386-linux-gnu"
172// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
173// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."
174// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/lib"
175// CHECK-UBUNTU-11-04: "-L[[SYSROOT]]/usr/lib"
Hal Finkel39993dd2011-12-08 20:36:19 +0000176//
Jiangning Liuff104a12012-07-31 08:06:29 +0000177// Check multi arch support on Ubuntu 12.04 LTS.
178// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
179// RUN: -target arm-unknown-linux-gnueabihf \
180// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
181// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM-HF %s
182// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
183// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crt1.o"
184// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crti.o"
185// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtbegin.o"
186// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3"
187// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf"
188// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/lib/arm-linux-gnueabihf"
189// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabihf"
190// CHECK-UBUNTU-12-04-ARM-HF: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../.."
191// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/crtend.o"
192// CHECK-UBUNTU-12-04-ARM-HF: "{{.*}}/usr/lib/gcc/arm-linux-gnueabihf/4.6.3/../../../arm-linux-gnueabihf/crtn.o"
193//
194// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
195// RUN: -target arm-unknown-linux-gnueabi \
196// RUN: --sysroot=%S/Inputs/ubuntu_12.04_LTS_multiarch_tree \
197// RUN: | FileCheck --check-prefix=CHECK-UBUNTU-12-04-ARM %s
198// CHECK-UBUNTU-12-04-ARM: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
199// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crt1.o"
200// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crti.o"
201// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtbegin.o"
202// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1"
203// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi"
204// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/lib/arm-linux-gnueabi"
205// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/arm-linux-gnueabi"
206// CHECK-UBUNTU-12-04-ARM: "-L[[SYSROOT]]/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../.."
207// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/crtend.o"
208// CHECK-UBUNTU-12-04-ARM: "{{.*}}/usr/lib/gcc/arm-linux-gnueabi/4.6.1/../../../arm-linux-gnueabi/crtn.o"
209//
Hal Finkel39993dd2011-12-08 20:36:19 +0000210// Test the setup that shipped in SUSE 10.3 on ppc64.
211// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000212// RUN: -target powerpc64-suse-linux \
Hal Finkel39993dd2011-12-08 20:36:19 +0000213// RUN: --sysroot=%S/Inputs/suse_10.3_ppc64_tree \
214// RUN: | FileCheck --check-prefix=CHECK-SUSE-10-3-PPC64 %s
215// CHECK-SUSE-10-3-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
216// CHECK-SUSE-10-3-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64/crtbegin.o"
217// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/64"
218// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-suse-linux/4.1.2/../../../../lib64"
219// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/lib/../lib64"
220// CHECK-SUSE-10-3-PPC64: "-L[[SYSROOT]]/usr/lib/../lib64"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000221//
Jiangning Liu6cc9dc82012-07-30 11:05:56 +0000222// Check dynamic-linker for different archs
223// RUN: %clang %s -### -o %t.o 2>&1 \
224// RUN: -target arm-linux-gnueabi \
225// RUN: | FileCheck --check-prefix=CHECK-ARM %s
226// CHECK-ARM: "{{.*}}ld{{(.exe)?}}"
227// CHECK-ARM: "-m" "armelf_linux_eabi"
228// CHECK-ARM: "-dynamic-linker" "{{.*}}/lib/ld-linux.so.3"
229//
230// RUN: %clang %s -### -o %t.o 2>&1 \
231// RUN: -target arm-linux-gnueabihf \
232// RUN: | FileCheck --check-prefix=CHECK-ARM-HF %s
233// CHECK-ARM-HF: "{{.*}}ld{{(.exe)?}}"
234// CHECK-ARM-HF: "-m" "armelf_linux_eabi"
235// CHECK-ARM-HF: "-dynamic-linker" "{{.*}}/lib/ld-linux-armhf.so.3"
236//
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000237// Check that we do not pass --hash-style=gnu and --hash-style=both to linker
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000238// and provide correct path to the dynamic linker and emulation mode when build
239// for MIPS platforms.
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000240// RUN: %clang %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000241// RUN: -target mips-linux-gnu -ccc-clang-archs mips \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000242// RUN: | FileCheck --check-prefix=CHECK-MIPS %s
243// CHECK-MIPS: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000244// CHECK-MIPS: "-m" "elf32btsmip"
245// CHECK-MIPS: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000246// CHECK-MIPS-NOT: "--hash-style={{gnu|both}}"
247// RUN: %clang %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000248// RUN: -target mipsel-linux-gnu -ccc-clang-archs mipsel \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000249// RUN: | FileCheck --check-prefix=CHECK-MIPSEL %s
250// CHECK-MIPSEL: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000251// CHECK-MIPSEL: "-m" "elf32ltsmip"
252// CHECK-MIPSEL: "-dynamic-linker" "{{.*}}/lib/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000253// CHECK-MIPSEL-NOT: "--hash-style={{gnu|both}}"
254// RUN: %clang %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000255// RUN: -target mips64-linux-gnu -ccc-clang-archs mips64 \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000256// RUN: | FileCheck --check-prefix=CHECK-MIPS64 %s
257// CHECK-MIPS64: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000258// CHECK-MIPS64: "-m" "elf64btsmip"
259// CHECK-MIPS64: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000260// CHECK-MIPS64-NOT: "--hash-style={{gnu|both}}"
261// RUN: %clang %s -### -o %t.o 2>&1 \
Sebastian Pop9ec60df2012-01-20 22:01:23 +0000262// RUN: -target mips64el-linux-gnu -ccc-clang-archs mips64el \
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000263// RUN: | FileCheck --check-prefix=CHECK-MIPS64EL %s
264// CHECK-MIPS64EL: "{{.*}}ld{{(.exe)?}}"
Simon Atanasyan8491cb22012-04-06 20:14:27 +0000265// CHECK-MIPS64EL: "-m" "elf64ltsmip"
266// CHECK-MIPS64EL: "-dynamic-linker" "{{.*}}/lib64/ld.so.1"
Chandler Carruthb05dcdd2011-12-17 21:57:25 +0000267// CHECK-MIPS64EL-NOT: "--hash-style={{gnu|both}}"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000268//
269// Thoroughly exercise the Debian multiarch environment.
270// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
271// RUN: -target i686-linux-gnu \
272// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
273// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86 %s
274// CHECK-DEBIAN-X86: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
275// CHECK-DEBIAN-X86: "{{.*}}/usr/lib/gcc/i686-linux-gnu/4.5/crtbegin.o"
276// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5"
277// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../../i386-linux-gnu"
278// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/i386-linux-gnu"
279// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib/gcc/i686-linux-gnu/4.5/../../.."
280// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/lib"
281// CHECK-DEBIAN-X86: "-L[[SYSROOT]]/usr/lib"
282// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
283// RUN: -target x86_64-linux-gnu \
284// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
285// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-X86-64 %s
286// CHECK-DEBIAN-X86-64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
287// CHECK-DEBIAN-X86-64: "{{.*}}/usr/lib/gcc/x86_64-linux-gnu/4.5/crtbegin.o"
288// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5"
289// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../../x86_64-linux-gnu"
290// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/x86_64-linux-gnu"
291// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-linux-gnu/4.5/../../.."
292// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/lib"
293// CHECK-DEBIAN-X86-64: "-L[[SYSROOT]]/usr/lib"
294// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
295// RUN: -target powerpc-linux-gnu \
296// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
297// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC %s
298// CHECK-DEBIAN-PPC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
299// CHECK-DEBIAN-PPC: "{{.*}}/usr/lib/gcc/powerpc-linux-gnu/4.5/crtbegin.o"
300// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5"
301// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../../powerpc-linux-gnu"
302// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/powerpc-linux-gnu"
303// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib/gcc/powerpc-linux-gnu/4.5/../../.."
304// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/lib"
305// CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib"
306// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
307// RUN: -target powerpc64-linux-gnu \
308// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
309// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64 %s
310// CHECK-DEBIAN-PPC64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
311// CHECK-DEBIAN-PPC64: "{{.*}}/usr/lib/gcc/powerpc64-linux-gnu/4.5/crtbegin.o"
312// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5"
313// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../../powerpc64-linux-gnu"
314// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/powerpc64-linux-gnu"
315// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64-linux-gnu/4.5/../../.."
316// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/lib"
317// CHECK-DEBIAN-PPC64: "-L[[SYSROOT]]/usr/lib"
Simon Atanasyan4f148d92012-04-26 08:35:58 +0000318// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
319// RUN: -target mips-linux-gnu \
320// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
321// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS %s
322// CHECK-DEBIAN-MIPS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
323// CHECK-DEBIAN-MIPS: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/crtbegin.o"
324// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
325// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../../mips-linux-gnu"
326// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/mips-linux-gnu"
327// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
328// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/lib"
329// CHECK-DEBIAN-MIPS: "-L[[SYSROOT]]/usr/lib"
330// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
331// RUN: -target mipsel-linux-gnu \
332// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
333// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPSEL %s
334// CHECK-DEBIAN-MIPSEL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
335// CHECK-DEBIAN-MIPSEL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/crtbegin.o"
336// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
337// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../../mipsel-linux-gnu"
338// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/mipsel-linux-gnu"
339// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
340// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/lib"
341// CHECK-DEBIAN-MIPSEL: "-L[[SYSROOT]]/usr/lib"
Simon Atanasyanb8c43812012-04-26 19:57:02 +0000342// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
343// RUN: -target mips64-linux-gnu \
344// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
345// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64 %s
346// CHECK-DEBIAN-MIPS64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
347// CHECK-DEBIAN-MIPS64: "{{.*}}/usr/lib/gcc/mips-linux-gnu/4.5/64/crtbegin.o"
348// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/64"
349// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5"
350// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib/gcc/mips-linux-gnu/4.5/../../.."
351// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/lib"
352// CHECK-DEBIAN-MIPS64: "-L[[SYSROOT]]/usr/lib"
353// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
354// RUN: -target mips64el-linux-gnu \
355// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \
356// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-MIPS64EL %s
357// CHECK-DEBIAN-MIPS64EL: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
358// CHECK-DEBIAN-MIPS64EL: "{{.*}}/usr/lib/gcc/mipsel-linux-gnu/4.5/64/crtbegin.o"
359// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/64"
360// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5"
361// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib/gcc/mipsel-linux-gnu/4.5/../../.."
362// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/lib"
363// CHECK-DEBIAN-MIPS64EL: "-L[[SYSROOT]]/usr/lib"
Chandler Carruth155c54c2012-02-26 09:03:21 +0000364//
Evgeniy Stepanova6ddc022012-04-25 08:59:22 +0000365// Test linker invocation on Android.
366// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
367// RUN: -target arm-linux-androideabi \
368// RUN: --sysroot=%S/Inputs/basic_android_tree \
369// RUN: | FileCheck --check-prefix=CHECK-ANDROID %s
370// CHECK-ANDROID: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
371// CHECK-ANDROID: "{{.*}}/crtbegin_dynamic.o"
372// CHECK-ANDROID: "-L[[SYSROOT]]/usr/lib"
373// CHECK-ANDROID-NOT: "gcc_s"
374// CHECK-ANDROID: "-lgcc"
375// CHECK-ANDROID-NOT: "gcc_s"
376// CHECK-ANDROID: "{{.*}}/crtend_android.o"
377// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
378// RUN: -target arm-linux-androideabi \
379// RUN: --sysroot=%S/Inputs/basic_android_tree \
380// RUN: -shared \
381// RUN: | FileCheck --check-prefix=CHECK-ANDROID-SO %s
382// CHECK-ANDROID-SO: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
383// CHECK-ANDROID-SO: "{{.*}}/crtbegin_so.o"
384// CHECK-ANDROID-SO: "-L[[SYSROOT]]/usr/lib"
385// CHECK-ANDROID-SO-NOT: "gcc_s"
386// CHECK-ANDROID-SO: "-lgcc"
387// CHECK-ANDROID-SO-NOT: "gcc_s"
388// CHECK-ANDROID-SO: "{{.*}}/crtend_so.o"
389// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
390// RUN: -target arm-linux-androideabi \
391// RUN: --sysroot=%S/Inputs/basic_android_tree \
392// RUN: -static \
393// RUN: | FileCheck --check-prefix=CHECK-ANDROID-STATIC %s
394// CHECK-ANDROID-STATIC: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
395// CHECK-ANDROID-STATIC: "{{.*}}/crtbegin_static.o"
396// CHECK-ANDROID-STATIC: "-L[[SYSROOT]]/usr/lib"
397// CHECK-ANDROID-STATIC-NOT: "gcc_s"
398// CHECK-ANDROID-STATIC: "-lgcc"
399// CHECK-ANDROID-STATIC-NOT: "gcc_s"
400// CHECK-ANDROID-STATIC: "{{.*}}/crtend_android.o"