11553Srgrimes//===--- Fuchsia.h - Fuchsia ToolChain Implementations ----------*- C++ -*-===// 21553Srgrimes// 31553Srgrimes// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 41553Srgrimes// See https://llvm.org/LICENSE.txt for license information. 51553Srgrimes// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 61553Srgrimes// 71553Srgrimes//===----------------------------------------------------------------------===// 81553Srgrimes 91553Srgrimes#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H 101553Srgrimes#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H 111553Srgrimes 121553Srgrimes#include "Gnu.h" 131553Srgrimes#include "clang/Basic/LangOptions.h" 141553Srgrimes#include "clang/Driver/Tool.h" 151553Srgrimes#include "clang/Driver/ToolChain.h" 161553Srgrimes 171553Srgrimesnamespace clang { 181553Srgrimesnamespace driver { 191553Srgrimesnamespace tools { 201553Srgrimesnamespace fuchsia { 211553Srgrimesclass LLVM_LIBRARY_VISIBILITY StaticLibTool : public Tool { 221553Srgrimespublic: 231553Srgrimes StaticLibTool(const ToolChain &TC) 241553Srgrimes : Tool("fuchsia::StaticLibTool", "llvm-ar", TC) {} 251553Srgrimes 261553Srgrimes bool hasIntegratedCPP() const override { return false; } 271553Srgrimes bool isLinkJob() const override { return true; } 281553Srgrimes 291553Srgrimes void ConstructJob(Compilation &C, const JobAction &JA, 3052098Speter const InputInfo &Output, const InputInfoList &Inputs, 311553Srgrimes const llvm::opt::ArgList &TCArgs, 321553Srgrimes const char *LinkingOutput) const override; 331553Srgrimes}; 341553Srgrimes 351553Srgrimesclass LLVM_LIBRARY_VISIBILITY Linker final : public Tool { 361553Srgrimespublic: 37110895Sru Linker(const ToolChain &TC) : Tool("fuchsia::Linker", "ld.lld", TC) {} 381553Srgrimes 391553Srgrimes bool hasIntegratedCPP() const override { return false; } 401553Srgrimes bool isLinkJob() const override { return true; } 41169507Swkoszek 42169507Swkoszek void ConstructJob(Compilation &C, const JobAction &JA, 43169507Swkoszek const InputInfo &Output, const InputInfoList &Inputs, 44169507Swkoszek const llvm::opt::ArgList &TCArgs, 45169507Swkoszek const char *LinkingOutput) const override; 46169507Swkoszek}; 471553Srgrimes} // end namespace fuchsia 48110895Sru} // end namespace tools 491553Srgrimes 50134542Speternamespace toolchains { 511553Srgrimes 5273199Speterclass LLVM_LIBRARY_VISIBILITY Fuchsia : public ToolChain { 534571Sgibbspublic: 546803Sgibbs Fuchsia(const Driver &D, const llvm::Triple &Triple, 5554490Speter const llvm::opt::ArgList &Args); 56219819Sjeff 571553Srgrimes bool HasNativeLLVMSupport() const override { return true; } 581553Srgrimes bool IsMathErrnoDefault() const override { return false; } 59129073Scognet RuntimeLibType GetDefaultRuntimeLibType() const override { 60129073Scognet return ToolChain::RLT_CompilerRT; 61129073Scognet } 62129073Scognet CXXStdlibType GetDefaultCXXStdlibType() const override { 63129073Scognet return ToolChain::CST_Libcxx; 641553Srgrimes } 651553Srgrimes UnwindTableLevel 661553Srgrimes getDefaultUnwindTableLevel(const llvm::opt::ArgList &Args) const override { 6748525Speter return UnwindTableLevel::Asynchronous; 6848525Speter } 6948525Speter bool isPICDefault() const override { return false; } 7048525Speter bool isPIEDefault(const llvm::opt::ArgList &Args) const override { 7130796Sjoerg return true; 7230796Sjoerg } 731553Srgrimes bool isPICDefaultForced() const override { return false; } 741553Srgrimes llvm::DebuggerKind getDefaultDebuggerTuning() const override { 751553Srgrimes return llvm::DebuggerKind::GDB; 761553Srgrimes } 7773204Speter 7873204Speter LangOptions::StackProtectorMode 7973204Speter GetDefaultStackProtectorLevel(bool KernelOrKext) const override { 80134542Speter return LangOptions::SSPStrong; 811553Srgrimes } 821553Srgrimes 8371879Speter std::string ComputeEffectiveClangTriple(const llvm::opt::ArgList &Args, 841553Srgrimes types::ID InputType) const override; 851553Srgrimes 86110895Sru SanitizerMask getSupportedSanitizers() const override; 871553Srgrimes SanitizerMask getDefaultSanitizers() const override; 881553Srgrimes 891553Srgrimes RuntimeLibType 901553Srgrimes GetRuntimeLibType(const llvm::opt::ArgList &Args) const override; 911553Srgrimes CXXStdlibType GetCXXStdlibType(const llvm::opt::ArgList &Args) const override; 921553Srgrimes 931553Srgrimes bool IsAArch64OutlineAtomicsDefault( 941553Srgrimes const llvm::opt::ArgList &Args) const override { 951553Srgrimes return true; 9645775Speter } 9745775Speter 98144509Simp void 99144509Simp addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, 1001553Srgrimes llvm::opt::ArgStringList &CC1Args, 1011553Srgrimes Action::OffloadKind DeviceOffloadKind) const override; 102144509Simp void 1031553Srgrimes AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, 1041553Srgrimes llvm::opt::ArgStringList &CC1Args) const override; 1051553Srgrimes void AddClangCXXStdlibIncludeArgs( 1061553Srgrimes const llvm::opt::ArgList &DriverArgs, 1071553Srgrimes llvm::opt::ArgStringList &CC1Args) const override; 1081553Srgrimes void AddCXXStdlibLibArgs(const llvm::opt::ArgList &Args, 1091553Srgrimes llvm::opt::ArgStringList &CmdArgs) const override; 110110895Sru 111110895Sru const char *getDefaultLinker() const override { return "ld.lld"; } 1121553Srgrimes 113110895Sruprotected: 114110895Sru Tool *buildLinker() const override; 1151553Srgrimes Tool *buildStaticLibTool() const override; 1161553Srgrimes}; 1171553Srgrimes 1181553Srgrimes} // end namespace toolchains 1191553Srgrimes} // end namespace driver 1201553Srgrimes} // end namespace clang 1211553Srgrimes 1221553Srgrimes#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_FUCHSIA_H 12312772Speter