xref: /llvm-project/clang/test/Driver/ohos.cpp (revision f39c399d9d15efe8309d8aa3d0ecf62205e6c474)
128997febSPavel Kosov // RUN: %clangxx %s -### -no-canonical-prefixes --target=arm-liteos -march=armv7-a \
228997febSPavel Kosov // RUN:     -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
328997febSPavel Kosov // RUN:     -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
4abae53f4SFangrui Song // RUN:     --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=ld 2>&1 | FileCheck %s
528997febSPavel Kosov // CHECK: {{.*}}clang{{.*}}" "-cc1"
628997febSPavel Kosov // CHECK: "-triple" "armv7-unknown-liteos-ohos"
728997febSPavel Kosov // CHECK-NOT: "-fuse-init-array"
828997febSPavel Kosov // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
928997febSPavel Kosov // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
1028997febSPavel Kosov // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
1128997febSPavel Kosov // CHECK: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
1228997febSPavel Kosov // CHECK: "-pie"
1328997febSPavel Kosov // CHECK: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
1428997febSPavel Kosov // CHECK: Scrt1.o
1528997febSPavel Kosov // CHECK: crti.o
1628997febSPavel Kosov // CHECK: clang_rt.crtbegin.o
1728997febSPavel Kosov // CHECK: "-L{{.*[/\\]}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
1828997febSPavel Kosov // CHECK-NOT: "--push-state"
1928997febSPavel Kosov // CHECK-NOT: "--as-needed"
2028997febSPavel Kosov // CHECK: "-lc++"
2128997febSPavel Kosov // CHECK: "-lm"
2228997febSPavel Kosov // CHECK-NOT: "--pop-state"
2328997febSPavel Kosov // CHECK: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
2428997febSPavel Kosov // CHECK: "-lc"
2528997febSPavel Kosov // CHECK: clang_rt.crtend.o
2628997febSPavel Kosov // CHECK: crtn.o
2728997febSPavel Kosov 
28*f39c399dSFangrui Song // RUN: not %clangxx %s -### --target=arm-unknown-liteos -stdlib=libstdc++ 2>&1 \
2928997febSPavel Kosov // RUN:     | FileCheck %s -check-prefix=CHECK-STDLIB
3028997febSPavel Kosov // CHECK-STDLIB: error: invalid library name in argument '-stdlib=libstdc++'
3128997febSPavel Kosov 
3228997febSPavel Kosov // RUN: %clangxx %s -### --target=arm-unknown-liteos -static-libstdc++ \
33abae53f4SFangrui Song // RUN:     -fuse-ld=ld 2>&1 \
3428997febSPavel Kosov // RUN:     | FileCheck %s -check-prefix=CHECK-STATIC
3528997febSPavel Kosov // CHECK-STATIC-NOT: "--push-state"
3628997febSPavel Kosov // CHECK-STATIC-NOT: "--as-needed"
3728997febSPavel Kosov // CHECK-STATIC: "-Bstatic"
3828997febSPavel Kosov // CHECK-STATIC: "-lc++"
3928997febSPavel Kosov // CHECK-STATIC: "-Bdynamic"
4028997febSPavel Kosov // CHECK-STATIC: "-lm"
4128997febSPavel Kosov // CHECK-STATIC-NOT: "--pop-state"
4228997febSPavel Kosov // CHECK-STATIC: "-lc"
4328997febSPavel Kosov 
4428997febSPavel Kosov // RUN: %clangxx %s -### --target=arm-unknown-liteos -static \
45abae53f4SFangrui Song // RUN:     -fuse-ld=ld 2>&1 \
4628997febSPavel Kosov // RUN:     | FileCheck %s -check-prefix=CHECK-STATIC1
4728997febSPavel Kosov // CHECK-STATIC1-NOT: "-fuse-init-array"
4828997febSPavel Kosov // CHECK-STATIC1: "-static"
4928997febSPavel Kosov // CHECK-STATIC1: "-lc++"
5028997febSPavel Kosov // CHECK-STATIC1: "-lc++abi"
5128997febSPavel Kosov // CHECK-STATIC1: "-lunwind"
5228997febSPavel Kosov // CHECK-STATIC1: "-lm"
5328997febSPavel Kosov // CHECK-STATIC1: "-lc"
5428997febSPavel Kosov 
5528997febSPavel Kosov // RUN: %clangxx %s -### --target=arm-unknown-liteos -march=armv7-a -mfloat-abi=soft -static -fPIE -fPIC -fpic -pie \
56abae53f4SFangrui Song // RUN:     --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=ld 2>&1 \
5728997febSPavel Kosov // RUN:     | FileCheck %s -check-prefix=CHECK-STATIC2
5828997febSPavel Kosov // CHECK-STATIC2: "-isysroot" "[[SYSROOT:[^"]+]]"
5928997febSPavel Kosov // CHECK-STATIC2: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
6028997febSPavel Kosov // CHECK-STATIC2: "-static"
6128997febSPavel Kosov // CHECK-STATIC2: "-lc++"
6228997febSPavel Kosov // CHECK-STATIC2: "-lc++abi"
6328997febSPavel Kosov // CHECK-STATIC2: "-lunwind"
6428997febSPavel Kosov // CHECK-STATIC2: "-lm"
6528997febSPavel Kosov // CHECK-STATIC2: "-lc"
6628997febSPavel Kosov 
67abae53f4SFangrui Song // RUN: %clangxx %s -### --target=arm-liteos -nostdlib++ -fuse-ld=ld 2>&1 \
6828997febSPavel Kosov // RUN:     | FileCheck %s -check-prefix=CHECK-NOSTDLIBXX
6928997febSPavel Kosov // CHECK-NOSTDLIBXX-NOT: "-lc++"
7028997febSPavel Kosov // CHECK-NOSTDLIBXX: "-lm"
7128997febSPavel Kosov // CHECK-NOSTDLIBXX: "-lc"
7228997febSPavel Kosov 
7328997febSPavel Kosov // RUN: %clangxx %s -### --target=arm-liteos \
7428997febSPavel Kosov // RUN:     -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
7528997febSPavel Kosov // RUN:     -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
7628997febSPavel Kosov // RUN:     --sysroot=%S/Inputs/ohos_native_tree/sysroot \
7728997febSPavel Kosov // RUN:     -march=armv7-a -mfloat-abi=soft 2>&1\
7828997febSPavel Kosov // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM
7928997febSPavel Kosov // RUN: %clangxx %s -### --target=arm-liteos \
8028997febSPavel Kosov // RUN:     -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
8128997febSPavel Kosov // RUN:     -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
8228997febSPavel Kosov // RUN:     --sysroot=%S/Inputs/ohos_native_tree/sysroot \
8328997febSPavel Kosov // RUN:     -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1\
8428997febSPavel Kosov // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFT
8528997febSPavel Kosov // RUN: %clangxx %s -### --target=arm-liteos  \
8628997febSPavel Kosov // RUN:     -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
8728997febSPavel Kosov // RUN:     -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
8828997febSPavel Kosov // RUN:     --sysroot=%S/Inputs/ohos_native_tree/sysroot \
8928997febSPavel Kosov // RUN:     -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 2>&1\
9028997febSPavel Kosov // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFTFP
9128997febSPavel Kosov // RUN: %clangxx %s -### --target=arm-liteos  \
9228997febSPavel Kosov // RUN:     -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \
9328997febSPavel Kosov // RUN:     -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \
9428997febSPavel Kosov // RUN:     --sysroot=%S/Inputs/ohos_native_tree/sysroot \
9528997febSPavel Kosov // RUN:     -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 2>&1\
9628997febSPavel Kosov // RUN:     | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-HF,CHECK-MULTILIB-ARM-A7-HARD
9728997febSPavel Kosov // CHECK-MULTILIB: {{.*}}clang{{.*}}" "-cc1"
9828997febSPavel Kosov // CHECK-MULTILIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
9928997febSPavel Kosov // CHECK-MULTILIB: "-isysroot" "[[SYSROOT:[^"]+]]"
10028997febSPavel Kosov // CHECK-MULTILIB: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]"
10128997febSPavel Kosov // CHECK-MULTILIB-SF: "-dynamic-linker" "/lib/ld-musl-arm.so.1"
10228997febSPavel Kosov // CHECK-MULTILIB-HF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1"
10328997febSPavel Kosov 
10428997febSPavel Kosov // CHECK-MULTILIB-ARM: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
10528997febSPavel Kosov // CHECK-MULTILIB-ARM: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}"
10628997febSPavel Kosov 
10728997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-SOFT: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft"
10828997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-SOFT: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft"
10928997febSPavel Kosov 
11028997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-SOFTFP: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4"
11128997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-SOFTFP: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4"
11228997febSPavel Kosov 
11328997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-HARD: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4"
11428997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-HARD: "-L[[SYSROOT]]{{/|\\\\}}usr{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4"
11528997febSPavel Kosov 
11628997febSPavel Kosov // CHECK-MULTILIB-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a"
11728997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-SOFT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft{{/|\\\\}}libclang_rt.builtins.a"
11828997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-SOFTFP: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4{{/|\\\\}}libclang_rt.builtins.a"
11928997febSPavel Kosov // CHECK-MULTILIB-ARM-A7-HARD: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4{{/|\\\\}}libclang_rt.builtins.a"
120