diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -571,8 +571,6 @@ case llvm::Triple::KFreeBSD: return std::make_unique>(Triple, Opts); - case llvm::Triple::Minix: - return std::make_unique>(Triple, Opts); case llvm::Triple::Solaris: return std::make_unique>(Triple, Opts); diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -331,28 +331,6 @@ using OSTargetInfo::OSTargetInfo; }; -// Minix Target -template -class LLVM_LIBRARY_VISIBILITY MinixTargetInfo : public OSTargetInfo { -protected: - void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override { - // Minix defines - - Builder.defineMacro("__minix", "3"); - Builder.defineMacro("_EM_WSIZE", "4"); - Builder.defineMacro("_EM_PSIZE", "4"); - Builder.defineMacro("_EM_SSIZE", "2"); - Builder.defineMacro("_EM_LSIZE", "4"); - Builder.defineMacro("_EM_FSIZE", "4"); - Builder.defineMacro("_EM_DSIZE", "8"); - DefineStd(Builder, "unix", Opts); - } - -public: - using OSTargetInfo::OSTargetInfo; -}; - // Linux target template class LLVM_LIBRARY_VISIBILITY LinuxTargetInfo : public OSTargetInfo { diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt --- a/clang/lib/Driver/CMakeLists.txt +++ b/clang/lib/Driver/CMakeLists.txt @@ -50,7 +50,6 @@ ToolChains/Clang.cpp ToolChains/CloudABI.cpp ToolChains/CommonArgs.cpp - ToolChains/Contiki.cpp ToolChains/CrossWindows.cpp ToolChains/CSKYToolChain.cpp ToolChains/Cuda.cpp @@ -70,7 +69,6 @@ ToolChains/Linux.cpp ToolChains/MipsLinux.cpp ToolChains/MinGW.cpp - ToolChains/Minix.cpp ToolChains/MSP430.cpp ToolChains/MSVC.cpp ToolChains/Myriad.cpp diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -17,7 +17,6 @@ #include "ToolChains/CSKYToolChain.h" #include "ToolChains/Clang.h" #include "ToolChains/CloudABI.h" -#include "ToolChains/Contiki.h" #include "ToolChains/CrossWindows.h" #include "ToolChains/Cuda.h" #include "ToolChains/Darwin.h" @@ -36,7 +35,6 @@ #include "ToolChains/MSP430.h" #include "ToolChains/MSVC.h" #include "ToolChains/MinGW.h" -#include "ToolChains/Minix.h" #include "ToolChains/MipsLinux.h" #include "ToolChains/Myriad.h" #include "ToolChains/NaCl.h" @@ -6193,9 +6191,6 @@ else TC = std::make_unique(*this, Target, Args); break; - case llvm::Triple::Minix: - TC = std::make_unique(*this, Target, Args); - break; case llvm::Triple::Linux: case llvm::Triple::ELFIAMCU: if (Target.getArch() == llvm::Triple::hexagon) @@ -6269,9 +6264,6 @@ case llvm::Triple::PS5: TC = std::make_unique(*this, Target, Args); break; - case llvm::Triple::Contiki: - TC = std::make_unique(*this, Target, Args); - break; case llvm::Triple::Hurd: TC = std::make_unique(*this, Target, Args); break; diff --git a/clang/lib/Driver/ToolChains/Contiki.h b/clang/lib/Driver/ToolChains/Contiki.h deleted file mode 100644 --- a/clang/lib/Driver/ToolChains/Contiki.h +++ /dev/null @@ -1,39 +0,0 @@ -//===--- Contiki.h - Contiki 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_CONTIKI_H -#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CONTIKI_H - -#include "Gnu.h" -#include "clang/Driver/ToolChain.h" - -namespace clang { -namespace driver { -namespace toolchains { - -class LLVM_LIBRARY_VISIBILITY Contiki : public Generic_ELF { -public: - Contiki(const Driver &D, const llvm::Triple &Triple, - const llvm::opt::ArgList &Args); - - // No support for finding a C++ standard library yet. - void addLibCxxIncludePaths( - const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override {} - void addLibStdCxxIncludePaths( - const llvm::opt::ArgList &DriverArgs, - llvm::opt::ArgStringList &CC1Args) const override {} - - SanitizerMask getSupportedSanitizers() const override; -}; - -} // end namespace toolchains -} // end namespace driver -} // end namespace clang - -#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_CONTIKI_H diff --git a/clang/lib/Driver/ToolChains/Contiki.cpp b/clang/lib/Driver/ToolChains/Contiki.cpp deleted file mode 100644 --- a/clang/lib/Driver/ToolChains/Contiki.cpp +++ /dev/null @@ -1,27 +0,0 @@ -//===--- Contiki.cpp - Contiki 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 "Contiki.h" -#include "CommonArgs.h" - -using namespace clang::driver; -using namespace clang::driver::toolchains; -using namespace clang; -using namespace llvm::opt; - -Contiki::Contiki(const Driver &D, const llvm::Triple &Triple, - const ArgList &Args) - : Generic_ELF(D, Triple, Args) {} - -SanitizerMask Contiki::getSupportedSanitizers() const { - const bool IsX86 = getTriple().getArch() == llvm::Triple::x86; - SanitizerMask Res = ToolChain::getSupportedSanitizers(); - if (IsX86) - Res |= SanitizerKind::SafeStack; - return Res; -} diff --git a/clang/lib/Driver/ToolChains/Minix.h b/clang/lib/Driver/ToolChains/Minix.h deleted file mode 100644 --- a/clang/lib/Driver/ToolChains/Minix.h +++ /dev/null @@ -1,64 +0,0 @@ -//===--- Minix.h - Minix 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_MINIX_H -#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_MINIX_H - -#include "Gnu.h" -#include "clang/Driver/Tool.h" -#include "clang/Driver/ToolChain.h" - -namespace clang { -namespace driver { -namespace tools { -/// minix -- Directly call GNU Binutils assembler and linker -namespace minix { -class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { -public: - Assembler(const ToolChain &TC) : Tool("minix::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("minix::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 minix -} // end namespace tools - -namespace toolchains { - -class LLVM_LIBRARY_VISIBILITY Minix : public Generic_ELF { -public: - Minix(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_MINIX_H diff --git a/clang/lib/Driver/ToolChains/Minix.cpp b/clang/lib/Driver/ToolChains/Minix.cpp deleted file mode 100644 --- a/clang/lib/Driver/ToolChains/Minix.cpp +++ /dev/null @@ -1,116 +0,0 @@ -//===--- Minix.cpp - Minix 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 "Minix.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/Option/ArgList.h" -#include "llvm/Support/VirtualFileSystem.h" - -using namespace clang::driver; -using namespace clang; -using namespace llvm::opt; - -void tools::minix::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(JA, *this, - ResponseFileSupport::AtFileCurCP(), - Exec, CmdArgs, Inputs, Output)); -} - -void tools::minix::Linker::ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const ArgList &Args, - const char *LinkingOutput) const { - const Driver &D = getToolChain().getDriver(); - ArgStringList CmdArgs; - - 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)) { - CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crt1.o"))); - CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crti.o"))); - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crtbegin.o"))); - CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath("crtn.o"))); - } - - Args.AddAllArgs(CmdArgs, - {options::OPT_L, options::OPT_T_Group, options::OPT_e}); - - AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs, JA); - - getToolChain().addProfileRTLibs(Args, CmdArgs); - - if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nodefaultlibs, - options::OPT_r)) { - if (D.CCCIsCXX()) { - if (getToolChain().ShouldLinkCXXStdlib(Args)) - getToolChain().AddCXXStdlibLibArgs(Args, CmdArgs); - CmdArgs.push_back("-lm"); - } - } - - if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles, - options::OPT_r)) { - if (Args.hasArg(options::OPT_pthread)) - CmdArgs.push_back("-lpthread"); - CmdArgs.push_back("-lc"); - CmdArgs.push_back("-lCompilerRT-Generic"); - CmdArgs.push_back("-L/usr/pkg/compiler-rt/lib"); - CmdArgs.push_back( - Args.MakeArgString(getToolChain().GetFilePath("crtend.o"))); - } - - const char *Exec = Args.MakeArgString(getToolChain().GetLinkerPath()); - C.addCommand(std::make_unique(JA, *this, - ResponseFileSupport::AtFileCurCP(), - Exec, CmdArgs, Inputs, Output)); -} - -/// Minix - Minix tool chain which can call as(1) and ld(1) directly. - -toolchains::Minix::Minix(const Driver &D, const llvm::Triple &Triple, - const ArgList &Args) - : Generic_ELF(D, Triple, Args) { - getFilePaths().push_back(getDriver().Dir + "/../lib"); - getFilePaths().push_back("/usr/lib"); -} - -Tool *toolchains::Minix::buildAssembler() const { - return new tools::minix::Assembler(*this); -} - -Tool *toolchains::Minix::buildLinker() const { - return new tools::minix::Linker(*this); -} diff --git a/clang/test/Driver/fsanitize.c b/clang/test/Driver/fsanitize.c --- a/clang/test/Driver/fsanitize.c +++ b/clang/test/Driver/fsanitize.c @@ -705,7 +705,6 @@ // RUN: %clang --target=x86_64-linux-gnu -fsanitize=safe-stack -fstack-protector-all -### %s 2>&1 | FileCheck %s -check-prefix=SP // RUN: %clang --target=arm-linux-androideabi -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP // RUN: %clang --target=aarch64-linux-android -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP -// RUN: %clang --target=i386-contiki-unknown -fsanitize=safe-stack -### %s 2>&1 | FileCheck %s -check-prefix=NO-SP // NO-SP-NOT: stack-protector // NO-SP: "-fsanitize=safe-stack" // SP-ASAN: error: invalid argument '-fsanitize=safe-stack' not allowed with '-fsanitize=address' diff --git a/clang/test/Driver/minix.c b/clang/test/Driver/minix.c deleted file mode 100644 --- a/clang/test/Driver/minix.c +++ /dev/null @@ -1,6 +0,0 @@ -// -r suppresses default -l and crt*.o like -nostdlib. -// RUN: %clang -### %s --target=i386-unknown-minix -r 2>&1 \ -// RUN: | FileCheck %s --check-prefix=CHECK-RELOCATABLE -// CHECK-RELOCATABLE: "-r" -// CHECK-RELOCATABLE-NOT: "-l -// CHECK-RELOCATABLE-NOT: /crt{{[^.]+}}.o diff --git a/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn b/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn --- a/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn +++ b/llvm/utils/gn/secondary/clang/lib/Driver/BUILD.gn @@ -66,7 +66,6 @@ "ToolChains/Clang.cpp", "ToolChains/CloudABI.cpp", "ToolChains/CommonArgs.cpp", - "ToolChains/Contiki.cpp", "ToolChains/CrossWindows.cpp", "ToolChains/Cuda.cpp", "ToolChains/Darwin.cpp", @@ -87,7 +86,6 @@ "ToolChains/MSP430.cpp", "ToolChains/MSVC.cpp", "ToolChains/MinGW.cpp", - "ToolChains/Minix.cpp", "ToolChains/MipsLinux.cpp", "ToolChains/Myriad.cpp", "ToolChains/NaCl.cpp",