xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/linking.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // Test the that the driver produces reasonable linker invocations with
2*0a6a1f1dSLionel Sambuc // -fopenmp or -fopenmp=libiomp5|libgomp.
3f4a2713aSLionel Sambuc //
4f4a2713aSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
5f4a2713aSLionel Sambuc // RUN:     -fopenmp -target i386-unknown-linux \
6f4a2713aSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-LD-32 %s
7f4a2713aSLionel Sambuc // CHECK-LD-32: "{{.*}}ld{{(.exe)?}}"
8f4a2713aSLionel Sambuc // CHECK-LD-32: "-lgomp" "-lrt" "-lgcc"
9f4a2713aSLionel Sambuc // CHECK-LD-32: "-lpthread" "-lc"
10f4a2713aSLionel Sambuc //
11f4a2713aSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
12f4a2713aSLionel Sambuc // RUN:     -fopenmp -target x86_64-unknown-linux \
13f4a2713aSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-LD-64 %s
14f4a2713aSLionel Sambuc // CHECK-LD-64: "{{.*}}ld{{(.exe)?}}"
15f4a2713aSLionel Sambuc // CHECK-LD-64: "-lgomp" "-lrt" "-lgcc"
16f4a2713aSLionel Sambuc // CHECK-LD-64: "-lpthread" "-lc"
17*0a6a1f1dSLionel Sambuc //
18*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
19*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp=libgomp -target i386-unknown-linux \
20*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-GOMP-LD-32 %s
21*0a6a1f1dSLionel Sambuc // CHECK-GOMP-LD-32: "{{.*}}ld{{(.exe)?}}"
22*0a6a1f1dSLionel Sambuc // CHECK-GOMP-LD-32: "-lgomp" "-lrt" "-lgcc"
23*0a6a1f1dSLionel Sambuc // CHECK-GOMP-LD-32: "-lpthread" "-lc"
24*0a6a1f1dSLionel Sambuc //
25*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
26*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp=libgomp -target x86_64-unknown-linux \
27*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-GOMP-LD-64 %s
28*0a6a1f1dSLionel Sambuc // CHECK-GOMP-LD-64: "{{.*}}ld{{(.exe)?}}"
29*0a6a1f1dSLionel Sambuc // CHECK-GOMP-LD-64: "-lgomp" "-lrt" "-lgcc"
30*0a6a1f1dSLionel Sambuc // CHECK-GOMP-LD-64: "-lpthread" "-lc"
31*0a6a1f1dSLionel Sambuc //
32*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
33*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp=libiomp5 -target i386-unknown-linux \
34*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-IOMP5-LD-32 %s
35*0a6a1f1dSLionel Sambuc // CHECK-IOMP5-LD-32: "{{.*}}ld{{(.exe)?}}"
36*0a6a1f1dSLionel Sambuc // CHECK-IOMP5-LD-32: "-liomp5" "-lgcc"
37*0a6a1f1dSLionel Sambuc // CHECK-IOMP5-LD-32: "-lpthread" "-lc"
38*0a6a1f1dSLionel Sambuc //
39*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
40*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp=libiomp5 -target x86_64-unknown-linux \
41*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-IOMP5-LD-64 %s
42*0a6a1f1dSLionel Sambuc // CHECK-IOMP5-LD-64: "{{.*}}ld{{(.exe)?}}"
43*0a6a1f1dSLionel Sambuc // CHECK-IOMP5-LD-64: "-liomp5" "-lgcc"
44*0a6a1f1dSLionel Sambuc // CHECK-IOMP5-LD-64: "-lpthread" "-lc"
45*0a6a1f1dSLionel Sambuc //
46*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
47*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp=lib -target i386-unknown-linux \
48*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-LIB-LD-32 %s
49*0a6a1f1dSLionel Sambuc // CHECK-LIB-LD-32: error: unsupported argument 'lib' to option 'fopenmp='
50*0a6a1f1dSLionel Sambuc //
51*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
52*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp=lib -target x86_64-unknown-linux \
53*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-LIB-LD-64 %s
54*0a6a1f1dSLionel Sambuc // CHECK-LIB-LD-64: error: unsupported argument 'lib' to option 'fopenmp='
55*0a6a1f1dSLionel Sambuc //
56*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
57*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp -fopenmp=libiomp5 -target i386-unknown-linux \
58*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-LD-WARN-32 %s
59*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-32: warning: argument unused during compilation: '-fopenmp=libiomp5'
60*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-32: "{{.*}}ld{{(.exe)?}}"
61*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-32: "-lgomp" "-lrt" "-lgcc"
62*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-32: "-lpthread" "-lc"
63*0a6a1f1dSLionel Sambuc //
64*0a6a1f1dSLionel Sambuc // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
65*0a6a1f1dSLionel Sambuc // RUN:     -fopenmp -fopenmp=libiomp5 -target x86_64-unknown-linux \
66*0a6a1f1dSLionel Sambuc // RUN:   | FileCheck --check-prefix=CHECK-LD-WARN-64 %s
67*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-64: warning: argument unused during compilation: '-fopenmp=libiomp5'
68*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-64: "{{.*}}ld{{(.exe)?}}"
69*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-64: "-lgomp" "-lrt" "-lgcc"
70*0a6a1f1dSLionel Sambuc // CHECK-LD-WARN-64: "-lpthread" "-lc"
71*0a6a1f1dSLionel Sambuc //
72