Author: Daniel Thornburgh Date: 2023-03-14T13:46:21-07:00 New Revision: d505d20a62f4838d8ecb9385af8b8ccce9db67da
URL: https://github.com/llvm/llvm-project/commit/d505d20a62f4838d8ecb9385af8b8ccce9db67da DIFF: https://github.com/llvm/llvm-project/commit/d505d20a62f4838d8ecb9385af8b8ccce9db67da.diff LOG: Revert "[LLVM][OHOS] Clang toolchain and targets" This change had tests that break whenever LLVM_ENABLE_LINKER_BUILD_ID is set, as is the case in the Fuchsia target. This reverts commits: f81317a54586dbcef0c14cf512a0770e8ecaab3d 72474afa27570a0a1307f3260f0187b703aa6d84 Added: Modified: clang/include/clang/Basic/Attr.td clang/include/clang/Driver/ToolChain.h clang/lib/Basic/TargetInfo.cpp clang/lib/Basic/Targets.cpp clang/lib/Basic/Targets/ARM.cpp clang/lib/Basic/Targets/OSTargets.h clang/lib/Basic/Targets/X86.h clang/lib/CodeGen/ABIInfo.h clang/lib/CodeGen/TargetInfo.cpp clang/lib/Driver/CMakeLists.txt clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/Arch/AArch64.cpp clang/lib/Driver/ToolChains/Arch/ARM.cpp clang/lib/Driver/ToolChains/CommonArgs.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c Removed: clang/lib/Driver/ToolChains/OHOS.cpp clang/lib/Driver/ToolChains/OHOS.h clang/test/Driver/Inputs/ohos_native_tree/llvm/bin/.keep clang/test/Driver/Inputs/ohos_native_tree/llvm/include/c++/v1/.keep clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libc++.so clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_soft/libc++.so clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libc++.so clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_hard_neon-vfpv4/libc++.so clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_soft/libc++.so clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_softfp_neon-vfpv4/libc++.so clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/libc++.so clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/.keep clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtbegin.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtend.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.profile.a clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/.keep clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtbegin.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtend.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.profile.a clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtbegin.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtend.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.profile.a clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtbegin.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtend.o clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.builtins.a clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.profile.a clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/.keep clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/arm-liteos-ohos/.keep clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/.keep clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/.keep clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_soft/.keep clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep clang/test/Driver/ohos.c clang/test/Driver/ohos.cpp clang/test/Preprocessor/ohos.c ################################################################################ diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 4192b28ce13eb..8858bb6bec850 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -918,7 +918,6 @@ def Availability : InheritableAttr { .Case("maccatalyst_app_extension", "macCatalyst (App Extension)") .Case("swift", "Swift") .Case("shadermodel", "HLSL ShaderModel") - .Case("ohos", "OpenHarmony OS") .Default(llvm::StringRef()); } static llvm::StringRef getPlatformNameSourceSpelling(llvm::StringRef Platform) { diff --git a/clang/include/clang/Driver/ToolChain.h b/clang/include/clang/Driver/ToolChain.h index 4d66e577b107f..989e631a187e8 100644 --- a/clang/include/clang/Driver/ToolChain.h +++ b/clang/include/clang/Driver/ToolChain.h @@ -494,7 +494,7 @@ class ToolChain { // Returns <ResourceDir>/lib/<OSName>/<arch>. This is used by runtimes (such // as OpenMP) to find arch-specific libraries. - virtual std::string getArchSpecificLibPath() const; + std::string getArchSpecificLibPath() const; // Returns <OSname> part of above. virtual StringRef getOSLibName() const; diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp index 86faae7e15cb0..07af6c07031bd 100644 --- a/clang/lib/Basic/TargetInfo.cpp +++ b/clang/lib/Basic/TargetInfo.cpp @@ -98,8 +98,7 @@ TargetInfo::TargetInfo(const llvm::Triple &T) : Triple(T) { // https://www.gnu.org/software/libc/manual/html_node/Malloc-Examples.html. // This alignment guarantee also applies to Windows and Android. On Darwin // and OpenBSD, the alignment is 16 bytes on both 64-bit and 32-bit systems. - if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid() || - T.isOHOSFamily()) + if (T.isGNUEnvironment() || T.isWindowsMSVCEnvironment() || T.isAndroid()) NewAlign = Triple.isArch64Bit() ? 128 : Triple.isArch32Bit() ? 64 : 0; else if (T.isOSDarwin() || T.isOSOpenBSD()) NewAlign = 128; diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 7e687c119c1c4..6f504e7867325 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -148,12 +148,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::Fuchsia: return new FuchsiaTargetInfo<AArch64leTargetInfo>(Triple, Opts); case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo<AArch64leTargetInfo>(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo<AArch64leTargetInfo>(Triple, Opts); - } + return new LinuxTargetInfo<AArch64leTargetInfo>(Triple, Opts); case llvm::Triple::NetBSD: return new NetBSDTargetInfo<AArch64leTargetInfo>(Triple, Opts); case llvm::Triple::OpenBSD: @@ -193,14 +188,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::CloudABI: return new CloudABITargetInfo<ARMleTargetInfo>(Triple, Opts); case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo<ARMleTargetInfo>(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo<ARMleTargetInfo>(Triple, Opts); - } - case llvm::Triple::LiteOS: - return new OHOSTargetInfo<ARMleTargetInfo>(Triple, Opts); + return new LinuxTargetInfo<ARMleTargetInfo>(Triple, Opts); case llvm::Triple::FreeBSD: return new FreeBSDTargetInfo<ARMleTargetInfo>(Triple, Opts); case llvm::Triple::NetBSD: @@ -275,12 +263,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::mipsel: switch (os) { case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo<MipsTargetInfo>(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo<MipsTargetInfo>(Triple, Opts); - } + return new LinuxTargetInfo<MipsTargetInfo>(Triple, Opts); case llvm::Triple::RTEMS: return new RTEMSTargetInfo<MipsTargetInfo>(Triple, Opts); case llvm::Triple::FreeBSD: @@ -440,12 +423,7 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, case llvm::Triple::Fuchsia: return new FuchsiaTargetInfo<RISCV64TargetInfo>(Triple, Opts); case llvm::Triple::Linux: - switch (Triple.getEnvironment()) { - default: - return new LinuxTargetInfo<RISCV64TargetInfo>(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSTargetInfo<RISCV64TargetInfo>(Triple, Opts); - } + return new LinuxTargetInfo<RISCV64TargetInfo>(Triple, Opts); default: return new RISCV64TargetInfo(Triple, Opts); } @@ -583,8 +561,6 @@ TargetInfo *AllocateTarget(const llvm::Triple &Triple, return new LinuxTargetInfo<X86_64TargetInfo>(Triple, Opts); case llvm::Triple::Android: return new AndroidX86_64TargetInfo(Triple, Opts); - case llvm::Triple::OpenHOS: - return new OHOSX86_64TargetInfo(Triple, Opts); } } case llvm::Triple::DragonFly: diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp index 18f14244944c2..b85d5dc2d3478 100644 --- a/clang/lib/Basic/Targets/ARM.cpp +++ b/clang/lib/Basic/Targets/ARM.cpp @@ -310,7 +310,6 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple, case llvm::Triple::GNUEABIHF: case llvm::Triple::MuslEABI: case llvm::Triple::MuslEABIHF: - case llvm::Triple::OpenHOS: setABI("aapcs-linux"); break; case llvm::Triple::EABIHF: diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index ea21f7eafaba1..0280129b3c950 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -1007,68 +1007,6 @@ class LLVM_LIBRARY_VISIBILITY EmscriptenTargetInfo } }; -// OHOS target -template <typename Target> -class LLVM_LIBRARY_VISIBILITY OHOSTargetInfo : public OSTargetInfo<Target> { -protected: - void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override { - // Linux defines; list based off of gcc output - DefineStd(Builder, "unix", Opts); - - Builder.defineMacro("__ELF__"); - - // Generic OHOS target defines - if (Triple.isOHOSFamily()) { - Builder.defineMacro("__OHOS_FAMILY__", "1"); - - auto Version = Triple.getEnvironmentVersion(); - this->PlatformName = "ohos"; - this->PlatformMinVersion = Version; - Builder.defineMacro("__OHOS_Major__", Twine(Version.getMajor())); - if (auto Minor = Version.getMinor()) - Builder.defineMacro("__OHOS_Minor__", Twine(*Minor)); - if (auto Subminor = Version.getSubminor()) - Builder.defineMacro("__OHOS_Micro__", Twine(*Subminor)); - } - - if (Triple.isOpenHOS()) - Builder.defineMacro("__OHOS__"); - - if (Triple.isOSLinux()) { - DefineStd(Builder, "linux", Opts); - } else if (Triple.isOSLiteOS()) { - Builder.defineMacro("__LITEOS__"); - } - - if (Opts.POSIXThreads) - Builder.defineMacro("_REENTRANT"); - if (Opts.CPlusPlus) - Builder.defineMacro("_GNU_SOURCE"); - if (this->HasFloat128) - Builder.defineMacro("__FLOAT128__"); - } - -public: - OHOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : OSTargetInfo<Target>(Triple, Opts) { - this->WIntType = TargetInfo::UnsignedInt; - - switch (Triple.getArch()) { - default: - break; - case llvm::Triple::x86: - case llvm::Triple::x86_64: - this->HasFloat128 = true; - break; - } - } - - const char *getStaticInitSectionSpecifier() const override { - return ".text.startup"; - } -}; - } // namespace targets } // namespace clang #endif // LLVM_CLANG_LIB_BASIC_TARGETS_OSTARGETS_H diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 89cb33bf6c1e4..ef41195a5c096 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -963,28 +963,6 @@ class LLVM_LIBRARY_VISIBILITY AndroidX86_64TargetInfo LongDoubleFormat = &llvm::APFloat::IEEEquad(); } }; - -// x86_32 OHOS target -class LLVM_LIBRARY_VISIBILITY OHOSX86_32TargetInfo - : public OHOSTargetInfo<X86_32TargetInfo> { -public: - OHOSX86_32TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : OHOSTargetInfo<X86_32TargetInfo>(Triple, Opts) { - SuitableAlign = 32; - LongDoubleWidth = 64; - LongDoubleFormat = &llvm::APFloat::IEEEdouble(); - } -}; - -// x86_64 OHOS target -class LLVM_LIBRARY_VISIBILITY OHOSX86_64TargetInfo - : public OHOSTargetInfo<X86_64TargetInfo> { -public: - OHOSX86_64TargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) - : OHOSTargetInfo<X86_64TargetInfo>(Triple, Opts) { - LongDoubleFormat = &llvm::APFloat::IEEEquad(); - } -}; } // namespace targets } // namespace clang #endif // LLVM_CLANG_LIB_BASIC_TARGETS_X86_H diff --git a/clang/lib/CodeGen/ABIInfo.h b/clang/lib/CodeGen/ABIInfo.h index 1dffa41c57c58..755d2aaa7beb8 100644 --- a/clang/lib/CodeGen/ABIInfo.h +++ b/clang/lib/CodeGen/ABIInfo.h @@ -81,7 +81,6 @@ namespace CodeGen { QualType Ty) const = 0; bool isAndroid() const; - bool isOHOSFamily() const; /// Emit the target dependent code to load a value of /// \arg Ty from the \c __builtin_ms_va_list pointed to by \arg VAListAddr. diff --git a/clang/lib/CodeGen/TargetInfo.cpp b/clang/lib/CodeGen/TargetInfo.cpp index 39e64a140aae1..ba7a51c8ba77c 100644 --- a/clang/lib/CodeGen/TargetInfo.cpp +++ b/clang/lib/CodeGen/TargetInfo.cpp @@ -236,10 +236,6 @@ const CodeGenOptions &ABIInfo::getCodeGenOpts() const { bool ABIInfo::isAndroid() const { return getTarget().getTriple().isAndroid(); } -bool ABIInfo::isOHOSFamily() const { - return getTarget().getTriple().isOHOSFamily(); -} - bool ABIInfo::isHomogeneousAggregateBaseType(QualType Ty) const { return false; } @@ -5737,7 +5733,7 @@ ABIArgInfo AArch64ABIInfo::coerceIllegalVector(QualType Ty) const { uint64_t Size = getContext().getTypeSize(Ty); // Android promotes <2 x i8> to i16, not i32 - if ((isAndroid() || isOHOSFamily()) && (Size <= 16)) { + if (isAndroid() && (Size <= 16)) { llvm::Type *ResType = llvm::Type::getInt16Ty(getVMContext()); return ABIArgInfo::getDirect(ResType); } @@ -6344,7 +6340,7 @@ class ARMABIInfo : public ABIInfo { case llvm::Triple::MuslEABIHF: return true; default: - return getTarget().getTriple().isOHOSFamily(); + return false; } } diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt index 3d83c86100bec..e0bf3efc44c20 100644 --- a/clang/lib/Driver/CMakeLists.txt +++ b/clang/lib/Driver/CMakeLists.txt @@ -76,7 +76,6 @@ add_clang_library(clangDriver ToolChains/Myriad.cpp ToolChains/NaCl.cpp ToolChains/NetBSD.cpp - ToolChains/OHOS.cpp ToolChains/OpenBSD.cpp ToolChains/PS4CPU.cpp ToolChains/RISCVToolchain.cpp diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 1e7c1daeed7f3..6533d4e49cbbe 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -40,7 +40,6 @@ #include "ToolChains/Myriad.h" #include "ToolChains/NaCl.h" #include "ToolChains/NetBSD.h" -#include "ToolChains/OHOS.h" #include "ToolChains/OpenBSD.h" #include "ToolChains/PPCFreeBSD.h" #include "ToolChains/PPCLinux.h" @@ -6074,8 +6073,7 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, Args); else if (Target.getArch() == llvm::Triple::ve) TC = std::make_unique<toolchains::VEToolChain>(*this, Target, Args); - else if (Target.isOHOSFamily()) - TC = std::make_unique<toolchains::OHOS>(*this, Target, Args); + else TC = std::make_unique<toolchains::Linux>(*this, Target, Args); break; @@ -6139,9 +6137,6 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, case llvm::Triple::Hurd: TC = std::make_unique<toolchains::Hurd>(*this, Target, Args); break; - case llvm::Triple::LiteOS: - TC = std::make_unique<toolchains::OHOS>(*this, Target, Args); - break; case llvm::Triple::ZOS: TC = std::make_unique<toolchains::ZOS>(*this, Target, Args); break; diff --git a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp index f3bc00188c784..0b2ee72f7868e 100644 --- a/clang/lib/Driver/ToolChains/Arch/AArch64.cpp +++ b/clang/lib/Driver/ToolChains/Arch/AArch64.cpp @@ -606,7 +606,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D, Features.push_back("+fix-cortex-a53-835769"); else Features.push_back("-fix-cortex-a53-835769"); - } else if (Triple.isAndroid() || Triple.isOHOSFamily()) { + } else if (Triple.isAndroid()) { // Enabled A53 errata (835769) workaround by default on android Features.push_back("+fix-cortex-a53-835769"); } else if (Triple.isOSFuchsia()) { diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp index 1ba4252b4cef7..e75f8a474410c 100644 --- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp +++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp @@ -275,11 +275,6 @@ void arm::setArchNameInTriple(const Driver &D, const ArgList &Args, void arm::setFloatABIInTriple(const Driver &D, const ArgList &Args, llvm::Triple &Triple) { - if (Triple.isOSLiteOS()) { - Triple.setEnvironment(llvm::Triple::OpenHOS); - return; - } - bool isHardFloat = (arm::getARMFloatABI(D, Triple, Args) == arm::FloatABI::Hard); @@ -299,8 +294,6 @@ void arm::setFloatABIInTriple(const Driver &D, const ArgList &Args, Triple.setEnvironment(isHardFloat ? llvm::Triple::MuslEABIHF : llvm::Triple::MuslEABI); break; - case llvm::Triple::OpenHOS: - break; default: { arm::FloatABI DefaultABI = arm::getDefaultFloatABI(Triple); if (DefaultABI != arm::FloatABI::Invalid && @@ -370,8 +363,6 @@ arm::FloatABI arm::getDefaultFloatABI(const llvm::Triple &Triple) { return FloatABI::SoftFP; default: - if (Triple.isOHOSFamily()) - return FloatABI::Soft; switch (Triple.getEnvironment()) { case llvm::Triple::GNUEABIHF: case llvm::Triple::MuslEABIHF: diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 1c13df62f7231..bc32b8d8cac8d 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -957,7 +957,7 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain &TC, CmdArgs.push_back(getAsNeededOption(TC, false)); // There's no libpthread or librt on RTEMS & Android. if (TC.getTriple().getOS() != llvm::Triple::RTEMS && - !TC.getTriple().isAndroid() && !TC.getTriple().isOHOSFamily()) { + !TC.getTriple().isAndroid()) { CmdArgs.push_back("-lpthread"); if (!TC.getTriple().isOSOpenBSD()) CmdArgs.push_back("-lrt"); @@ -1381,10 +1381,6 @@ tools::ParsePICArgs(const ToolChain &ToolChain, const ArgList &Args) { } } - // OHOS-specific defaults for PIC/PIE - if (Triple.isOHOSFamily() && Triple.getArch() == llvm::Triple::aarch64) - PIC = true; - // OpenBSD-specific defaults for PIE if (Triple.isOSOpenBSD()) { switch (ToolChain.getArch()) { @@ -1671,12 +1667,6 @@ static LibGccType getLibGccType(const ToolChain &TC, const Driver &D, static void AddUnwindLibrary(const ToolChain &TC, const Driver &D, ArgStringList &CmdArgs, const ArgList &Args) { ToolChain::UnwindLibType UNW = TC.GetUnwindLibType(Args); - // By default OHOS binaries are linked statically to libunwind. - if (TC.getTriple().isOHOSFamily() && UNW == ToolChain::UNW_CompilerRT) { - CmdArgs.push_back("-l:libunwind.a"); - return; - } - // Targets that don't use unwind libraries. if ((TC.getTriple().isAndroid() && UNW == ToolChain::UNW_Libgcc) || TC.getTriple().isOSIAMCU() || TC.getTriple().isOSBinFormatWasm() || diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp index 7e72a1d1433da..24fbdcffc07ba 100644 --- a/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/clang/lib/Driver/ToolChains/Gnu.cpp @@ -405,7 +405,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); const llvm::Triple::ArchType Arch = ToolChain.getArch(); - const bool isOHOSFamily = ToolChain.getTriple().isOHOSFamily(); const bool isAndroid = ToolChain.getTriple().isAndroid(); const bool IsIAMCU = ToolChain.getTriple().isOSIAMCU(); const bool IsVE = ToolChain.getTriple().isVE(); @@ -456,7 +455,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, // Most Android ARM64 targets should enable the linker fix for erratum // 843419. Only non-Cortex-A53 devices are allowed to skip this flag. - if (Arch == llvm::Triple::aarch64 && (isAndroid || isOHOSFamily)) { + if (Arch == llvm::Triple::aarch64 && isAndroid) { std::string CPU = getCPUName(D, Args, Triple); if (CPU.empty() || CPU == "generic" || CPU == "cortex-a53") CmdArgs.push_back("--fix-cortex-a53-843419"); @@ -642,9 +641,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("--pop-state"); } - // We don't need libpthread neither for bionic (Android) nor for musl, - // (used by OHOS as runtime library). - if (WantPthread && !isAndroid && !isOHOSFamily) + if (WantPthread && !isAndroid) CmdArgs.push_back("-lpthread"); if (Args.hasArg(options::OPT_fsplit_stack)) diff --git a/clang/lib/Driver/ToolChains/OHOS.cpp b/clang/lib/Driver/ToolChains/OHOS.cpp deleted file mode 100644 index 71a4ccd042ac8..0000000000000 --- a/clang/lib/Driver/ToolChains/OHOS.cpp +++ /dev/null @@ -1,411 +0,0 @@ -//===--- OHOS.cpp - OHOS ToolChain Implementations --------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include "OHOS.h" -#include "Arch/ARM.h" -#include "CommonArgs.h" -#include "clang/Config/config.h" -#include "clang/Driver/Compilation.h" -#include "clang/Driver/Driver.h" -#include "clang/Driver/DriverDiagnostic.h" -#include "clang/Driver/Options.h" -#include "clang/Driver/SanitizerArgs.h" -#include "llvm/Option/ArgList.h" -#include "llvm/ProfileData/InstrProf.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/VirtualFileSystem.h" -#include "llvm/Support/ScopedPrinter.h" - -using namespace clang::driver; -using namespace clang::driver::toolchains; -using namespace clang::driver::tools; -using namespace clang; -using namespace llvm::opt; -using namespace clang::driver::tools::arm; - -using tools::addMultilibFlag; -using tools::addPathIfExists; - -static bool findOHOSMuslMultilibs(const Multilib::flags_list &Flags, - DetectedMultilibs &Result) { - MultilibSet Multilibs; - Multilibs.push_back(Multilib()); - // -mcpu=cortex-a7 - // -mfloat-abi=soft -mfloat-abi=softfp -mfloat-abi=hard - // -mfpu=neon-vfpv4 - Multilibs.push_back(Multilib("/a7_soft", {}, {}, 1, - {"+mcpu=cortex-a7", "+mfloat-abi=soft"})); - - Multilibs.push_back(Multilib("/a7_softfp_neon-vfpv4", {}, {}, 1, - {"+mcpu=cortex-a7", "+mfloat-abi=softfp", "+mfpu=neon-vfpv4"})); - - Multilibs.push_back(Multilib("/a7_hard_neon-vfpv4", {}, {}, 1, - {"+mcpu=cortex-a7", "+mfloat-abi=hard", "+mfpu=neon-vfpv4"})); - - if (Multilibs.select(Flags, Result.SelectedMultilib)) { - Result.Multilibs = Multilibs; - return true; - } - return false; -} - -static bool findOHOSMultilibs(const Driver &D, - const ToolChain &TC, - const llvm::Triple &TargetTriple, - StringRef Path, const ArgList &Args, - DetectedMultilibs &Result) { - Multilib::flags_list Flags; - bool IsA7 = false; - if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) - IsA7 = A->getValue() == StringRef("cortex-a7"); - addMultilibFlag(IsA7, "mcpu=cortex-a7", Flags); - - bool IsMFPU = false; - if (const Arg *A = Args.getLastArg(options::OPT_mfpu_EQ)) - IsMFPU = A->getValue() == StringRef("neon-vfpv4"); - addMultilibFlag(IsMFPU, "mfpu=neon-vfpv4", Flags); - - tools::arm::FloatABI ARMFloatABI = getARMFloatABI(D, TargetTriple, Args); - addMultilibFlag((ARMFloatABI == tools::arm::FloatABI::Soft), - "mfloat-abi=soft", Flags); - addMultilibFlag((ARMFloatABI == tools::arm::FloatABI::SoftFP), - "mfloat-abi=softfp", Flags); - addMultilibFlag((ARMFloatABI == tools::arm::FloatABI::Hard), - "mfloat-abi=hard", Flags); - - return findOHOSMuslMultilibs(Flags, Result); -} - -std::string OHOS::getMultiarchTriple(const llvm::Triple &T) const { - // For most architectures, just use whatever we have rather than trying to be - // clever. - switch (T.getArch()) { - default: - break; - - // We use the existence of '/lib/<triple>' as a directory to detect some - // common linux triples that don't quite match the Clang triple for both - // 32-bit and 64-bit targets. Multiarch fixes its install triples to these - // regardless of what the actual target triple is. - case llvm::Triple::arm: - case llvm::Triple::thumb: - return T.isOSLiteOS() ? "arm-liteos-ohos" : "arm-linux-ohos"; - case llvm::Triple::riscv32: - return "riscv32-linux-ohos"; - case llvm::Triple::riscv64: - return "riscv64-linux-ohos"; - case llvm::Triple::mipsel: - return "mipsel-linux-ohos"; - case llvm::Triple::x86: - return "i686-linux-ohos"; - case llvm::Triple::x86_64: - return "x86_64-linux-ohos"; - case llvm::Triple::aarch64: - return "aarch64-linux-ohos"; - } - return T.str(); -} - -std::string OHOS::getMultiarchTriple(const Driver &D, - const llvm::Triple &TargetTriple, - StringRef SysRoot) const { - return getMultiarchTriple(TargetTriple); -} - -static std::string makePath(const std::initializer_list<std::string> &IL) { - SmallString<128> P; - for (const auto &S : IL) - llvm::sys::path::append(P, S); - return static_cast<std::string>(P.str()); -} - -/// OHOS Toolchain -OHOS::OHOS(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - : Generic_ELF(D, Triple, Args) { - std::string SysRoot = computeSysRoot(); - - // Select the correct multilib according to the given arguments. - DetectedMultilibs Result; - findOHOSMultilibs(D, *this, Triple, "", Args, Result); - Multilibs = Result.Multilibs; - SelectedMultilib = Result.SelectedMultilib; - - getFilePaths().clear(); - std::string CandidateLibPath = getArchSpecificLibPath(); - if (getVFS().exists(CandidateLibPath)) - getFilePaths().push_back(CandidateLibPath); - - getLibraryPaths().clear(); - for (auto &Path : getRuntimePaths()) - if (getVFS().exists(Path)) - getLibraryPaths().push_back(Path); - - // OHOS sysroots contain a library directory for each supported OS - // version as well as some unversioned libraries in the usual multiarch - // directory. Support --target=aarch64-linux-ohosX.Y.Z or - // --target=aarch64-linux-ohosX.Y or --target=aarch64-linux-ohosX - path_list &Paths = getFilePaths(); - std::string SysRootLibPath = makePath({SysRoot, "usr", "lib"}); - std::string MultiarchTriple = getMultiarchTriple(getTriple()); - addPathIfExists(D, makePath({SysRootLibPath, SelectedMultilib.gccSuffix()}), - Paths); - addPathIfExists(D, - makePath({D.Dir, "..", "lib", MultiarchTriple, - SelectedMultilib.gccSuffix()}), - Paths); - - addPathIfExists( - D, - makePath({SysRootLibPath, MultiarchTriple, SelectedMultilib.gccSuffix()}), - Paths); -} - -ToolChain::RuntimeLibType OHOS::GetRuntimeLibType( - const ArgList &Args) const { - if (Arg *A = Args.getLastArg(clang::driver::options::OPT_rtlib_EQ)) { - StringRef Value = A->getValue(); - if (Value != "compiler-rt") - getDriver().Diag(clang::diag::err_drv_invalid_rtlib_name) - << A->getAsString(Args); - } - - return ToolChain::RLT_CompilerRT; -} - -ToolChain::CXXStdlibType -OHOS::GetCXXStdlibType(const ArgList &Args) const { - if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) { - StringRef Value = A->getValue(); - if (Value != "libc++") - getDriver().Diag(diag::err_drv_invalid_stdlib_name) - << A->getAsString(Args); - } - - return ToolChain::CST_Libcxx; -} - -void OHOS::AddClangSystemIncludeArgs(const ArgList &DriverArgs, - ArgStringList &CC1Args) const { - const Driver &D = getDriver(); - const llvm::Triple &Triple = getTriple(); - std::string SysRoot = computeSysRoot(); - - if (DriverArgs.hasArg(options::OPT_nostdinc)) - return; - - if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { - SmallString<128> P(D.ResourceDir); - llvm::sys::path::append(P, "include"); - addSystemInclude(DriverArgs, CC1Args, P); - } - - if (DriverArgs.hasArg(options::OPT_nostdlibinc)) - return; - - // Check for configure-time C include directories. - StringRef CIncludeDirs(C_INCLUDE_DIRS); - if (CIncludeDirs != "") { - SmallVector<StringRef, 5> dirs; - CIncludeDirs.split(dirs, ":"); - for (StringRef dir : dirs) { - StringRef Prefix = - llvm::sys::path::is_absolute(dir) ? StringRef(SysRoot) : ""; - addExternCSystemInclude(DriverArgs, CC1Args, Prefix + dir); - } - return; - } - - addExternCSystemInclude(DriverArgs, CC1Args, - SysRoot + "/usr/include/" + - getMultiarchTriple(Triple)); - addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/include"); - addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); -} - -void OHOS::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, - ArgStringList &CC1Args) const { - if (DriverArgs.hasArg(options::OPT_nostdlibinc) || - DriverArgs.hasArg(options::OPT_nostdincxx)) - return; - - switch (GetCXXStdlibType(DriverArgs)) { - case ToolChain::CST_Libcxx: { - std::string IncPath = makePath({getDriver().Dir, "..", "include"}); - std::string IncTargetPath = - makePath({IncPath, getMultiarchTriple(getTriple()), "c++", "v1"}); - if (getVFS().exists(IncTargetPath)) { - addSystemInclude(DriverArgs, CC1Args, makePath({IncPath, "c++", "v1"})); - addSystemInclude(DriverArgs, CC1Args, IncTargetPath); - } - break; - } - - default: - llvm_unreachable("invalid stdlib name"); - } -} - -void OHOS::AddCXXStdlibLibArgs(const ArgList &Args, - ArgStringList &CmdArgs) const { - switch (GetCXXStdlibType(Args)) { - case ToolChain::CST_Libcxx: - CmdArgs.push_back("-lc++"); - CmdArgs.push_back("-lc++abi"); - CmdArgs.push_back("-lunwind"); - break; - - case ToolChain::CST_Libstdcxx: - llvm_unreachable("invalid stdlib name"); - } -} - -std::string OHOS::computeSysRoot() const { - std::string SysRoot = - !getDriver().SysRoot.empty() - ? getDriver().SysRoot - : makePath({getDriver().getInstalledDir(), "..", "..", "sysroot"}); - if (!llvm::sys::fs::exists(SysRoot)) - return std::string(); - - std::string ArchRoot = makePath({SysRoot, getMultiarchTriple(getTriple())}); - return llvm::sys::fs::exists(ArchRoot) ? ArchRoot : SysRoot; -} - -ToolChain::path_list OHOS::getRuntimePaths() const { - SmallString<128> P; - path_list Paths; - const Driver &D = getDriver(); - const llvm::Triple &Triple = getTriple(); - - // First try the triple passed to driver as --target=<triple>. - P.assign(D.ResourceDir); - llvm::sys::path::append(P, "lib", D.getTargetTriple(), SelectedMultilib.gccSuffix()); - Paths.push_back(P.c_str()); - - // Second try the normalized triple. - P.assign(D.ResourceDir); - llvm::sys::path::append(P, "lib", Triple.str(), SelectedMultilib.gccSuffix()); - Paths.push_back(P.c_str()); - - // Third try the effective triple. - P.assign(D.ResourceDir); - std::string SysRoot = computeSysRoot(); - llvm::sys::path::append(P, "lib", getMultiarchTriple(Triple), - SelectedMultilib.gccSuffix()); - Paths.push_back(P.c_str()); - - return Paths; -} - -std::string OHOS::getDynamicLinker(const ArgList &Args) const { - const llvm::Triple &Triple = getTriple(); - const llvm::Triple::ArchType Arch = getArch(); - - assert(Triple.isMusl()); - std::string ArchName; - bool IsArm = false; - - switch (Arch) { - case llvm::Triple::arm: - case llvm::Triple::thumb: - ArchName = "arm"; - IsArm = true; - break; - case llvm::Triple::armeb: - case llvm::Triple::thumbeb: - ArchName = "armeb"; - IsArm = true; - break; - default: - ArchName = Triple.getArchName().str(); - } - if (IsArm && - (tools::arm::getARMFloatABI(*this, Args) == tools::arm::FloatABI::Hard)) - ArchName += "hf"; - - return "/lib/ld-musl-" + ArchName + ".so.1"; -} - -std::string OHOS::getCompilerRT(const ArgList &Args, StringRef Component, - FileType Type) const { - SmallString<128> Path(getDriver().ResourceDir); - llvm::sys::path::append(Path, "lib", getMultiarchTriple(getTriple()), - SelectedMultilib.gccSuffix()); - const char *Prefix = - Type == ToolChain::FT_Object ? "" : "lib"; - const char *Suffix; - switch (Type) { - case ToolChain::FT_Object: - Suffix = ".o"; - break; - case ToolChain::FT_Static: - Suffix = ".a"; - break; - case ToolChain::FT_Shared: - Suffix = ".so"; - break; - } - llvm::sys::path::append( - Path, Prefix + Twine("clang_rt.") + Component + Suffix); - return static_cast<std::string>(Path.str()); -} - -void OHOS::addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const { - CmdArgs.push_back("-z"); - CmdArgs.push_back("now"); - CmdArgs.push_back("-z"); - CmdArgs.push_back("relro"); - CmdArgs.push_back("-z"); - CmdArgs.push_back("max-page-size=4096"); - // .gnu.hash section is not compatible with the MIPS target - if (getArch() != llvm::Triple::mipsel) - CmdArgs.push_back("--hash-style=both"); -#ifdef ENABLE_LINKER_BUILD_ID - CmdArgs.push_back("--build-id"); -#endif - CmdArgs.push_back("--enable-new-dtags"); -} - -SanitizerMask OHOS::getSupportedSanitizers() const { - SanitizerMask Res = ToolChain::getSupportedSanitizers(); - Res |= SanitizerKind::Address; - Res |= SanitizerKind::PointerCompare; - Res |= SanitizerKind::PointerSubtract; - Res |= SanitizerKind::Fuzzer; - Res |= SanitizerKind::FuzzerNoLink; - Res |= SanitizerKind::Memory; - Res |= SanitizerKind::Vptr; - Res |= SanitizerKind::SafeStack; - Res |= SanitizerKind::Scudo; - // TODO: kASAN for liteos ?? - // TODO: Support TSAN and HWASAN and update mask. - return Res; -} - -// TODO: Make a base class for Linux and OHOS and move this there. -void OHOS::addProfileRTLibs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const { - // Add linker option -u__llvm_profile_runtime to cause runtime - // initialization module to be linked in. - if (needsProfileRT(Args)) - CmdArgs.push_back(Args.MakeArgString( - Twine("-u", llvm::getInstrProfRuntimeHookVarName()))); - ToolChain::addProfileRTLibs(Args, CmdArgs); -} - -std::string OHOS::getArchSpecificLibPath() const { - llvm::Triple Triple = getTriple(); - return makePath({getDriver().ResourceDir, "lib", getMultiarchTriple(Triple)}); -} - -ToolChain::UnwindLibType OHOS::GetUnwindLibType(const llvm::opt::ArgList &Args) const { - if (const Arg *A = Args.getLastArg(options::OPT_unwindlib_EQ)) - return Generic_ELF::GetUnwindLibType(Args); - return GetDefaultUnwindLibType(); -} diff --git a/clang/lib/Driver/ToolChains/OHOS.h b/clang/lib/Driver/ToolChains/OHOS.h deleted file mode 100644 index 9ce0d0c4325bf..0000000000000 --- a/clang/lib/Driver/ToolChains/OHOS.h +++ /dev/null @@ -1,94 +0,0 @@ -//===--- OHOS.h - OHOS ToolChain Implementations ----------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H -#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H - -#include "Linux.h" -#include "clang/Driver/Tool.h" -#include "clang/Driver/ToolChain.h" - -namespace clang { -namespace driver { -namespace toolchains { - -class LLVM_LIBRARY_VISIBILITY OHOS : public Generic_ELF { -public: - OHOS(const Driver &D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args); - - bool HasNativeLLVMSupport() const override { return true; } - bool IsIntegratedAssemblerDefault() const override { return true; } - bool IsMathErrnoDefault() const override { return false; } - RuntimeLibType GetDefaultRuntimeLibType() const override { - return ToolChain::RLT_CompilerRT; - } - CXXStdlibType GetDefaultCXXStdlibType() const override { - return ToolChain::CST_Libcxx; - } - // Not add -funwind-tables by default - bool isPICDefault() const override { return false; } - bool isPIEDefault(const llvm::opt::ArgList &Args) const override { return true; } - bool isPICDefaultForced() const override { return false; } - bool useRelaxRelocations() const override { return false; } - UnwindLibType GetUnwindLibType(const llvm::opt::ArgList &Args) const override; - UnwindLibType GetDefaultUnwindLibType() const override { return UNW_CompilerRT; } - - RuntimeLibType - GetRuntimeLibType(const llvm::opt::ArgList &Args) const override; - CXXStdlibType - GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; - - void - AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; - void - AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override; - void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; - - std::string computeSysRoot() const override; - std::string getDynamicLinker(const llvm::opt::ArgList &Args) const override; - - std::string - getCompilerRT(const llvm::opt::ArgList &Args, StringRef Component, - FileType Type = ToolChain::FT_Static) const override; - - const char *getDefaultLinker() const override { - return "ld.lld"; - } - - Tool *buildLinker() const override { - return new tools::gnutools::Linker(*this); - } - Tool *buildAssembler() const override { - return new tools::gnutools::Assembler(*this); - } - - path_list getRuntimePaths() const; - -protected: - std::string getMultiarchTriple(const llvm::Triple &T) const; - std::string getMultiarchTriple(const Driver &D, - const llvm::Triple &TargetTriple, - StringRef SysRoot) const override; - void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override; - SanitizerMask getSupportedSanitizers() const override; - void addProfileRTLibs(const llvm::opt::ArgList &Args, - llvm::opt::ArgStringList &CmdArgs) const override; - std::string getArchSpecificLibPath() const override; -private: - Multilib SelectedMultilib; -}; - -} // end namespace toolchains -} // end namespace driver -} // end namespace clang - -#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H diff --git a/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c b/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c index 3d1a2c7aceb1f..3ce5b9d122176 100644 --- a/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c +++ b/clang/test/CodeGen/aarch64-fix-cortex-a53-835769.c @@ -7,8 +7,6 @@ // RUN: %clang -O3 -target aarch64-android-eabi %s -S -o- \ // RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s -// RUN: %clang -O3 -target aarch64-linux-ohos %s -S -o- \ -// RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s // RUN: %clang -O3 -target aarch64-android-eabi -mfix-cortex-a53-835769 %s -S -o- \ // RUN: | FileCheck --check-prefix=CHECK-YES --check-prefix=CHECK %s // RUN: %clang -O3 -target aarch64-android-eabi -mno-fix-cortex-a53-835769 %s -S -o- \ diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/bin/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/bin/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/include/c++/v1/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/include/c++/v1/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libc++.so deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_soft/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_soft/libc++.so deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libc++.so deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_hard_neon-vfpv4/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_hard_neon-vfpv4/libc++.so deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_soft/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_soft/libc++.so deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_softfp_neon-vfpv4/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/c++/a7_softfp_neon-vfpv4/libc++.so deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/libc++.so b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/arm-liteos-ohos/libc++.so deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.profile.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.profile.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.profile.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_soft/libclang_rt.profile.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.profile.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.profile.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtbegin.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtbegin.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtend.o b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/clang_rt.crtend.o deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.builtins.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.builtins.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.profile.a b/clang/test/Driver/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z/lib/arm-liteos-ohos/libclang_rt.profile.a deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/arm-liteos-ohos/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/include/arm-liteos-ohos/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_soft/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_soft/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep b/clang/test/Driver/Inputs/ohos_native_tree/sysroot/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/.keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/clang/test/Driver/ohos.c b/clang/test/Driver/ohos.c deleted file mode 100644 index 86a4039c99082..0000000000000 --- a/clang/test/Driver/ohos.c +++ /dev/null @@ -1,241 +0,0 @@ -// UNSUPPORTED: system-windows -// RUN: %clang %s -### -no-canonical-prefixes --target=arm-liteos \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld -march=armv7-a 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK,CHECK-ARM %s -// RUN: %clang %s -### -no-canonical-prefixes --target=arm-liteos \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK,CHECK-ARM-A7-SOFT %s -// CHECK: {{.*}}clang{{.*}}" "-cc1" -// CHECK-NOT: "--mrelax-relocations" -// CHECK-NOT: "-munwind-tables" -// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" -// CHECK-NOT: "-fsanitize=safe-stack" -// CHECK-NOT: "-stack-protector" "2" -// CHECK-NOT: "-fno-common" -// CHECK: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-NOT: "--sysroot=[[SYSROOT]]" -// CHECK: "-pie" -// CHECK-NOT: "--build-id" -// CHECK: "--hash-style=both" -// CHECK: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK: Scrt1.o -// CHECK: crti.o -// CHECK: clang_rt.crtbegin.o -// CHECK-ARM: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/" -// CHECK-ARM-A7-SOFT: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_soft" -// CHECK-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-ARM-A7-SOFT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos/a7_soft{{/|\\\\}}libclang_rt.builtins.a" -// CHECK: "-lc" -// CHECK: clang_rt.crtend.o -// CHECK: crtn.o - -// RUN: %clang %s -### --target=arm-liteos -rtlib=libgcc -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RTLIB -// CHECK-RTLIB: error: invalid runtime library name in argument '-rtlib=libgcc' - -// RUN: %clang %s -### --target=arm-liteos -static -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC -// CHECK-STATIC: "-static" -// CHECK-STATIC-NOT: "-Bdynamic" -// CHECK-STATIC: "-l:libunwind.a" -// CHECK-STATIC: "-lc" - -// RUN: %clang %s -### --target=arm-liteos -shared -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-SHARED -// CHECK-SHARED-NOT: "-pie" -// CHECK-SHARED: "-shared" -// CHECK-SHARED: "-lc" -// CHECK-SHARED: "-l:libunwind.a" - -// RUN: %clang %s -### --target=arm-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// RUN: %clang %s -### --target=aarch64-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// RUN: %clang %s -### --target=mipsel-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// RUN: %clang %s -### --target=x86_64-linux-ohos -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RUNTIME -// CHECK-RUNTIME: "{{.*}}/libclang_rt.builtins.a" -// CHECK-RUNTIME: "-l:libunwind.a" -// CHECK-LIBM: "-lm" - -// RUN: %clang %s -### --target=arm-liteos -r -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-RELOCATABLE -// CHECK-RELOCATABLE-NOT: "-pie" -// CHECK-RELOCATABLE-NOT: "--build-id" -// CHECK-RELOCATABLE: "-r" - -// RUN: %clang %s -### --target=arm-liteos -nodefaultlibs -fuse-ld=lld 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: | FileCheck %s -check-prefix=CHECK-NODEFAULTLIBS -// CHECK-NODEFAULTLIBS: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-NODEFAULTLIBS-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-NODEFAULTLIBS-NOT: "-lc" - -// RUN: %clang %s -### --target=arm-liteos -nostdlib -fuse-ld=lld 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: | FileCheck %s -check-prefix=CHECK-NOSTDLIB -// CHECK-NOSTDLIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-NOSTDLIB-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-NOSTDLIB-NOT: "-lc" - -// RUN: %clang %s -### --target=arm-liteos -nolibc -fuse-ld=lld 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: | FileCheck %s -check-prefix=CHECK-NOLIBC -// CHECK-NOLIBC: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-NOLIBC: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK-NOLIBC-NOT: "-lc" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=safe-stack 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-SAFESTACK -// CHECK-SAFESTACK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-SAFESTACK: "-fsanitize=safe-stack" -// CHECK-SAFESTACK: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.safestack.a" -// CHECK-SAFESTACK: "__safestack_init" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=address 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-ASAN-ARM -// CHECK-ASAN-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-ASAN-ARM: "-fsanitize=address" -// CHECK-ASAN-ARM: "-fsanitize-address-use-after-scope" -// CHECK-ASAN-ARM: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK-ASAN-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan.a" -// CHECK-ASAN-ARM-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan-preinit.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=address -fPIC -shared 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -shared-libsan \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-ASAN-SHARED -// CHECK-ASAN-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-ASAN-SHARED: "-fsanitize=address" -// CHECK-ASAN-SHARED: "-fsanitize-address-use-after-scope" -// CHECK-ASAN-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan.so" -// CHECK-ASAN-SHARED-NOT: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.asan-preinit.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=fuzzer 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-FUZZER-ARM -// CHECK-FUZZER-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-FUZZER-ARM: "-fsanitize=fuzzer,fuzzer-no-link" -// CHECK-FUZZER-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.fuzzer.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=scudo 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-ARM -// CHECK-SCUDO-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-SCUDO-ARM: "-fsanitize=scudo" -// CHECK-SCUDO-ARM: "-pie" -// CHECK-SCUDO-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.scudo_standalone.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fsanitize=scudo -fPIC -shared 2>&1 \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -shared-libsan \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-SCUDO-SHARED -// CHECK-SCUDO-SHARED: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-SCUDO-SHARED: "-fsanitize=scudo" -// CHECK-SCUDO-SHARED: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.scudo_standalone.so" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -fxray-instrument -fxray-modes=xray-basic \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-XRAY-ARM -// CHECK-XRAY-ARM: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-XRAY-ARM: "-fxray-instrument" -// CHECK-XRAY-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.xray.a" -// CHECK-XRAY-ARM: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.xray-basic.a" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -O3 -flto -mcpu=cortex-a53 2>&1 \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-LTO -// CHECK-LTO: "-plugin-opt=mcpu=cortex-a53" -// CHECK-LTO: "-plugin-opt=O3" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -flto=thin -flto-jobs=8 -mcpu=cortex-a7 2>&1 \ -// RUN: -fuse-ld=lld \ -// RUN: | FileCheck %s -check-prefix=CHECK-THINLTO -// CHECK-THINLTO: "-plugin-opt=mcpu=cortex-a7" -// CHECK-THINLTO: "-plugin-opt=thinlto" -// CHECK-THINLTO: "-plugin-opt=jobs=8" - -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFT -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFTFP -// RUN: %clang %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-HF,CHECK-MULTILIB-ARM-A7-HARD -// CHECK-MULTILIB: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MULTILIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-MULTILIB: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK-MULTILIB: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-MULTILIB-SF: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK-MULTILIB-HF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1" - -// CHECK-MULTILIB-ARM: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/" - -// CHECK-MULTILIB-ARM-A7-SOFT: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_soft" - -// CHECK-MULTILIB-ARM-A7-SOFTFP: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4" - -// CHECK-MULTILIB-ARM-A7-HARD: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4" - -// CHECK-MULTILIB-ARM: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFT: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFTFP: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-HARD: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a" - -// RUN: %clang %s -### -no-canonical-prefixes --target=arm-linux-ohos -fprofile-instr-generate -v \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld -march=armv7-a 2>&1 \ -// RUN: | FileCheck -check-prefixes=CHECK-PROFILE-RTLIB %s - -// CHECK-PROFILE-RTLIB: -u__llvm_profile_runtime -// CHECK-PROFILE-RTLIB: libclang_rt.profile - -// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ -// RUN: --target=arm64-linux-ohos -pthread \ -// RUN: --gcc-toolchain="" \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -shared \ -// RUN: | FileCheck --check-prefix=CHECK-OHOS-PTHREAD %s - -// CHECK-OHOS-PTHREAD-NOT: -lpthread - diff --git a/clang/test/Driver/ohos.cpp b/clang/test/Driver/ohos.cpp deleted file mode 100644 index 3294fc9b46a30..0000000000000 --- a/clang/test/Driver/ohos.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// UNSUPPORTED: system-windows -// RUN: %clangxx %s -### -no-canonical-prefixes --target=arm-liteos -march=armv7-a \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld 2>&1 | FileCheck %s -// CHECK: {{.*}}clang{{.*}}" "-cc1" -// CHECK: "-triple" "armv7-unknown-liteos-ohos" -// CHECK-NOT: "-fuse-init-array" -// CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" -// CHECK: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK: "-pie" -// CHECK-NOT: "--build-id" -// CHECK: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK: Scrt1.o -// CHECK: crti.o -// CHECK: clang_rt.crtbegin.o -// CHECK: "-L{{.*[/\\]}}lib/arm-liteos-ohos/" -// CHECK-NOT: "--push-state" -// CHECK-NOT: "--as-needed" -// CHECK: "-lc++" -// CHECK: "-lm" -// CHECK-NOT: "--pop-state" -// CHECK: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}libclang_rt.builtins.a" -// CHECK: "-lc" -// CHECK: clang_rt.crtend.o -// CHECK: crtn.o - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -stdlib=libstdc++ \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STDLIB -// CHECK-STDLIB: error: invalid library name in argument '-stdlib=libstdc++' - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -static-libstdc++ \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC -// CHECK-STATIC-NOT: "--push-state" -// CHECK-STATIC-NOT: "--as-needed" -// CHECK-STATIC: "-Bstatic" -// CHECK-STATIC: "-lc++" -// CHECK-STATIC: "-Bdynamic" -// CHECK-STATIC: "-lm" -// CHECK-STATIC-NOT: "--pop-state" -// CHECK-STATIC: "-lc" - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -static \ -// RUN: -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC1 -// CHECK-STATIC1-NOT: "-fuse-init-array" -// CHECK-STATIC1: "-static" -// CHECK-STATIC1: "-lc++" -// CHECK-STATIC1: "-lc++abi" -// CHECK-STATIC1: "-lunwind" -// CHECK-STATIC1: "-lm" -// CHECK-STATIC1: "-lc" - -// RUN: %clangxx %s -### --target=arm-unknown-liteos -march=armv7-a -mfloat-abi=soft -static -fPIE -fPIC -fpic -pie \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-STATIC2 -// CHECK-STATIC2: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK-STATIC2: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-STATIC2: "-static" -// CHECK-STATIC2: "-lc++" -// CHECK-STATIC2: "-lc++abi" -// CHECK-STATIC2: "-lunwind" -// CHECK-STATIC2: "-lm" -// CHECK-STATIC2: "-lc" - -// RUN: %clangxx %s -### --target=arm-liteos -nostdlib++ -fuse-ld=lld 2>&1 \ -// RUN: | FileCheck %s -check-prefix=CHECK-NOSTDLIBXX -// CHECK-NOSTDLIBXX-NOT: "-lc++" -// CHECK-NOSTDLIBXX: "-lm" -// CHECK-NOSTDLIBXX: "-lc" - -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=soft 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFT -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=softfp -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-SF,CHECK-MULTILIB-ARM-A7-SOFTFP -// RUN: %clangxx %s -### --target=arm-liteos \ -// RUN: -ccc-install-dir %S/Inputs/ohos_native_tree/llvm/bin \ -// RUN: -resource-dir=%S/Inputs/ohos_native_tree/llvm/lib/clang/x.y.z \ -// RUN: --sysroot=%S/Inputs/ohos_native_tree/sysroot \ -// RUN: -march=armv7-a -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 2>&1\ -// RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB,CHECK-MULTILIB-HF,CHECK-MULTILIB-ARM-A7-HARD -// CHECK-MULTILIB: {{.*}}clang{{.*}}" "-cc1" -// CHECK-MULTILIB: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]" -// CHECK-MULTILIB: "-isysroot" "[[SYSROOT:[^"]+]]" -// CHECK-MULTILIB: {{.*}}ld.lld{{.*}}" "--sysroot=[[SYSROOT]]" -// CHECK-MULTILIB-SF: "-dynamic-linker" "/lib/ld-musl-arm.so.1" -// CHECK-MULTILIB-HF: "-dynamic-linker" "/lib/ld-musl-armhf.so.1" - -// CHECK-MULTILIB-ARM: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}" -// CHECK-MULTILIB-ARM: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/" - -// CHECK-MULTILIB-ARM-A7-SOFT: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_soft" -// CHECK-MULTILIB-ARM-A7-SOFT: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_soft" - -// CHECK-MULTILIB-ARM-A7-SOFTFP: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_softfp_neon-vfpv4" -// CHECK-MULTILIB-ARM-A7-SOFTFP: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4" - -// CHECK-MULTILIB-ARM-A7-HARD: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}arm-liteos-ohos{{/|\\\\}}a7_hard_neon-vfpv4" -// CHECK-MULTILIB-ARM-A7-HARD: "-L[[SYSROOT]]/usr/lib/arm-liteos-ohos/a7_hard_neon-vfpv4" - -// CHECK-MULTILIB-ARM: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFT: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_soft/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-SOFTFP: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_softfp_neon-vfpv4/libclang_rt.builtins.a" -// CHECK-MULTILIB-ARM-A7-HARD: "[[RESOURCE_DIR]]/lib/arm-liteos-ohos/a7_hard_neon-vfpv4/libclang_rt.builtins.a" diff --git a/clang/test/Preprocessor/ohos.c b/clang/test/Preprocessor/ohos.c deleted file mode 100644 index 0c435c7ed5ab4..0000000000000 --- a/clang/test/Preprocessor/ohos.c +++ /dev/null @@ -1,15 +0,0 @@ -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=arm-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=ARM-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=aarch64-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=ARM64-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=riscv64-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=RISCV64-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=mipsel-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=MIPSEL-OHOS-CXX -// RUN: %clang_cc1 -x c++ -E -dM -ffreestanding -triple=x86_64-linux-ohos < /dev/null | FileCheck %s -match-full-lines -check-prefix=X86_64-OHOS-CXX -// RUN: %clang_cc1 -E -dM -ffreestanding -triple=arm-linux-ohos < /dev/null | FileCheck %s -check-prefix=OHOS-DEFS - -// ARM-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U -// ARM64-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL -// RISCV64-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL -// MIPSEL-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 8U -// X86_64-OHOS-CXX: #define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16UL -// OHOS-DEFS: __OHOS_FAMILY__ -// OHOS-DEFS: __OHOS__ -// OHOS-DEFS-NOT: __OHOS__ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits