From c8062ec623d90f7a6740156f7020a7f7b5ee6be8 Mon Sep 17 00:00:00 2001 From: Ray Ni Date: Fri, 13 Feb 2026 11:44:59 +0800 Subject: [PATCH] IntelFsp2Pkg/PatchFv: Fix _IMAGE_BASE__ not exist with CLANG Commit 677baf5b4a adds a pseudo symbol _IMAGE_BASE__ 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 Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Cc: Ted Kuo Cc: Ashraf Ali S --- IntelFsp2Pkg/Tools/PatchFv.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/IntelFsp2Pkg/Tools/PatchFv.py b/IntelFsp2Pkg/Tools/PatchFv.py index e8c3712a29..d0ae397f8c 100644 --- a/IntelFsp2Pkg/Tools/PatchFv.py +++ b/IntelFsp2Pkg/Tools/PatchFv.py @@ -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__ + 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__ - self.dictVariable['_IMAGE_BASE_%s_' % moduleName] = self.dictModBase['%s:BASE' % moduleName] return 0 #