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