[CHERRYPICK] BaseTools: Prevent Subsection PCDs from polluting global expressions#1654
Open
PaddyDengAmi wants to merge 1 commit intomicrosoft:release/202511from
Open
Conversation
The PCD value defined in module subsections can be added to global PCD database. Therefore the unsolved expressions, even belongs to the global scope, can incorrectly refer to the value from module subsection. This only happens when the referred PCD has no value assignment in the platform dsc file. Which also should raise an error. Signed-off-by: Paddy Deng <paddydeng@ami.com>
makubacki
approved these changes
Feb 28, 2026
Member
makubacki
left a comment
There was a problem hiding this comment.
Please amend the commit message with the following as the last line in the commit message:
(cherry picked from commit c2915d24a1832138b5f680b31612bf6198adfb5f)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The PCD value defined in module subsections can be added to global PCD database. Therefore the unsolved expressions, even belongs to the global scope, can incorrectly refer to the value from module subsection.
This only happens when the referred PCD has no value assignment in the platform dsc file. Which also should raise an error.
This PR cherry-picks tianocore/edk2#12009
How This Was Tested
Use test code from PaddyDengAmi/edk2@8673d40
Run
test_build.batafter setting up edk2 build environment.Check the produced
build_report.log, the value ofPcdIpmiKcsIoBaseAddressin both HelloWorld.inf instances are polluted bygEfiMdePkgTokenSpaceGuid.PcdIpmiSsifSmbusSlaveAddr|2in the subsection.Compares to
build_report_gPcd.log, which produced byTestPkg_gPcd.dscthat has a proper global value ofPcdIpmiSsifSmbusSlaveAddr, the subsection override ofPcdIpmiSsifSmbusSlaveAddr|2only affects this PCD itself.All value evaluated by
gEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|gEfiMdePkgTokenSpaceGuid.PcdIpmiSsifSmbusSlaveAddrare not affected and correctly refer toPcdIpmiSsifSmbusSlaveAddr|1in global scope.After applying the change of this PR, the build for
TestPkg.dscwill fail due togEfiMdePkgTokenSpaceGuid.PcdIpmiKcsIoBaseAddress|gEfiMdePkgTokenSpaceGuid.PcdIpmiSsifSmbusSlaveAddris referringPcdIpmiSsifSmbusSlaveAddrwhich is not given a default value in this dsc and raising an error:Integration Instructions
N/A