IntelFsp2Pkg/PatchFv: Fix _IMAGE_BASE_<module>_ not exist with CLANG

Commit 677baf5b4a adds a pseudo symbol _IMAGE_BASE_<module>_ for image base.
But it contains a bug that when CLANG toolchain is used the pseudo symbol
does not exist.
The patch fixes the issue.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
This commit is contained in:
Ray Ni 2026-02-13 11:44:59 +08:00 committed by mergify[bot]
parent 3c61d7e081
commit c8062ec623

View file

@ -384,6 +384,10 @@ class Symbols:
if len(modName) == 36:
modName = self.dictGuidNameXref[modName.upper()]
self.dictModBase['%s:BASE' % modName] = int (match.group(2), 16)
# Support pseudo symbol for image base: _IMAGE_BASE_<moduleName>_
self.dictVariable['_IMAGE_BASE_%s_' % modName] = int (match.group(2), 16)
self.dictModBase['%s:ENTRY' % modName] = int (match.group(3), 16)
#(GUID=86D70125-BAA3-4296-A62F-602BEBBB9081 .textbaseaddress=0x00fffb4398 .databaseaddress=0x00fffb4178)
match = re.match(r"\(GUID=([A-Z0-9\-]+)\s+\.textbaseaddress=(0x[0-9a-fA-F]+)\s+\.databaseaddress=(0x[0-9a-fA-F]+)\)", rptLine)
@ -490,8 +494,6 @@ class Symbols:
if not fullSym in self.dictSymbolAddress:
self.dictSymbolAddress[fullSym] = "0x00%08x" % (baseOffset+ int(modSymbols[symbol], 16))
# Support pseudo symbol for image base: _IMAGE_BASE_<moduleName>_
self.dictVariable['_IMAGE_BASE_%s_' % moduleName] = self.dictModBase['%s:BASE' % moduleName]
return 0
#