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

Unified Diff: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/NaClLink.cs

Issue 69343013: [VS AddIn] Fix default library paths. (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 1 month 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
Index: visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/NaClLink.cs
diff --git a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/NaClLink.cs b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/NaClLink.cs
index 61cd7f679497cf734bb4dcb19749511671cc03c9..4c7f480b04128b104962224d458270f940fd91b9 100644
--- a/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/NaClLink.cs
+++ b/visual_studio/NativeClientVSAddIn/NaCl.Build.CPPTasks/NaClLink.cs
@@ -77,17 +77,36 @@ namespace NaCl.Build.CPPTasks
}
responseFileCmds.Append("-Wl,--end-group ");
- responseFileCmds.Append(xamlParser.Parse(Sources[0], false));
+ responseFileCmds.Append(xamlParser.Parse(Sources[0], false, IsPNaCl() ? ".bc" : null));
return responseFileCmds.ToString();
}
+ private static string PexeToBC(string pexe)
+ {
+ return Path.ChangeExtension(pexe, ".bc");
+ }
+
private static string PexeToNexe(string pexe, string arch)
{
string basename = Path.GetFileNameWithoutExtension(pexe) + "_" + arch + ".nexe";
return Path.Combine(Path.GetDirectoryName(pexe), basename);
}
+ private bool Finalize()
+ {
+ string dirname = Path.GetDirectoryName(GenerateFullPathToTool());
+ string finalize = Path.Combine(dirname, "pnacl-finalize.bat");
+ string cmd = String.Format("\"{0}\" -o \"{1}\"", PexeToBC(OutputFile), OutputFile);
+ if (!OutputCommandLine)
+ Log.LogMessage("pnacl-finalize -> {0}", Path.GetFileName(OutputFile));
+
+ if (ExecuteTool(finalize, cmd, string.Empty) != 0)
binji 2013/11/19 21:57:16 You could do just return ExecuteTool(...) == 0;
Sam Clegg 2013/11/19 23:21:24 Done.
+ return false;
+
+ return true;
+ }
+
private bool Translate(string arch, string pnacl_arch=null)
{
if (pnacl_arch == null)
@@ -102,17 +121,19 @@ namespace NaCl.Build.CPPTasks
Log.LogMessage("pnacl-translate -> {0}", Path.GetFileName(outfile));
if (ExecuteTool(translateTool, cmd, string.Empty) != 0)
- {
return false;
- }
return true;
}
public override bool Execute()
{
- if (!OutputCommandLine)
- Log.LogMessage("Linking: {0}", Path.GetFileName(OutputFile));
+ if (!OutputCommandLine) {
+ string filename = OutputFile;
+ if (IsPNaCl())
+ filename = PexeToBC(OutputFile);
+ Log.LogMessage("Linking: {0}", filename);
+ }
if (!base.Execute())
return false;
@@ -128,6 +149,9 @@ namespace NaCl.Build.CPPTasks
{
if (IsPNaCl())
{
+ if (!Finalize())
+ return false;
+
if (TranslateX64 && !Translate("64", "x86-64"))
return false;
@@ -180,14 +204,6 @@ namespace NaCl.Build.CPPTasks
}
else
{
- if (ToolchainName == "glibc")
- {
- string bindir = Path.GetDirectoryName(NaClLinkerPath);
- string tcroot = Path.GetDirectoryName(bindir);
- cmd += " -D \"" + Path.Combine(bindir, "x86_64-nacl-objdump.exe") + "\"";
- cmd += " -L \"" + Path.Combine(tcroot, "x86_64-nacl", "lib") + "\"";
- cmd += " -L \"" + Path.Combine(tcroot, "x86_64-nacl", "lib32") + "\"";
- }
cmd += " \"" + OutputFile + "\"";
}
@@ -195,9 +211,7 @@ namespace NaCl.Build.CPPTasks
Log.LogMessage("CreateNMF -> {0}", Path.GetFileName(nmfPath));
if (ExecuteTool("python", string.Empty, cmd) != 0)
- {
return false;
- }
}
return true;
@@ -206,9 +220,7 @@ namespace NaCl.Build.CPPTasks
protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
{
if (OutputCommandLine)
- {
Log.LogMessage(MessageImportance.High, pathToTool + " " + responseFileCommands + " " + commandLineCommands);
- }
return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
}

Powered by Google App Engine
This is Rietveld 408576698