diff options
author | 2020-08-09 15:51:07 +0000 | |
---|---|---|
committer | 2020-08-09 15:51:07 +0000 | |
commit | 389bb291c0c8961ca40ac7a2636e1ca69ca7653c (patch) | |
tree | e027d0b3ed5ed27fe08d1bcaa20e3c191232a53b /gnu/llvm/clang/lib/Driver/ToolChains | |
parent | Import LLVM 10.0.1 including clang, lld and lldb. (diff) | |
download | wireguard-openbsd-389bb291c0c8961ca40ac7a2636e1ca69ca7653c.tar.xz wireguard-openbsd-389bb291c0c8961ca40ac7a2636e1ca69ca7653c.zip |
Import LLVM 10.0.1 including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/clang/lib/Driver/ToolChains')
-rw-r--r-- | gnu/llvm/clang/lib/Driver/ToolChains/Darwin.cpp | 1 | ||||
-rw-r--r-- | gnu/llvm/clang/lib/Driver/ToolChains/Gnu.cpp | 20 | ||||
-rw-r--r-- | gnu/llvm/clang/lib/Driver/ToolChains/Gnu.h | 6 | ||||
-rw-r--r-- | gnu/llvm/clang/lib/Driver/ToolChains/Hurd.cpp | 8 | ||||
-rw-r--r-- | gnu/llvm/clang/lib/Driver/ToolChains/Hurd.h | 6 | ||||
-rw-r--r-- | gnu/llvm/clang/lib/Driver/ToolChains/Linux.cpp | 5 | ||||
-rw-r--r-- | gnu/llvm/clang/lib/Driver/ToolChains/Linux.h | 4 |
7 files changed, 36 insertions, 14 deletions
diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Darwin.cpp b/gnu/llvm/clang/lib/Driver/ToolChains/Darwin.cpp index 220bc8f9835..46265c1b9f1 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Darwin.cpp +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Darwin.cpp @@ -1146,6 +1146,7 @@ void Darwin::addProfileRTLibs(const ArgList &Args, addExportedSymbol(CmdArgs, "___gcov_flush"); addExportedSymbol(CmdArgs, "_flush_fn_list"); addExportedSymbol(CmdArgs, "_writeout_fn_list"); + addExportedSymbol(CmdArgs, "_reset_fn_list"); } else { addExportedSymbol(CmdArgs, "___llvm_profile_filename"); addExportedSymbol(CmdArgs, "___llvm_profile_raw_version"); diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.cpp b/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.cpp index a55d59cb11b..0ad9ff01a93 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.cpp +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.cpp @@ -309,7 +309,7 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) { } } -static bool getPIE(const ArgList &Args, const toolchains::Linux &ToolChain) { +static bool getPIE(const ArgList &Args, const ToolChain &TC) { if (Args.hasArg(options::OPT_shared) || Args.hasArg(options::OPT_static) || Args.hasArg(options::OPT_r) || Args.hasArg(options::OPT_static_pie)) return false; @@ -317,17 +317,16 @@ static bool getPIE(const ArgList &Args, const toolchains::Linux &ToolChain) { Arg *A = Args.getLastArg(options::OPT_pie, options::OPT_no_pie, options::OPT_nopie); if (!A) - return ToolChain.isPIEDefault(); + return TC.isPIEDefault(); return A->getOption().matches(options::OPT_pie); } -static bool getStaticPIE(const ArgList &Args, - const toolchains::Linux &ToolChain) { +static bool getStaticPIE(const ArgList &Args, const ToolChain &TC) { bool HasStaticPIE = Args.hasArg(options::OPT_static_pie); // -no-pie is an alias for -nopie. So, handling -nopie takes care of // -no-pie as well. if (HasStaticPIE && Args.hasArg(options::OPT_nopie)) { - const Driver &D = ToolChain.getDriver(); + const Driver &D = TC.getDriver(); const llvm::opt::OptTable &Opts = D.getOpts(); const char *StaticPIEName = Opts.getOptionName(options::OPT_static_pie); const char *NoPIEName = Opts.getOptionName(options::OPT_nopie); @@ -346,8 +345,12 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args, const char *LinkingOutput) const { - const toolchains::Linux &ToolChain = - static_cast<const toolchains::Linux &>(getToolChain()); + // FIXME: The Linker class constructor takes a ToolChain and not a + // Generic_ELF, so the static_cast might return a reference to a invalid + // instance (see PR45061). Ideally, the Linker constructor needs to take a + // Generic_ELF instead. + const toolchains::Generic_ELF &ToolChain = + static_cast<const toolchains::Generic_ELF &>(getToolChain()); const Driver &D = ToolChain.getDriver(); const llvm::Triple &Triple = getToolChain().getEffectiveTriple(); @@ -418,8 +421,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA, if (isAndroid) CmdArgs.push_back("--warn-shared-textrel"); - for (const auto &Opt : ToolChain.ExtraOpts) - CmdArgs.push_back(Opt.c_str()); + ToolChain.addExtraOpts(CmdArgs); CmdArgs.push_back("--eh-frame-hdr"); diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.h b/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.h index 083f74c0547..fa50b56bf95 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.h +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Gnu.h @@ -356,6 +356,12 @@ public: void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args, Action::OffloadKind DeviceOffloadKind) const override; + + virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const { + return {}; + } + + virtual void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const {} }; } // end namespace toolchains diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.cpp b/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.cpp index 72166ca9f35..ee91f7d73b9 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.cpp +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.cpp @@ -61,8 +61,7 @@ static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) { return Triple.isArch32Bit() ? "lib" : "lib64"; } -Hurd::Hurd(const Driver &D, const llvm::Triple &Triple, - const ArgList &Args) +Hurd::Hurd(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) : Generic_ELF(D, Triple, Args) { std::string SysRoot = computeSysRoot(); path_list &Paths = getFilePaths(); @@ -170,3 +169,8 @@ void Hurd::AddClangSystemIncludeArgs(const ArgList &DriverArgs, addExternCSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/include"); } + +void Hurd::addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const { + for (const auto &Opt : ExtraOpts) + CmdArgs.push_back(Opt.c_str()); +} diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.h b/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.h index 86c6c3f734d..8f88d7e8e58 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.h +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Hurd.h @@ -27,9 +27,11 @@ public: AddClangSystemIncludeArgs(const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args) const override; - virtual std::string computeSysRoot() const; + std::string computeSysRoot() const; - virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const; + std::string getDynamicLinker(const llvm::opt::ArgList &Args) const override; + + void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override; std::vector<std::string> ExtraOpts; diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Linux.cpp b/gnu/llvm/clang/lib/Driver/ToolChains/Linux.cpp index bff1ab1009b..6532c899492 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Linux.cpp +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Linux.cpp @@ -986,3 +986,8 @@ void Linux::addProfileRTLibs(const llvm::opt::ArgList &Args, Twine("-u", llvm::getInstrProfRuntimeHookVarName()))); ToolChain::addProfileRTLibs(Args, CmdArgs); } + +void Linux::addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const { + for (const auto &Opt : ExtraOpts) + CmdArgs.push_back(Opt.c_str()); +} diff --git a/gnu/llvm/clang/lib/Driver/ToolChains/Linux.h b/gnu/llvm/clang/lib/Driver/ToolChains/Linux.h index f5518eac218..923ebecbd21 100644 --- a/gnu/llvm/clang/lib/Driver/ToolChains/Linux.h +++ b/gnu/llvm/clang/lib/Driver/ToolChains/Linux.h @@ -42,7 +42,9 @@ public: llvm::opt::ArgStringList &CmdArgs) const override; virtual std::string computeSysRoot() const; - virtual std::string getDynamicLinker(const llvm::opt::ArgList &Args) const; + std::string getDynamicLinker(const llvm::opt::ArgList &Args) const override; + + void addExtraOpts(llvm::opt::ArgStringList &CmdArgs) const override; std::vector<std::string> ExtraOpts; |