ENH: Support object lists longer than 128K on MSVC
We use response files to list object files for the MSVC linker. The linker complains if any response file is greater than 128K, so we split the object file lists into multiple response files.
This commit is contained in:
parent
07454a39f1
commit
9c29a72fbc
|
@ -1634,14 +1634,35 @@ cmMakefileTargetGenerator
|
||||||
this->WriteObjectsVariable(variableName, variableNameExternal);
|
this->WriteObjectsVariable(variableName, variableNameExternal);
|
||||||
if(useResponseFile)
|
if(useResponseFile)
|
||||||
{
|
{
|
||||||
std::string objects;
|
// MSVC response files cannot exceed 128K.
|
||||||
this->WriteObjectsString(objects);
|
std::string::size_type const responseFileLimit = 131000;
|
||||||
std::string objects_rsp =
|
|
||||||
this->CreateResponseFile("objects.rsp", objects, makefile_depends);
|
// Construct the individual object list strings.
|
||||||
buildObjs = "@";
|
std::vector<std::string> object_strings;
|
||||||
buildObjs += this->Convert(objects_rsp.c_str(),
|
this->WriteObjectsStrings(object_strings, responseFileLimit);
|
||||||
cmLocalGenerator::NONE,
|
|
||||||
cmLocalGenerator::SHELL);
|
// Write a response file for each string.
|
||||||
|
const char* sep = "";
|
||||||
|
for(unsigned int i = 0; i < object_strings.size(); ++i)
|
||||||
|
{
|
||||||
|
// Number the response files.
|
||||||
|
char rsp[32];
|
||||||
|
sprintf(rsp, "objects%u.rsp", i+1);
|
||||||
|
|
||||||
|
// Create this response file.
|
||||||
|
std::string objects_rsp =
|
||||||
|
this->CreateResponseFile(rsp, object_strings[i], makefile_depends);
|
||||||
|
|
||||||
|
// Separate from previous response file references.
|
||||||
|
buildObjs += sep;
|
||||||
|
sep = " ";
|
||||||
|
|
||||||
|
// Reference the response file.
|
||||||
|
buildObjs += "@";
|
||||||
|
buildObjs += this->Convert(objects_rsp.c_str(),
|
||||||
|
cmLocalGenerator::NONE,
|
||||||
|
cmLocalGenerator::SHELL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(useLinkScript)
|
else if(useLinkScript)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue