From 560aef612087dec6e72620aaa579fdf0b94df515 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 16 Jan 2012 11:44:58 +0000 Subject: [PATCH] *ide: Fix in msc builder for huge number of linked files (thanks Massimo) git-svn-id: svn://ultimatepp.org/upp/trunk@4427 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Builders/MscBuilder.icpp | 47 +++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/uppsrc/ide/Builders/MscBuilder.icpp b/uppsrc/ide/Builders/MscBuilder.icpp index 83b3447c7..24f1e69d4 100644 --- a/uppsrc/ide/Builders/MscBuilder.icpp +++ b/uppsrc/ide/Builders/MscBuilder.icpp @@ -314,8 +314,8 @@ bool MscBuilder::BuildPackage(const String& package, Vector& linkfile, S c = cc_speed; int slot = AllocSlot(); if(slot < 0 || !Run(c + PdbPch(package, slot, !sContainsPchOptions(cc) && !sContainsPchOptions(soptions[i])) - + " " + soptions[i] + (ext ".c" ? " -Tc " : " -Tp ") - + GetHostPathQ(fn) + " -Fo" + GetHostPathQ(objfile), slot, GetHostPath(objfile), 1)) + + " " + soptions[i] + (ext == ".c" ? " -Tc " : " -Tp ") + + GetHostPathQ(fn) + " -Fo" + GetHostPathQ(objfile), slot, GetHostPath(objfile), 1)) execerr = true; } if(execerr) @@ -373,9 +373,10 @@ bool MscBuilder::BuildPackage(const String& package, Vector& linkfile, S Vector objinfo = host->GetFileInfo(obj); for(int i = 0; i < obj.GetCount(); i++) if(objinfo[i] > producttime) { - String lib; + String linker, lib; if(is_shared) { - lib << LinkerName() << " -dll -nologo -machine:" << MachineName() + linker << LinkerName() << "-dll -nologo "; + lib << "-machine:" << MachineName() << " -pdb:" << GetHostPathQ(ForceExt(product, ".pdb")) << " -out:" << GetHostPathQ(product); if(!HasFlag("MSC10") && !HasFlag("MSC10X64")) @@ -435,7 +436,7 @@ bool MscBuilder::BuildPackage(const String& package, Vector& linkfile, S } } else{ - lib << (HasFlag("INTEL") ? "xilib" : "link /lib") << " -nologo"; + linker << (HasFlag("INTEL") ? "xilib" : "link /lib") << " -nologo "; if(HasFlag("FORCE_SIZE")){ if(sContainsPchOptions(release_size_options)) lib << " -ltcg"; @@ -451,7 +452,41 @@ bool MscBuilder::BuildPackage(const String& package, Vector& linkfile, S PutConsole("Creating library..."); IdeConsoleEndGroup(); DeleteFile(product); - if(Execute(lib)) { + String tmpFileName; + if(linker.GetCount() + lib.GetCount() >= 8192) + { + tmpFileName = GetTempFileName(); + // we can't simply put all data on a single line + // as it has a limit of around 130000 chars too, so we split + // in multiple lines + FileOut f(tmpFileName); + while(lib != "") + { + int found = 0; + bool quotes = false; + int lim = min(8192, lib.GetCount()); + for(int i = 0; i < lim; i++) + { + char c = lib[i]; + if(isspace(c) && !quotes) + found = i; + else if(c == '"') + quotes = !quotes; + } + if(!found) + found = lib.GetCount(); + f.PutLine(lib.Left(found)); + lib.Remove(0, found); + } + f.Close(); + linker << "@" << tmpFileName; + } + else + linker << lib; + bool res = Execute(linker); + if(tmpFileName != "") + FileDelete(tmpFileName); + if(res) { DeleteFile(product); return false; }