]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/linking.c
Vendor import of clang trunk r290819:
[FreeBSD/FreeBSD.git] / test / OpenMP / linking.c
1 // Test the that the driver produces reasonable linker invocations with
2 // -fopenmp or -fopenmp|libgomp.
3 //
4 // FIXME: Replace DEFAULT_OPENMP_LIB below with the value chosen at configure time.
5 //
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"
12 //
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"
19 //
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"
26 //
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"
33 //
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"
40 //
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"
47 //
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 \
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"
65 //
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"
73 //
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
82 //
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
91 //