1 // RUN: %clangxx %s -### -no-canonical-prefixes --target=x86_64-fuchsia \
2 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
3 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
4 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
5 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
6 // RUN: %clangxx %s -### -no-canonical-prefixes --target=aarch64-fuchsia \
7 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
8 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
9 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
10 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
11 // RUN: %clangxx %s -### -no-canonical-prefixes --target=riscv64-fuchsia \
12 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
13 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
14 // RUN:     --sysroot=%S/platform -fuse-ld=lld 2>&1 \
15 // RUN:     | FileCheck -check-prefixes=CHECK,CHECK-RISCV64 %s
16 // CHECK: {{.*}}clang{{.*}}" "-cc1"
17 // CHECK-X86_64: "-triple" "x86_64-unknown-fuchsia"
18 // CHECK-AARCH64: "-triple" "aarch64-unknown-fuchsia"
19 // CHECK-RISCV64: "-triple" "riscv64-unknown-fuchsia"
20 // CHECK-NOT: "-fno-use-init-array"
21 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
22 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
23 // CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}c++{{/|\\\\}}v1"
24 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
25 // CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "rodynamic" "-z" "separate-loadable-segments"
26 // CHECK: "--sysroot=[[SYSROOT]]"
27 // CHECK: "-pie"
28 // CHECK: "--build-id"
29 // CHECK: "-dynamic-linker" "ld.so.1"
30 // CHECK: Scrt1.o
31 // CHECK-NOT: crti.o
32 // CHECK-NOT: crtbegin.o
33 // CHECK: "-L[[SYSROOT]]{{/|\\\\}}lib"
34 // CHECK: "--push-state"
35 // CHECK: "--as-needed"
36 // CHECK: "-lc++"
37 // CHECK: "-lm"
38 // CHECK: "--pop-state"
39 // CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
40 // CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
41 // CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
42 // CHECK: "-lc"
43 // CHECK-NOT: crtend.o
44 // CHECK-NOT: crtn.o
45 
46 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -stdlib=libstdc++ \
47 // RUN:     -fuse-ld=lld 2>&1 \
48 // RUN:     | FileCheck %s -check-prefix=CHECK-STDLIB
49 // CHECK-STDLIB: error: invalid library name in argument '-stdlib=libstdc++'
50 
51 // RUN: %clangxx %s -### --target=x86_64-unknown-fuchsia -static-libstdc++ \
52 // RUN:     -fuse-ld=lld 2>&1 \
53 // RUN:     | FileCheck %s -check-prefix=CHECK-STATIC
54 // CHECK-STATIC: "--push-state"
55 // CHECK-STATIC: "--as-needed"
56 // CHECK-STATIC: "-Bstatic"
57 // CHECK-STATIC: "-lc++"
58 // CHECK-STATIC: "-Bdynamic"
59 // CHECK-STATIC: "-lm"
60 // CHECK-STATIC: "--pop-state"
61 // CHECK-STATIC: "-lc"
62 
63 // RUN: %clangxx %s -### --target=x86_64-fuchsia -nostdlib++ -fuse-ld=lld 2>&1 \
64 // RUN:     | FileCheck %s -check-prefix=CHECK-NOSTDLIBXX
65 // CHECK-NOSTDLIBXX-NOT: "-lc++"
66 // CHECK-NOSTDLIBXX-NOT: "-lm"
67 // CHECK-NOSTDLIBXX: "-lc"
68 
69 // RUN: %clangxx %s -### --target=x86_64-fuchsia \
70 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
71 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
72 // RUN:     -fuse-ld=lld 2>&1\
73 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
74 // RUN: %clangxx %s -### --target=x86_64-fuchsia -fsanitize=address \
75 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
76 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
77 // RUN:     -fuse-ld=lld 2>&1\
78 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-X86
79 // RUN: %clangxx %s -### --target=x86_64-fuchsia -fno-exceptions \
80 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
81 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
82 // RUN:     -fuse-ld=lld 2>&1\
83 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-NOEXCEPT-X86
84 // RUN: %clangxx %s -### --target=x86_64-fuchsia -fsanitize=address -fno-exceptions \
85 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
86 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
87 // RUN:     -fuse-ld=lld 2>&1\
88 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-NOEXCEPT-X86
89 // RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables \
90 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
91 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
92 // RUN:     -fuse-ld=lld 2>&1\
93 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-X86
94 // RUN: %clangxx %s -### --target=x86_64-fuchsia -fexperimental-relative-c++-abi-vtables -fno-exceptions \
95 // RUN:     -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
96 // RUN:     -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
97 // RUN:     -fuse-ld=lld 2>&1\
98 // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86
99 // CHECK-MULTILIB-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
100 // CHECK-MULTILIB-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}asan"
101 // CHECK-MULTILIB-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}noexcept"
102 // CHECK-MULTILIB-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}asan+noexcept"
103 // CHECK-MULTILIB-RELATIVE-VTABLES-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}relative-vtables"
104 // CHECK-MULTILIB-RELATIVE-VTABLES-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++{{/|\\\\}}relative-vtables+noexcept"
105 // CHECK-MULTILIB-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-fuchsia{{/|\\\\}}c++"
106