Clang Project

clang_source_code/test/Driver/nostdlib.c
1// RUN: %clang -target i686-pc-linux-gnu -### -nostdlib %s 2> %t
2// RUN: FileCheck < %t %s
3//
4// CHECK-NOT: start-group
5
6// Most of the toolchains would check for -nostartfiles and -nostdlib
7// in a short-circuiting boolean expression, so if both of the preceding
8// options were present, the second would warn about being unused.
9// RUN: %clang -### -Wno-liblto -nostartfiles -nostdlib -target i386-apple-darwin %s \
10// RUN:   2>&1 | FileCheck %s -check-prefix=ARGSCLAIMED
11// ARGSCLAIMED-NOT: warning:
12
13// In the presence of -nostdlib, the standard libraries should not be
14// passed down to link line
15// RUN: %clang -no-canonical-prefixes %s -### -Wno-liblto -o %t.o 2>&1 \
16// RUN:     -target i686-pc-linux-gnu -nostdlib --rtlib=compiler-rt -fuse-ld=ld \
17// RUN:     -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \
18// RUN:   | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s
19//
20// RUN: %clang -no-canonical-prefixes %s -### -Wno-liblto -o %t.o 2>&1 \
21// RUN:     -target i686-pc-linux-gnu --rtlib=compiler-rt -nostdlib -fuse-ld=ld \
22// RUN:     -resource-dir=%S/Inputs/resource_dir -lclang_rt.builtins-i686 \
23// RUN:   | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB %s
24//
25// RUN: %clang -target x86_64-pc-windows-msvc -nostdlib --rtlib=compiler-rt -### -Wno-liblto %s 2>&1 | FileCheck %s -check-prefix CHECK-MSVC-NOSTDLIB
26// RUN: %clang -target x86_64-pc-windows-msvc --rtlib=compiler-rt -nostdlib -### -Wno-liblto %s 2>&1 | FileCheck %s -check-prefix CHECK-MSVC-NOSTDLIB
27//
28// CHECK-LINUX-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt'
29// CHECK-LINUX-NOSTDLIB: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
30// CHECK-LINUX-NOSTDLIB-NOT: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.builtins-i386.a"
31// CHECK-MSVC-NOSTDLIB: warning: argument unused during compilation: '--rtlib=compiler-rt'
32