1 // RUN: %clangxx %s -### -no-canonical-prefixes --target=arm-liteos -march=armv7-a \
2 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
3 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
4 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=ld 2>&1 | FileCheck %s
5 // CHECK: {{.*}}clang{{.*}}" "-cc1"
6 // CHECK: "-triple" "armv7-unknown-liteos-ohos"
7 // CHECK-NOT: "-fuse-init-array"
8 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
9 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
10 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
11 // CHECK: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
13 // CHECK: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
16 // CHECK: clang_rt.crtbegin.o
17 // CHECK: "-L{{.*[/\\]}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
18 // CHECK-NOT: "--push-state"
19 // CHECK-NOT: "--as-needed"
22 // CHECK-NOT: "--pop-state"
23 // CHECK: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
25 // CHECK: clang_rt.crtend.o
28 // RUN: not %clangxx %s -### --target=arm-unknown-liteos -stdlib=libstdc++ 2>&1 \
29 // RUN: | FileCheck %s -check-prefix=CHECK-STDLIB
30 // CHECK-STDLIB: error: invalid library name in argument '-stdlib=libstdc++'
32 // RUN: %clangxx %s -### --target=arm-unknown-liteos -static-libstdc++ \
33 // RUN: -fuse-ld=ld 2>&1 \
34 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
35 // CHECK-STATIC-NOT: "--push-state"
36 // CHECK-STATIC-NOT: "--as-needed"
37 // CHECK-STATIC: "-Bstatic"
38 // CHECK-STATIC: "-lc++"
39 // CHECK-STATIC: "-Bdynamic"
40 // CHECK-STATIC: "-lm"
41 // CHECK-STATIC-NOT: "--pop-state"
42 // CHECK-STATIC: "-lc"
44 // RUN: %clangxx %s -### --target=arm-unknown-liteos -static \
45 // RUN: -fuse-ld=ld 2>&1 \
46 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC1
47 // CHECK-STATIC1-NOT: "-fuse-init-array"
48 // CHECK-STATIC1: "-static"
49 // CHECK-STATIC1: "-lc++"
50 // CHECK-STATIC1: "-lc++abi"
51 // CHECK-STATIC1: "-lunwind"
52 // CHECK-STATIC1: "-lm"
53 // CHECK-STATIC1: "-lc"
55 // RUN: %clangxx %s -### --target=arm-unknown-liteos -march=armv7-a -mfloat-abi=soft -static -fPIE -fPIC -fpic -pie \
56 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=ld 2>&1 \
57 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC2
58 // CHECK-STATIC2: "-isysroot" "[[SYSROOT:[^"]+]]"
59 // CHECK-STATIC2: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
60 // CHECK-STATIC2: "-static"
61 // CHECK-STATIC2: "-lc++"
62 // CHECK-STATIC2: "-lc++abi"
63 // CHECK-STATIC2: "-lunwind"
64 // CHECK-STATIC2: "-lm"
65 // CHECK-STATIC2: "-lc"
67 // RUN: %clangxx %s -### --target=arm-liteos -nostdlib++ -fuse-ld=ld 2>&1 \
68 // RUN: | FileCheck %s -check-prefix=CHECK-NOSTDLIBXX
69 // CHECK-NOSTDLIBXX-NOT: "-lc++"
70 // CHECK-NOSTDLIBXX: "-lm"
71 // CHECK-NOSTDLIBXX: "-lc"
73 // RUN: %clangxx %s -### --target=arm-liteos \
74 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
75 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
76 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
77 // RUN: -march=armv7-a -mfloat-abi=soft 2>&1\
78 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM
79 // RUN: %clangxx %s -### --target=arm-liteos \
80 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
81 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
82 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
83 // RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1\
84 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFT
85 // RUN: %clangxx %s -### --target=arm-liteos \
86 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
87 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
88 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
89 // RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 2>&1\
90 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFTFP
91 // RUN: %clangxx %s -### --target=arm-liteos \
92 // RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
93 // RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
94 // RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \
95 // RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 2>&1\
96 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-HF,CHECK-MULTILIB-ARM-A7-HARD
97 // CHECK-MULTILIB: {{.*}}clang{{.*}}" "-cc1"
98 // CHECK-MULTILIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
99 // CHECK-MULTILIB: "-isysroot" "[[SYSROOT:[^"]+]]"
100 // CHECK-MULTILIB: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
101 // CHECK-MULTILIB-SF: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
102 // CHECK-MULTILIB-HF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1"
104 // CHECK-MULTILIB-ARM: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
105 // CHECK-MULTILIB-ARM: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
107 // CHECK-MULTILIB-ARM-A7-SOFT: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft"
108 // CHECK-MULTILIB-ARM-A7-SOFT: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft"
110 // CHECK-MULTILIB-ARM-A7-SOFTFP: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4"
111 // CHECK-MULTILIB-ARM-A7-SOFTFP: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4"
113 // CHECK-MULTILIB-ARM-A7-HARD: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4"
114 // CHECK-MULTILIB-ARM-A7-HARD: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4"
116 // CHECK-MULTILIB-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
117 // CHECK-MULTILIB-ARM-A7-SOFT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft{{/|\\\\}}libclang_rt.builtins.a"
118 // CHECK-MULTILIB-ARM-A7-SOFTFP: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4{{/|\\\\}}libclang_rt.builtins.a"
119 // CHECK-MULTILIB-ARM-A7-HARD: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4{{/|\\\\}}libclang_rt.builtins.a"