1 //===--- OHOS.h - OHOS ToolChain Implementations ----------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H
10 #define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H
13 #include "clang/Driver/Tool.h"
14 #include "clang/Driver/ToolChain.h"
18 namespace toolchains
{
20 class LLVM_LIBRARY_VISIBILITY OHOS
: public Generic_ELF
{
22 OHOS(const Driver
&D
, const llvm::Triple
&Triple
,
23 const llvm::opt::ArgList
&Args
);
25 bool HasNativeLLVMSupport() const override
{ return true; }
27 bool IsMathErrnoDefault() const override
{ return false; }
29 RuntimeLibType
GetDefaultRuntimeLibType() const override
{
30 return ToolChain::RLT_CompilerRT
;
32 CXXStdlibType
GetDefaultCXXStdlibType() const override
{
33 return ToolChain::CST_Libcxx
;
35 // Not add -funwind-tables by default
36 bool isPICDefault() const override
{ return false; }
37 bool isPIEDefault(const llvm::opt::ArgList
&Args
) const override
{ return true; }
38 bool isPICDefaultForced() const override
{ return false; }
39 UnwindLibType
GetUnwindLibType(const llvm::opt::ArgList
&Args
) const override
;
40 UnwindLibType
GetDefaultUnwindLibType() const override
{ return UNW_CompilerRT
; }
43 GetRuntimeLibType(const llvm::opt::ArgList
&Args
) const override
;
45 GetCXXStdlibType(const llvm::opt::ArgList
&Args
) const override
;
48 AddClangSystemIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
49 llvm::opt::ArgStringList
&CC1Args
) const override
;
51 AddClangCXXStdlibIncludeArgs(const llvm::opt::ArgList
&DriverArgs
,
52 llvm::opt::ArgStringList
&CC1Args
) const override
;
53 void AddCXXStdlibLibArgs(const llvm::opt::ArgList
&Args
,
54 llvm::opt::ArgStringList
&CmdArgs
) const override
;
56 std::string
computeSysRoot() const override
;
57 std::string
getDynamicLinker(const llvm::opt::ArgList
&Args
) const override
;
60 getCompilerRT(const llvm::opt::ArgList
&Args
, StringRef Component
,
61 FileType Type
= ToolChain::FT_Static
) const override
;
63 const char *getDefaultLinker() const override
{
67 Tool
*buildLinker() const override
{
68 return new tools::gnutools::Linker(*this);
70 Tool
*buildAssembler() const override
{
71 return new tools::gnutools::Assembler(*this);
74 path_list
getRuntimePaths() const;
77 std::string
getMultiarchTriple(const llvm::Triple
&T
) const;
78 std::string
getMultiarchTriple(const Driver
&D
,
79 const llvm::Triple
&TargetTriple
,
80 StringRef SysRoot
) const override
;
81 void addExtraOpts(llvm::opt::ArgStringList
&CmdArgs
) const override
;
82 SanitizerMask
getSupportedSanitizers() const override
;
83 void addProfileRTLibs(const llvm::opt::ArgList
&Args
,
84 llvm::opt::ArgStringList
&CmdArgs
) const override
;
85 path_list
getArchSpecificLibPaths() const override
;
88 Multilib SelectedMultilib
;
91 } // end namespace toolchains
92 } // end namespace driver
93 } // end namespace clang
95 #endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_OHOS_H