qmake/msbuild: Support all /LTCG:xxx options

/LTCG:OFF now turns off LTCG.
/LTCG:INCREMENTAL maps to UseFastLinkTimeCodeGeneration.
Unknown /LTCG:xxx values are passed to AdditionalOptions.

Pick-to: 5.15 6.2 6.3 6.4
Task-number: QTBUG-104450
Change-Id: If85942dbeec204dc2571a861a43201cb3d5993ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2022-06-21 13:57:38 +02:00
parent 73e1bc09e6
commit 566ede6ee1
3 changed files with 24 additions and 17 deletions

View File

@ -1064,6 +1064,8 @@ static inline QString toString(optLinkTimeCodeGenType option)
break;
case optLTCGEnabled:
return "UseLinkTimeCodeGeneration";
case optLTCGIncremental:
return "UseFastLinkTimeCodeGeneration";
case optLTCGInstrument:
return "PGInstrument";
case optLTCGOptimize:

View File

@ -1567,24 +1567,28 @@ bool VCLinkerTool::parseOption(const char* option)
case 0x0d745c8: // /LIBPATH:dir
AdditionalLibraryDirectories += option+9;
break;
case 0x0341877: // /LTCG[:NOSTATUS|:STATUS]
config->WholeProgramOptimization = _True;
if (config->CompilerVersion >= NET2005) {
LinkTimeCodeGeneration = optLTCGEnabled;
if(*(option+5) == ':') {
const char* str = option+6;
if (*str == 'S')
ShowProgress = linkProgressAll;
else if (qstricmp(str, "pginstrument") == 0)
LinkTimeCodeGeneration = optLTCGInstrument;
else if (qstricmp(str, "pgoptimize") == 0)
LinkTimeCodeGeneration = optLTCGOptimize;
else if (qstricmp(str, "pgupdate") == 0)
LinkTimeCodeGeneration = optLTCGUpdate;
}
} else {
AdditionalOptions.append(option);
case 0x0341877: // /LTCG[:{INCREMENTAL|NOSTATUS|STATUS|OFF}]
// /LTCG:{PGINSTRUMENT|PGOPTIMIZE|PGUPDATE}
LinkTimeCodeGeneration = optLTCGEnabled;
if (*(option + 5) == ':') {
const char* str = option + 6;
if (qstricmp(str, "status") == 0)
ShowProgress = linkProgressAll;
else if (qstricmp(str, "off") == 0)
LinkTimeCodeGeneration = optLTCGDefault;
else if (qstricmp(str, "incremental") == 0)
LinkTimeCodeGeneration = optLTCGIncremental;
else if (qstricmp(str, "pginstrument") == 0)
LinkTimeCodeGeneration = optLTCGInstrument;
else if (qstricmp(str, "pgoptimize") == 0)
LinkTimeCodeGeneration = optLTCGOptimize;
else if (qstricmp(str, "pgupdate") == 0)
LinkTimeCodeGeneration = optLTCGUpdate;
else
AdditionalOptions.append(option);
}
if (LinkTimeCodeGeneration != optLTCGDefault)
config->WholeProgramOptimization = _True;
break;
case 0x379ED25:
case 0x157cf65: // /MACHINE:{AM33|ARM|CEE|IA64|X86|M32R|MIPS|MIPS16|MIPSFPU|MIPSFPU16|MIPSR41XX|PPC|SH3|SH4|SH5|THUMB|TRICORE}

View File

@ -331,6 +331,7 @@ enum optWin98Type {
enum optLinkTimeCodeGenType {
optLTCGDefault,
optLTCGEnabled,
optLTCGIncremental,
optLTCGInstrument,
optLTCGOptimize,
optLTCGUpdate