BaseTools/AutoGen: GenMake response file quotes strings

If command line options are moved into a response file
of a GCC family build, then the file path separators are
converted from '\' to '/'. However, this can corrupt
command line options that are quoted strings.

Update GenMake to no convert '\' to '/' in quoted strings.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael D Kinney 2025-01-29 20:35:38 -08:00 committed by mergify[bot]
parent 15a7d311a8
commit 62b0698309

View File

@ -899,9 +899,20 @@ cleanlib:
break
if self._AutoGenObject.ToolChainFamily == 'GCC':
RespDict[Key] = Value.replace('\\', '/')
else:
RespDict[Key] = Value
#
# Replace '\' with '/' in the response file.
# Skip content within "" or \"\"
#
ValueList = re.split(r'("|\\"|\s+)', Value)
Skip = False
for i, v in enumerate(ValueList):
if v in ('"', '\\"'):
Skip = not Skip
elif not Skip:
ValueList[i] = v.replace('\\', '/')
Value = ''.join(ValueList)
RespDict[Key] = Value
for Target in BuildTargets:
for i, SingleCommand in enumerate(BuildTargets[Target].Commands):
if FlagDict[Flag]['Macro'] in SingleCommand: