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.

Task-number: QTBUG-104450
Change-Id: If85942dbeec204dc2571a861a43201cb3d5993ae
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 566ede6ee169e87addab38ec64e527e76bc475e9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Joerg Bornemann 2022-06-21 13:57:38 +02:00 committed by Qt Cherry-pick Bot
parent ce89c4a3d5
commit cea5b65149
3 changed files with 24 additions and 17 deletions

View File

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

View File

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

View File

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