blob: 81706d4f620115a7c524c36ade72518aa89d009a [file] [log] [blame]
Chandler Carruth01538002013-01-17 13:19:29 +00001// Test the that the driver produces reasonable linker invocations with
Alexey Bataevdb390212015-05-20 04:24:19 +00002// -fopenmp or -fopenmp|libgomp.
Chandler Carruth01538002013-01-17 13:19:29 +00003//
Richard Smith31d1de22015-05-20 22:48:44 +00004// FIXME: Replace DEFAULT_OPENMP_LIB below with the value chosen at configure time.
5//
Chandler Carruth01538002013-01-17 13:19:29 +00006// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
7// RUN: -fopenmp -target i386-unknown-linux \
8// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
9// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}"
Richard Smith31d1de22015-05-20 22:48:44 +000010// CHECK-LD-32: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
Chandler Carruth01538002013-01-17 13:19:29 +000011// CHECK-LD-32: "-lpthread" "-lc"
12//
13// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
14// RUN: -fopenmp -target x86_64-unknown-linux \
15// RUN: | FileCheck --check-prefix=CHECK-LD-64 %s
16// CHECK-LD-64: "{{.*}}ld{{(.exe)?}}"
Richard Smith31d1de22015-05-20 22:48:44 +000017// CHECK-LD-64: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
Chandler Carruth01538002013-01-17 13:19:29 +000018// CHECK-LD-64: "-lpthread" "-lc"
Alexey Bataev186b28a2014-03-06 05:43:53 +000019//
20// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
21// RUN: -fopenmp=libgomp -target i386-unknown-linux \
22// RUN: | FileCheck --check-prefix=CHECK-GOMP-LD-32 %s
23// CHECK-GOMP-LD-32: "{{.*}}ld{{(.exe)?}}"
24// CHECK-GOMP-LD-32: "-lgomp" "-lrt" "-lgcc"
25// CHECK-GOMP-LD-32: "-lpthread" "-lc"
26//
27// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
28// RUN: -fopenmp=libgomp -target x86_64-unknown-linux \
29// RUN: | FileCheck --check-prefix=CHECK-GOMP-LD-64 %s
30// CHECK-GOMP-LD-64: "{{.*}}ld{{(.exe)?}}"
31// CHECK-GOMP-LD-64: "-lgomp" "-lrt" "-lgcc"
32// CHECK-GOMP-LD-64: "-lpthread" "-lc"
33//
34// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Alexey Bataevdb390212015-05-20 04:24:19 +000035// RUN: -fopenmp -target i386-unknown-linux \
Alexey Bataev186b28a2014-03-06 05:43:53 +000036// RUN: | FileCheck --check-prefix=CHECK-IOMP5-LD-32 %s
37// CHECK-IOMP5-LD-32: "{{.*}}ld{{(.exe)?}}"
Richard Smith31d1de22015-05-20 22:48:44 +000038// CHECK-IOMP5-LD-32: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
Alexey Bataev648250a2014-03-07 07:43:52 +000039// CHECK-IOMP5-LD-32: "-lpthread" "-lc"
Alexey Bataev186b28a2014-03-06 05:43:53 +000040//
41// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Alexey Bataevdb390212015-05-20 04:24:19 +000042// RUN: -fopenmp -target x86_64-unknown-linux \
Alexey Bataev186b28a2014-03-06 05:43:53 +000043// RUN: | FileCheck --check-prefix=CHECK-IOMP5-LD-64 %s
44// CHECK-IOMP5-LD-64: "{{.*}}ld{{(.exe)?}}"
Richard Smith31d1de22015-05-20 22:48:44 +000045// CHECK-IOMP5-LD-64: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
Alexey Bataev648250a2014-03-07 07:43:52 +000046// CHECK-IOMP5-LD-64: "-lpthread" "-lc"
Alexey Bataev186b28a2014-03-06 05:43:53 +000047//
48// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
49// RUN: -fopenmp=lib -target i386-unknown-linux \
50// RUN: | FileCheck --check-prefix=CHECK-LIB-LD-32 %s
51// CHECK-LIB-LD-32: error: unsupported argument 'lib' to option 'fopenmp='
52//
53// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
54// RUN: -fopenmp=lib -target x86_64-unknown-linux \
55// RUN: | FileCheck --check-prefix=CHECK-LIB-LD-64 %s
56// CHECK-LIB-LD-64: error: unsupported argument 'lib' to option 'fopenmp='
57//
58// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Alexey Bataevdb390212015-05-20 04:24:19 +000059// RUN: -fopenmp -fopenmp=libgomp -target i386-unknown-linux \
60// RUN: | FileCheck --check-prefix=CHECK-LD-OVERRIDE-32 %s
61// CHECK-LD-OVERRIDE-32: "{{.*}}ld{{(.exe)?}}"
62// CHECK-LD-OVERRIDE-32: "-lgomp" "-lrt" "-lgcc"
63// CHECK-LD-OVERRIDE-32: "-lpthread" "-lc"
Alexey Bataev186b28a2014-03-06 05:43:53 +000064//
65// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
Alexey Bataevdb390212015-05-20 04:24:19 +000066// RUN: -fopenmp -fopenmp=libgomp -target x86_64-unknown-linux \
67// RUN: | FileCheck --check-prefix=CHECK-LD-OVERRIDE-64 %s
68// CHECK-LD-OVERRIDE-64: "{{.*}}ld{{(.exe)?}}"
69// CHECK-LD-OVERRIDE-64: "-lgomp" "-lrt" "-lgcc"
70// CHECK-LD-OVERRIDE-64: "-lpthread" "-lc"
Alexey Bataev186b28a2014-03-06 05:43:53 +000071//
Alexey Bataevc7e84352015-08-19 04:49:01 +000072// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
73// RUN: -fopenmp=libomp -target x86_64-msvc-win32 \
74// RUN: | FileCheck --check-prefix=CHECK-MSVC-LINK-64 %s
75// CHECK-MSVC-LINK-64: link.exe
76// CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcomp.lib
77// CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcompd.lib
78// CHECK-MSVC-LINK-64-SAME: -libpath:{{.+}}/../lib
79// CHECK-MSVC-LINK-64-SAME: -defaultlib:libomp.lib
80//
81// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
82// RUN: -fopenmp=libiomp5 -target x86_64-msvc-win32 \
83// RUN: | FileCheck --check-prefix=CHECK-MSVC-ILINK-64 %s
84// CHECK-MSVC-ILINK-64: link.exe
85// CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcomp.lib
86// CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcompd.lib
87// CHECK-MSVC-ILINK-64-SAME: -libpath:{{.+}}/../lib
88// CHECK-MSVC-ILINK-64-SAME: -defaultlib:libiomp5md.lib
89//