Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Unified Diff: lib/Driver/Tools.cpp

Issue 1208073002: [MIPS] Add support for direct-to-nacl in Clang (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-clang.git@master
Patch Set: Updated change. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/Driver/ToolChains.cpp ('k') | test/Driver/nacl-direct.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Driver/Tools.cpp
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index fb8e8721e37d74bc7603a398163221f689721fb9..567fd8cf92b2f83afb05454f749646ee28a8f3ca 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -1229,6 +1229,13 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v));
A->claim();
}
+
+ // @LOCALMOD-BEGIN
+ if (Triple.getOS() == llvm::Triple::NaCl) {
+ CmdArgs.push_back("-mllvm");
+ CmdArgs.push_back("-direct-to-nacl");
+ }
+ // @LOCALMOD-END
}
/// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
@@ -8058,6 +8065,8 @@ void nacltools::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("armelf_nacl");
else if (ToolChain.getArch() == llvm::Triple::x86_64)
CmdArgs.push_back("elf_x86_64_nacl");
+ else if (ToolChain.getArch() == llvm::Triple::mipsel)
+ CmdArgs.push_back("mipselelf_nacl");
else
D.Diag(diag::err_target_unsupported_arch) << ToolChain.getArchName() <<
"Native Client";
@@ -8122,6 +8131,13 @@ void nacltools::Link::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_pthread) ||
Args.hasArg(options::OPT_pthreads) ||
D.CCCIsCXX()) {
+ // Gold, used by Mips, handles nested groups differently than ld, and
+ // without '-lnacl' it prefers symbols from libpthread.a over libnacl.a,
+ // which is not a desired behaviour here.
+ // See https://sourceware.org/ml/binutils/2015-03/msg00034.html
+ if (getToolChain().getArch() == llvm::Triple::mipsel)
+ CmdArgs.push_back("-lnacl");
+
CmdArgs.push_back("-lpthread");
}
@@ -8132,6 +8148,13 @@ void nacltools::Link::ConstructJob(Compilation &C, const JobAction &JA,
else
CmdArgs.push_back("-lgcc_s");
CmdArgs.push_back("--no-as-needed");
+
+ // Mips needs to create and use pnacl_legacy library that contains
+ // definitions from bitcode/pnaclmm.c and definitions for
+ // __nacl_tp_tls_offset() and __nacl_tp_tdb_offset().
+ if (getToolChain().getArch() == llvm::Triple::mipsel)
+ CmdArgs.push_back("-lpnacl_legacy");
+
CmdArgs.push_back("--end-group");
}
« no previous file with comments | « lib/Driver/ToolChains.cpp ('k') | test/Driver/nacl-direct.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698