112 lines · c
1// Test the that the driver produces reasonable linker invocations with2// -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 --unwindlib=platform \8// RUN: | FileCheck --check-prefix=CHECK-LD-32 %s9// CHECK-LD-32: "{{.*}}ld{{(.exe)?}}"10// CHECK-LD-32: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]"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 --unwindlib=platform \15// RUN: | FileCheck --check-prefix=CHECK-LD-64 %s16// CHECK-LD-64: "{{.*}}ld{{(.exe)?}}"17// CHECK-LD-64: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]"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 --unwindlib=platform \22// RUN: | FileCheck --check-prefix=CHECK-GOMP-LD-32 %s23 24// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fopenmp-simd -target i386-unknown-linux -rtlib=platform --unwindlib=platform | FileCheck --check-prefix SIMD-ONLY2 %s25// SIMD-ONLY2-NOT: lgomp26// SIMD-ONLY2-NOT: lomp27// SIMD-ONLY2-NOT: liomp28// CHECK-GOMP-LD-32: "{{.*}}ld{{(.exe)?}}"29// CHECK-GOMP-LD-32: "-lgomp" "-lrt"30// CHECK-GOMP-LD-32: "-lpthread" "-lc"31 32// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fopenmp-simd -target i386-unknown-linux -rtlib=platform --unwindlib=platform | FileCheck --check-prefix SIMD-ONLY2 %s33// SIMD-ONLY2-NOT: lgomp34// SIMD-ONLY2-NOT: lomp35// SIMD-ONLY2-NOT: liomp36//37// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \38// RUN: -fopenmp=libgomp -target x86_64-unknown-linux -rtlib=platform --unwindlib=platform \39// RUN: | FileCheck --check-prefix=CHECK-GOMP-LD-64 %s40// CHECK-GOMP-LD-64: "{{.*}}ld{{(.exe)?}}"41// CHECK-GOMP-LD-64: "-lgomp" "-lrt"42// CHECK-GOMP-LD-64: "-lpthread" "-lc"43//44// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \45// RUN: -fopenmp -target i386-unknown-linux -rtlib=platform --unwindlib=platform \46// RUN: | FileCheck --check-prefix=CHECK-IOMP5-LD-32 %s47// CHECK-IOMP5-LD-32: "{{.*}}ld{{(.exe)?}}"48// CHECK-IOMP5-LD-32: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]"49// CHECK-IOMP5-LD-32: "-lpthread" "-lc"50//51// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \52// RUN: -fopenmp -target x86_64-unknown-linux -rtlib=platform --unwindlib=platform \53// RUN: | FileCheck --check-prefix=CHECK-IOMP5-LD-64 %s54// CHECK-IOMP5-LD-64: "{{.*}}ld{{(.exe)?}}"55// CHECK-IOMP5-LD-64: "-l[[DEFAULT_OPENMP_LIB:[^"]*]]"56// CHECK-IOMP5-LD-64: "-lpthread" "-lc"57//58// RUN: not %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \59// RUN: -fopenmp=lib -target i386-unknown-linux \60// RUN: | FileCheck --check-prefix=CHECK-LIB-LD-32 %s61// CHECK-LIB-LD-32: error: unsupported argument 'lib' to option '-fopenmp='62//63// RUN: not %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \64// RUN: -fopenmp=lib -target x86_64-unknown-linux \65// RUN: | FileCheck --check-prefix=CHECK-LIB-LD-64 %s66// CHECK-LIB-LD-64: error: unsupported argument 'lib' to option '-fopenmp='67//68// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \69// RUN: -fopenmp -fopenmp=libgomp -target i386-unknown-linux \70// RUN: -rtlib=platform --unwindlib=platform \71// RUN: | FileCheck --check-prefix=CHECK-LD-OVERRIDE-32 %s72// CHECK-LD-OVERRIDE-32: "{{.*}}ld{{(.exe)?}}"73// CHECK-LD-OVERRIDE-32: "-lgomp" "-lrt"74// CHECK-LD-OVERRIDE-32: "-lpthread" "-lc"75//76// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \77// RUN: -fopenmp -fopenmp=libgomp -target x86_64-unknown-linux \78// RUN: -rtlib=platform --unwindlib=platform \79// RUN: | FileCheck --check-prefix=CHECK-LD-OVERRIDE-64 %s80// CHECK-LD-OVERRIDE-64: "{{.*}}ld{{(.exe)?}}"81// CHECK-LD-OVERRIDE-64: "-lgomp" "-lrt"82// CHECK-LD-OVERRIDE-64: "-lpthread" "-lc"83//84// RUN: %clang -no-canonical-prefixes -fuse-ld=link %s -### -o %t.o 2>&1 \85// RUN: -fopenmp=libomp -target x86_64-msvc-win32 -rtlib=platform --unwindlib=platform \86// RUN: | FileCheck --check-prefix=CHECK-MSVC-LINK-64 %s87// CHECK-MSVC-LINK-64: link.exe88// CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcomp.lib89// CHECK-MSVC-LINK-64-SAME: -nodefaultlib:vcompd.lib90// CHECK-MSVC-LINK-64-SAME: -libpath:{{.+}}/../lib91// CHECK-MSVC-LINK-64-SAME: -defaultlib:libomp.lib92 93// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fopenmp-simd -target x86_64-msvc-win32 -rtlib=platform --unwindlib=platform | FileCheck --check-prefix SIMD-ONLY11 %s94// SIMD-ONLY11-NOT: libiomp95// SIMD-ONLY11-NOT: libomp96// SIMD-ONLY11-NOT: libgomp97//98// RUN: %clang -no-canonical-prefixes %s -fuse-ld=link -### -o %t.o 2>&1 \99// RUN: -fopenmp=libiomp5 -target x86_64-msvc-win32 -rtlib=platform --unwindlib=platform \100// RUN: | FileCheck --check-prefix=CHECK-MSVC-ILINK-64 %s101 102// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fopenmp-simd -target x86_64-msvc-win32 -rtlib=platform --unwindlib=platform | FileCheck --check-prefix SIMD-ONLY11 %s103// SIMD-ONLY11-NOT: libiomp104// SIMD-ONLY11-NOT: libomp105// SIMD-ONLY11-NOT: libgomp106// CHECK-MSVC-ILINK-64: link.exe107// CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcomp.lib108// CHECK-MSVC-ILINK-64-SAME: -nodefaultlib:vcompd.lib109// CHECK-MSVC-ILINK-64-SAME: -libpath:{{.+}}/../lib110// CHECK-MSVC-ILINK-64-SAME: -defaultlib:libiomp5md.lib111//112