Author: Brad Smith Date: 2023-08-27T18:43:23-04:00 New Revision: 2a105105a621ffe75ddd09275309469c4cb548d4
URL: https://github.com/llvm/llvm-project/commit/2a105105a621ffe75ddd09275309469c4cb548d4 DIFF: https://github.com/llvm/llvm-project/commit/2a105105a621ffe75ddd09275309469c4cb548d4.diff LOG: Delete Ananas support After looking at this further I think the Ananas support should be removed. They stopped using Clang. There have never been any releases either; as in source only, and the backend is not maintained. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D158946 Added: Modified: clang/docs/tools/clang-formatted-files.txt clang/lib/Basic/Targets.cpp clang/lib/Basic/Targets/OSTargets.h clang/lib/Driver/CMakeLists.txt clang/lib/Driver/Driver.cpp clang/test/Preprocessor/predefined-macros-no-warnings.c llvm/include/llvm/TargetParser/Triple.h llvm/lib/TargetParser/Triple.cpp llvm/unittests/TargetParser/TripleTest.cpp llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn Removed: clang/lib/Driver/ToolChains/Ananas.cpp clang/lib/Driver/ToolChains/Ananas.h clang/test/Driver/ananas.c ################################################################################ diff --git a/clang/docs/tools/clang-formatted-files.txt b/clang/docs/tools/clang-formatted-files.txt index caab83f49bb812..994350c01f8925 100644 --- a/clang/docs/tools/clang-formatted-files.txt +++ b/clang/docs/tools/clang-formatted-files.txt @@ -397,7 +397,6 @@ clang/lib/Driver/ToolChains/AIX.cpp clang/lib/Driver/ToolChains/AIX.h clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp clang/lib/Driver/ToolChains/AMDGPUOpenMP.h -clang/lib/Driver/ToolChains/Ananas.h clang/lib/Driver/ToolChains/AVR.cpp clang/lib/Driver/ToolChains/AVR.h clang/lib/Driver/ToolChains/CloudABI.cpp diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index 86e8529c289147..d5d523de17ce49 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -541,8 +541,6 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple, return std::make_unique<DarwinI386TargetInfo>(Triple, Opts); switch (os) { - case llvm::Triple::Ananas: - return std::make_unique<AnanasTargetInfo<X86_32TargetInfo>>(Triple, Opts); case llvm::Triple::CloudABI: return std::make_unique<CloudABITargetInfo<X86_32TargetInfo>>(Triple, Opts); @@ -605,8 +603,6 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple, return std::make_unique<DarwinX86_64TargetInfo>(Triple, Opts); switch (os) { - case llvm::Triple::Ananas: - return std::make_unique<AnanasTargetInfo<X86_64TargetInfo>>(Triple, Opts); case llvm::Triple::CloudABI: return std::make_unique<CloudABITargetInfo<X86_64TargetInfo>>(Triple, Opts); diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index d10740c8a92ec7..37e313b248dc13 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -50,20 +50,6 @@ class LLVM_LIBRARY_VISIBILITY CloudABITargetInfo : public OSTargetInfo<Target> { using OSTargetInfo<Target>::OSTargetInfo; }; -// Ananas target -template <typename Target> -class LLVM_LIBRARY_VISIBILITY AnanasTargetInfo : public OSTargetInfo<Target> { -protected: - void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override { - // Ananas defines - Builder.defineMacro("__Ananas__"); - } - -public: - using OSTargetInfo<Target>::OSTargetInfo; -}; - void getDarwinDefines(MacroBuilder &Builder, const LangOptions &Opts, const llvm::Triple &Triple, StringRef &PlatformName, VersionTuple &PlatformMinVersion); diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt index c8778524a2b6ae..bdf24e771a5dd6 100644 --- a/clang/lib/Driver/CMakeLists.txt +++ b/clang/lib/Driver/CMakeLists.txt @@ -42,7 +42,6 @@ add_clang_library(clangDriver ToolChains/Arch/VE.cpp ToolChains/Arch/X86.cpp ToolChains/AIX.cpp - ToolChains/Ananas.cpp ToolChains/AMDGPU.cpp ToolChains/AMDGPUOpenMP.cpp ToolChains/AVR.cpp diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index e02695e3f5572d..7b64ef4cc5db6e 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -11,7 +11,6 @@ #include "ToolChains/AMDGPU.h" #include "ToolChains/AMDGPUOpenMP.h" #include "ToolChains/AVR.h" -#include "ToolChains/Ananas.h" #include "ToolChains/Arch/RISCV.h" #include "ToolChains/BareMetal.h" #include "ToolChains/CSKYToolChain.h" @@ -6159,9 +6158,6 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, case llvm::Triple::Haiku: TC = std::make_unique<toolchains::Haiku>(*this, Target, Args); break; - case llvm::Triple::Ananas: - TC = std::make_unique<toolchains::Ananas>(*this, Target, Args); - break; case llvm::Triple::CloudABI: TC = std::make_unique<toolchains::CloudABI>(*this, Target, Args); break; diff --git a/clang/lib/Driver/ToolChains/Ananas.cpp b/clang/lib/Driver/ToolChains/Ananas.cpp deleted file mode 100644 index bc4eff34868769..00000000000000 --- a/clang/lib/Driver/ToolChains/Ananas.cpp +++ /dev/null @@ -1,148 +0,0 @@ -//===--- Ananas.cpp - Ananas 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 "Ananas.h" -#include "CommonArgs.h" -#include "clang/Driver/Compilation.h" -#include "clang/Driver/Driver.h" -#include "clang/Driver/InputInfo.h" -#include "clang/Driver/Options.h" -#include "llvm/ADT/SmallString.h" -#include "llvm/Option/ArgList.h" -#include "llvm/Support/Path.h" - -using namespace clang::driver; -using namespace clang::driver::tools; -using namespace clang::driver::toolchains; -using namespace clang; -using namespace llvm::opt; - -void ananas::Assembler::ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const ArgList &Args, - const char *LinkingOutput) const { - claimNoWarnArgs(Args); - ArgStringList CmdArgs; - - Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, options::OPT_Xassembler); - - CmdArgs.push_back("-o"); - CmdArgs.push_back(Output.getFilename()); - - for (const auto &II : Inputs) - CmdArgs.push_back(II.getFilename()); - - const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as")); - C.addCommand(std::make_unique<Command>(JA, *this, - ResponseFileSupport::AtFileCurCP(), - Exec, CmdArgs, Inputs, Output)); -} - -void ananas::Linker::ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const ArgList &Args, - const char *LinkingOutput) const { - const ToolChain &ToolChain = getToolChain(); - const Driver &D = ToolChain.getDriver(); - ArgStringList CmdArgs; - - // Silence warning for "clang -g foo.o -o foo" - Args.ClaimAllArgs(options::OPT_g_Group); - // and "clang -emit-llvm foo.o -o foo" - Args.ClaimAllArgs(options::OPT_emit_llvm); - // and for "clang -w foo.o -o foo". Other warning options are already - // handled somewhere else. - Args.ClaimAllArgs(options::OPT_w); - - if (!D.SysRoot.empty()) - CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot)); - - if (Args.hasArg(options::OPT_static)) { - CmdArgs.push_back("-Bstatic"); - } else { - if (Args.hasArg(options::OPT_rdynamic)) - CmdArgs.push_back("-export-dynamic"); - if (Args.hasArg(options::OPT_shared)) { - CmdArgs.push_back("-Bshareable"); - } else if (!Args.hasArg(options::OPT_r)) { - Args.AddAllArgs(CmdArgs, options::OPT_pie); - CmdArgs.push_back("-dynamic-linker"); - CmdArgs.push_back("/lib/ld-ananas.so"); - } - } - - if (Output.isFilename()) { - CmdArgs.push_back("-o"); - CmdArgs.push_back(Output.getFilename()); - } else { - assert(Output.isNothing() && "Invalid output."); - } - - if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, - options::OPT_r)) { - if (!Args.hasArg(options::OPT_shared)) { - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crt0.o"))); - } - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crti.o"))); - if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) { - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbeginS.o"))); - } else { - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtbegin.o"))); - } - } - - Args.AddAllArgs(CmdArgs, options::OPT_L); - ToolChain.AddFilePathLibArgs(Args, CmdArgs); - Args.AddAllArgs(CmdArgs, - {options::OPT_T_Group, options::OPT_s, options::OPT_t, - options::OPT_Z_Flag, options::OPT_r}); - - if (D.isUsingLTO()) { - assert(!Inputs.empty() && "Must have at least one input."); - addLTOOptions(ToolChain, Args, CmdArgs, Output, Inputs[0], - D.getLTOMode() == LTOK_Thin); - } - - AddLinkerInputs(ToolChain, Inputs, Args, CmdArgs, JA); - - if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, - options::OPT_r)) { - if (ToolChain.ShouldLinkCXXStdlib(Args)) - ToolChain.AddCXXStdlibLibArgs(Args, CmdArgs); - CmdArgs.push_back("-lc"); - } - - if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, - options::OPT_r)) { - if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_pie)) - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtendS.o"))); - else - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtend.o"))); - CmdArgs.push_back(Args.MakeArgString(ToolChain.GetFilePath("crtn.o"))); - } - - const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath()); - C.addCommand(std::make_unique<Command>(JA, *this, - ResponseFileSupport::AtFileCurCP(), - Exec, CmdArgs, Inputs, Output)); -} - -// Ananas - Ananas tool chain which can call as(1) and ld(1) directly. - -Ananas::Ananas(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) - : Generic_ELF(D, Triple, Args) { - getFilePaths().push_back(getDriver().SysRoot + "/usr/lib"); -} - -Tool *Ananas::buildAssembler() const { - return new tools::ananas::Assembler(*this); -} - -Tool *Ananas::buildLinker() const { return new tools::ananas::Linker(*this); } diff --git a/clang/lib/Driver/ToolChains/Ananas.h b/clang/lib/Driver/ToolChains/Ananas.h deleted file mode 100644 index 72ad3edcf05673..00000000000000 --- a/clang/lib/Driver/ToolChains/Ananas.h +++ /dev/null @@ -1,65 +0,0 @@ -//===--- Ananas.h - Ananas 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_ANANAS_H -#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ANANAS_H - -#include "Gnu.h" -#include "clang/Driver/Tool.h" -#include "clang/Driver/ToolChain.h" - -namespace clang { -namespace driver { -namespace tools { - -/// ananas -- Directly call GNU Binutils assembler and linker -namespace ananas { -class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { -public: - Assembler(const ToolChain &TC) : Tool("ananas::Assembler", "assembler", TC) {} - - bool hasIntegratedCPP() const override { return false; } - - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; -}; - -class LLVM_LIBRARY_VISIBILITY Linker : public Tool { -public: - Linker(const ToolChain &TC) : Tool("ananas::Linker", "linker", TC) {} - - bool hasIntegratedCPP() const override { return false; } - bool isLinkJob() const override { return true; } - - void ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, const InputInfoList &Inputs, - const llvm::opt::ArgList &TCArgs, - const char *LinkingOutput) const override; -}; -} // end namespace ananas -} // end namespace tools - -namespace toolchains { - -class LLVM_LIBRARY_VISIBILITY Ananas : public Generic_ELF { -public: - Ananas(const Driver &D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args); - -protected: - Tool *buildAssembler() const override; - Tool *buildLinker() const override; -}; - -} // end namespace toolchains -} // end namespace driver -} // end namespace clang - -#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ANANAS_H diff --git a/clang/test/Driver/ananas.c b/clang/test/Driver/ananas.c deleted file mode 100644 index b3485ea91f960c..00000000000000 --- a/clang/test/Driver/ananas.c +++ /dev/null @@ -1,26 +0,0 @@ -// RUN: %clang --target=x86_64-unknown-ananas -static %s \ -// RUN: --sysroot=%S/Inputs/ananas-tree -### 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-STATIC %s -// CHECK-STATIC: ld{{.*}}" "-Bstatic" -// CHECK-STATIC: crt0.o -// CHECK-STATIC: crti.o -// CHECK-STATIC: crtbegin.o -// CHECK-STATIC: crtend.o -// CHECK-STATIC: crtn.o - -// RUN: %clang --target=x86_64-unknown-ananas -shared %s \ -// RUN: --sysroot=%S/Inputs/ananas-tree -### 2>&1 \ -// RUN: | FileCheck --check-prefix=CHECK-SHARED %s -// CHECK-SHARED: crti.o -// CHECK-SHARED: crtbeginS.o -// CHECK-SHARED: crtendS.o -// CHECK-SHARED: crtn.o - -// -r suppresses -dynamic-linker, default -l and crt*.o like -nostdlib. -// RUN: %clang %s -### -o %t.o --target=x86_64-unknown-ananas -r 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-RELOCATABLE -// CHECK-RELOCATABLE: "-r" -// CHECK-RELOCATABLE-NOT: "-pie" -// CHECK-RELOCATABLE-NOT: "-dynamic-linker" -// CHECK-RELOCATABLE-NOT: "-l -// CHECK-RELOCATABLE-NOT: /crt{{[^.]+}}.o diff --git a/clang/test/Preprocessor/predefined-macros-no-warnings.c b/clang/test/Preprocessor/predefined-macros-no-warnings.c index 30d8dd17031f49..e8bae2a7bd3082 100644 --- a/clang/test/Preprocessor/predefined-macros-no-warnings.c +++ b/clang/test/Preprocessor/predefined-macros-no-warnings.c @@ -135,7 +135,6 @@ // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple tcele // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686 // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-darwin -// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-ananas // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-cloudabi // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-linux // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-linux-android @@ -157,7 +156,6 @@ // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple i686-hurd // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64 // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-darwin -// RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-ananas // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-cloudabi // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-linux // RUN: %clang_cc1 %s -Eonly -Wsystem-headers -Werror -triple x86_64-linux-android diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index d6f034b7ae44d5..182e1c0ccbc2ad 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -184,7 +184,6 @@ class Triple { enum OSType { UnknownOS, - Ananas, CloudABI, Darwin, DragonFly, diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp index d56ed2d0f18d6f..9fe1b1786d2d09 100644 --- a/llvm/lib/TargetParser/Triple.cpp +++ b/llvm/lib/TargetParser/Triple.cpp @@ -207,7 +207,6 @@ StringRef Triple::getOSTypeName(OSType Kind) { case AIX: return "aix"; case AMDHSA: return "amdhsa"; case AMDPAL: return "amdpal"; - case Ananas: return "ananas"; case CUDA: return "cuda"; case CloudABI: return "cloudabi"; case Darwin: return "darwin"; @@ -571,7 +570,6 @@ static Triple::VendorType parseVendor(StringRef VendorName) { static Triple::OSType parseOS(StringRef OSName) { return StringSwitch<Triple::OSType>(OSName) - .StartsWith("ananas", Triple::Ananas) .StartsWith("cloudabi", Triple::CloudABI) .StartsWith("darwin", Triple::Darwin) .StartsWith("dragonfly", Triple::DragonFly) diff --git a/llvm/unittests/TargetParser/TripleTest.cpp b/llvm/unittests/TargetParser/TripleTest.cpp index 90e728b84c530e..59ec2e256ce926 100644 --- a/llvm/unittests/TargetParser/TripleTest.cpp +++ b/llvm/unittests/TargetParser/TripleTest.cpp @@ -319,12 +319,6 @@ TEST(TripleTest, ParsedIDs) { EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); EXPECT_EQ(Triple::UnknownOS, T.getOS()); - T = Triple("x86_64-unknown-ananas"); - EXPECT_EQ(Triple::x86_64, T.getArch()); - EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); - EXPECT_EQ(Triple::Ananas, T.getOS()); - EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); - T = Triple("x86_64-unknown-cloudabi"); EXPECT_EQ(Triple::x86_64, T.getArch()); EXPECT_EQ(Triple::UnknownVendor, T.getVendor()); diff --git a/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn index 1b0010ef467738..de8d02c48141ae 100644 --- a/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn @@ -48,7 +48,6 @@ static_library("Driver") { "ToolChains/AMDGPU.cpp", "ToolChains/AMDGPUOpenMP.cpp", "ToolChains/AVR.cpp", - "ToolChains/Ananas.cpp", "ToolChains/Arch/AArch64.cpp", "ToolChains/Arch/ARM.cpp", "ToolChains/Arch/CSKY.cpp", _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits