1 // Test the that the driver produces reasonable linker invocations with
2 // -fopenmp or -fopenmp|libgomp.
4 // FIXME: Replace DEFAULT_OPENMP_LIB below with the value chosen at configure time.
6 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
7 // RUN: -fopenmp -target i386-unknown-linux -rtlib=platform \
8 // RUN: | FileCheck --check-prefix=CHECK-LD-32 %s
9 // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}"
10 // CHECK-LD-32: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
11 // CHECK-LD-32: "-lpthread" "-lc"
13 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
14 // RUN: -fopenmp -target x86_64-unknown-linux -rtlib=platform \
15 // RUN: | FileCheck --check-prefix=CHECK-LD-64 %s
16 // CHECK-LD-64: "{{.*}}ld{{(.exe)?}}"
17 // CHECK-LD-64: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
18 // CHECK-LD-64: "-lpthread" "-lc"
20 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
21 // RUN: -fopenmp=libgomp -target i386-unknown-linux -rtlib=platform \
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"
27 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
28 // RUN: -fopenmp=libgomp -target x86_64-unknown-linux -rtlib=platform \
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"
34 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
35 // RUN: -fopenmp -target i386-unknown-linux -rtlib=platform \
36 // RUN: | FileCheck --check-prefix=CHECK-IOMP5-LD-32 %s
37 // CHECK-IOMP5-LD-32: "{{.*}}ld{{(.exe)?}}"
38 // CHECK-IOMP5-LD-32: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
39 // CHECK-IOMP5-LD-32: "-lpthread" "-lc"
41 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
42 // RUN: -fopenmp -target x86_64-unknown-linux -rtlib=platform \
43 // RUN: | FileCheck --check-prefix=CHECK-IOMP5-LD-64 %s
44 // CHECK-IOMP5-LD-64: "{{.*}}ld{{(.exe)?}}"
45 // CHECK-IOMP5-LD-64: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]" "-lgcc"
46 // CHECK-IOMP5-LD-64: "-lpthread" "-lc"
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='
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='
58 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
59 // RUN: -fopenmp -fopenmp=libgomp -target i386-unknown-linux \
60 // RUN: -rtlib=platform \
61 // RUN: | FileCheck --check-prefix=CHECK-LD-OVERRIDE-32 %s
62 // CHECK-LD-OVERRIDE-32: "{{.*}}ld{{(.exe)?}}"
63 // CHECK-LD-OVERRIDE-32: "-lgomp" "-lrt" "-lgcc"
64 // CHECK-LD-OVERRIDE-32: "-lpthread" "-lc"
66 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
67 // RUN: -fopenmp -fopenmp=libgomp -target x86_64-unknown-linux \
68 // RUN: -rtlib=platform \
69 // RUN: | FileCheck --check-prefix=CHECK-LD-OVERRIDE-64 %s
70 // CHECK-LD-OVERRIDE-64: "{{.*}}ld{{(.exe)?}}"
71 // CHECK-LD-OVERRIDE-64: "-lgomp" "-lrt" "-lgcc"
72 // CHECK-LD-OVERRIDE-64: "-lpthread" "-lc"
74 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
75 // RUN: -fopenmp=libomp -target x86_64-msvc-win32 -rtlib=platform \
76 // RUN: | FileCheck --check-prefix=CHECK-MSVC-LINK-64 %s
77 // CHECK-MSVC-LINK-64: link.exe
78 // CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcomp.lib
79 // CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcompd.lib
80 // CHECK-MSVC-LINK-64-SAME: -libpath:{{.+}}/../lib
81 // CHECK-MSVC-LINK-64-SAME: -defaultlib:libomp.lib
83 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
84 // RUN: -fopenmp=libiomp5 -target x86_64-msvc-win32 -rtlib=platform \
85 // RUN: | FileCheck --check-prefix=CHECK-MSVC-ILINK-64 %s
86 // CHECK-MSVC-ILINK-64: link.exe
87 // CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcomp.lib
88 // CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcompd.lib
89 // CHECK-MSVC-ILINK-64-SAME: -libpath:{{.+}}/../lib
90 // CHECK-MSVC-ILINK-64-SAME: -defaultlib:libiomp5md.lib