summaryrefslogtreecommitdiff
path: root/BaseTools/Source
AgeCommit message (Collapse)AuthorFilesLines
2 daysBaseTools: Remove UGA supportGuoMinJ2-211/+0
The Universal Graphics Adapter (UGA) is a graphic abstraction. The UGA I/O and Draw protocols are deprecated since UEFI 2.0 was introduced. Cf. the UEFI spec v2.9: "Appendix L - EFI 1.10 Protocol Changes and Deprecation List" section L.2 "Deprecated Protocols" Remove the UGA support. Signed-off-by: GuoMinJ <newexplorerj@gmail.com> Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
3 daysBaseTools: Improve report generation for Nested Fvs.Aaron Pop1-7/+15
Build report would not detect a nested FV if the nested FV was not in a subsection of an FFS statement. Modify the build report to better handle some of the variations of nested FVs. Failing Example: [Fv.FvName1] INF <path to some driver>.inf [Fv.FvName0] FILE FV_IMAGE = B25ACDEF-39CE-4FA5-B50A-33E24DB1BDDF { SECTION FV_IMAGE = FvName1 } Working Example: [Fv.FvName1] INF <path to some driver>.inf [Fv.FvName0] FILE FV_IMAGE = DA04F6BF-A0FD-47EC-928B-5101A6C95026 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { SECTION FV_IMAGE = FvName1 } } Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
7 daysBaseTools: Fix the spelling or typoAbdul Lateef Attar1-1/+2
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
10 daysBaseTools: WorkSpace: Remove unnecessary codePierre Gondois7-144/+0
Running the vulture tool on the WorkSpace folder gave the following report. Remove the unnecessary code. - Workspace/BuildClassObject.py:148: unused method 'IsSimpleTypeArray' (60% confidence) - Workspace/BuildClassObject.py:337: unused method 'SetPcdMode' (60% confidence) - Workspace/BuildClassObject.py:612: unused attribute 'DscSpecification' (60% confidence) - Workspace/DscBuildData.py:451: unused property 'DscSpecification' (60% confidence) - Workspace/DscBuildData.py:1253: unused method 'GetBuildOptionsByPkg' (60% confidence) - Workspace/DscBuildData.py:2064: unused method 'GetStarNum' (60% confidence) - Workspace/DscBuildData.py:3613: unused method 'AddModule' (60% confidence) - Workspace/DscBuildData.py:3650: unused method 'AddPcd' (60% confidence) - Workspace/InfBuildData.py:117: unused attribute '_TailComments' (60% confidence) - Workspace/InfBuildData.py:126: unused attribute '_BinaryModule' (60% confidence) - Workspace/MetaDataTable.py:114: unused method 'IsIntegral' (60% confidence) - Workspace/MetaDataTable.py:218: unused method 'GetFileTimeStamp' (60% confidence) - Workspace/MetaDataTable.py:230: unused method 'SetFileTimeStamp' (60% confidence) - Workspace/MetaDataTable.py:298: unused method 'GetCrossIndex' (60% confidence) - Workspace/MetaFileParser.py:161: unused attribute '_FileDir' (60% confidence) - Workspace/MetaFileParser.py:1187: unused method '_DecodeCODEData' (60% confidence) - Workspace/MetaFileParser.py:1796: unused attribute '_RestofValue' (60% confidence) - Workspace/MetaFileTable.py:31: unused attribute '_NumpyTab' (60% confidence) - Workspace/WorkspaceDatabase.py:136: unused class 'TransformObjectFactory' (60% confidence) - Workspace/WorkspaceDatabase.py:159: unused attribute 'TransformObject' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: UPT/Library: Remove unnecessary codePierre Gondois7-1155/+0
Running the vulture tool on the UPT/Library folder gave the following report. Remove the unnecessary code. - UPT/Library/CommentGenerating.py:50: unused function 'GenGenericComment' (60% confidence) - UPT/Library/CommentGenerating.py:172: unused function 'GenInfPcdTailComment' (60% confidence) - UPT/Library/CommentGenerating.py:185: unused function 'GenInfProtocolPPITailComment' (60% confidence) - UPT/Library/CommentGenerating.py:203: unused function 'GenInfGuidTailComment' (60% confidence) - UPT/Library/Misc.py:504: unused class 'MergeCommentDict' (60% confidence) - UPT/Library/Misc.py:527: unused function 'GenDummyHelpTextObj' (60% confidence) - UPT/Library/ParserValidate.py:110: unused function 'IsValidInfComponentType' (60% confidence) - UPT/Library/ParserValidate.py:122: unused function 'IsValidToolFamily' (60% confidence) - UPT/Library/ParserValidate.py:134: unused function 'IsValidToolTagName' (60% confidence) - UPT/Library/ParserValidate.py:465: unused function 'IsValidBuildNumber' (60% confidence) - UPT/Library/ParserValidate.py:478: unused function 'IsValidDepex' (60% confidence) - UPT/Library/ParserValidate.py:546: unused function 'IsValidVersionString' (60% confidence) - UPT/Library/ParserValidate.py:721: unused function 'CheckUTF16FileHeader' (60% confidence) - UPT/Library/Parsing.py:52: unused function 'GetBuildOption' (60% confidence) - UPT/Library/Parsing.py:100: unused function 'GetLibraryClassOfInf' (60% confidence) - UPT/Library/Parsing.py:150: unused function 'GetPcd' (60% confidence) - UPT/Library/Parsing.py:177: unused function 'GetFeatureFlagPcd' (60% confidence) - UPT/Library/Parsing.py:201: unused function 'GetDynamicDefaultPcd' (60% confidence) - UPT/Library/Parsing.py:227: unused function 'GetDynamicHiiPcd' (60% confidence) - UPT/Library/Parsing.py:254: unused function 'GetDynamicVpdPcd' (60% confidence) - UPT/Library/Parsing.py:277: unused function 'GetComponent' (60% confidence) - UPT/Library/Parsing.py:392: unused function 'GetExec' (60% confidence) - UPT/Library/Parsing.py:416: unused function 'GetComponents' (60% confidence) - UPT/Library/Parsing.py:532: unused function 'GetSource' (60% confidence) - UPT/Library/Parsing.py:581: unused function 'GetGuidsProtocolsPpisOfInf' (60% confidence) - UPT/Library/Parsing.py:595: unused function 'GetGuidsProtocolsPpisOfDec' (60% confidence) - UPT/Library/Parsing.py:645: unused function 'GetPcdOfInf' (60% confidence) - UPT/Library/Parsing.py:682: unused function 'GetPcdOfDec' (60% confidence) - UPT/Library/Parsing.py:739: unused function 'InsertSectionItems' (60% confidence) - UPT/Library/Parsing.py:776: unused function 'GenMetaDatSectionItem' (60% confidence) - UPT/Library/StringUtils.py:87: unused function 'GetLibraryClassesWithModuleType' (60% confidence) - UPT/Library/StringUtils.py:107: unused function 'GetDynamics' (60% confidence) - UPT/Library/StringUtils.py:350: unused function 'GetMultipleValuesOfKeyFromLines' (60% confidence) - UPT/Library/StringUtils.py:396: unused function 'GetSingleValueOfKeyFromLines' (60% confidence) - UPT/Library/StringUtils.py:463: unused function 'PreCheck' (60% confidence) - UPT/Library/StringUtils.py:675: unused function 'StringArrayLength' (60% confidence) - UPT/Library/StringUtils.py:718: unused function 'IsHexDigit' (60% confidence) - UPT/Library/UniClassObject.py:86: unused function 'UniToStr' (60% confidence) - UPT/Library/UniClassObject.py:227: unused attribute 'StringNameByteList' (60% confidence) - UPT/Library/UniClassObject.py:237: unused attribute 'StringNameByteList' (60% confidence) - UPT/Library/UniClassObject.py:377: unused method 'GetIncludeFile' (60% confidence) - UPT/Library/UniClassObject.py:947: unused method 'FindStringValue' (60% confidence) - UPT/Library/UniClassObject.py:957: unused method 'FindByToken' (60% confidence) - UPT/Library/UniClassObject.py:1022: unused method 'ReadIncludeUNIfile' (60% confidence) - UPT/Library/StringUtils.py:718: unused function 'IsHexDigit' (60% confidence) - UPT/Library/Xml/XmlRoutines.py:176: unused function 'XmlElementList' (60% confidence) - UPT/Library/Xml/XmlRoutines.py:202: unused function 'XmlNodeName' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: UPT/Xml: Remove unnecessary codePierre Gondois1-1/+0
Running the vulture tool on the UPT/Xml folder gave the following report. Remove the unnecessary code. - UPT/Xml/CommonXml.py:585: unused attribute 'LangDefsList' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: UPT/PomAdapter: Remove unnecessary codePierre Gondois1-47/+0
Running the vulture tool on the UPT/PomAdapter folder gave the following report. Remove the unnecessary code. - UPT/PomAdapter/DecPomAlignment.py:898: unused method 'ShowPackage' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: UPT/Parser: Remove unnecessary codePierre Gondois3-72/+0
Running the vulture tool on the UPT/Parser folder gave the following report. Remove the unnecessary code. - UPT/Parser/InfAsBuiltProcess.py:223: unused function 'GetInfsFromWorkSpace' (60% confidence) - UPT/Parser/InfAsBuiltProcess.py:237: unused function 'GetGuidVerFormLibInstance' (60% confidence) - UPT/Parser/InfParserMisc.py:211: unused attribute 'InfPeiDepexSection' (60% confidence) - UPT/Parser/InfParserMisc.py:212: unused attribute 'InfDxeDepexSection' (60% confidence) - UPT/Parser/InfParserMisc.py:213: unused attribute 'InfSmmDepexSection' (60% confidence) - UPT/Parser/InfSectionParser.py:231: unused attribute 'InfPeiDepexSection' (60% confidence) - UPT/Parser/InfSectionParser.py:232: unused attribute 'InfDxeDepexSection' (60% confidence) - UPT/Parser/InfSectionParser.py:233: unused attribute 'InfSmmDepexSection' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: Table: Remove unnecessary codePierre Gondois3-36/+0
Running the vulture tool on the Table folder gave the following report. Remove the unnecessary code. - Table/Table.py:88: unused method 'GenerateID' (60% confidence) - Table/TableDataModel.py:83: unused method 'GetCrossIndex' (60% confidence) - Table/TableEotReport.py:66: unused method 'GetMaxID' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: GenFds: Remove unnecessary codePierre Gondois6-63/+0
Running the vulture tool on the GenFds folder gave the following report. Remove the unnecessary code. - GenFds/Fd.py:146: unused method 'GenFlashMap' (60% confidence) - GenFds/FdfParser.py:1539: unused attribute 'BaseAddressPcd' (60% confidence) - GenFds/FdfParser.py:1556: unused attribute 'SizePcd' (60% confidence) - GenFds/FdfParser.py:2394: unused attribute 'CurrentLineNum' (60% confidence) - GenFds/FdfParser.py:2395: unused attribute 'CurrentLineContent' (60% confidence) - GenFds/FdfParser.py:2653: unused attribute 'CurrentLineNum' (60% confidence) - GenFds/FdfParser.py:2654: unused attribute 'CurrentLineContent' (60% confidence) - GenFds/FdfParser.py:3229: unused attribute 'CreateFile' (60% confidence) - GenFds/FfsFileStatement.py:36: unused attribute 'CurrentLineNum' (60% confidence) - GenFds/FfsFileStatement.py:37: unused attribute 'CurrentLineContent' (60% confidence) - GenFds/FfsInfStatement.py:68: unused attribute 'CurrentLineNum' (60% confidence) - GenFds/FfsInfStatement.py:69: unused attribute 'CurrentLineContent' (60% confidence) - GenFds/GenFds.py:68: unused attribute 'LibDir' (60% confidence) - GenFds/GenFds.py:557: unused method 'GetFvBlockSize' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: FMTT: Remove unnecessary codePierre Gondois4-51/+1
Running the vulture tool on the FMTT folder gave the following report. Remove the unnecessary code. - FMMT/core/BinaryFactoryProduct.py:132: unused attribute 'ROffset' (60% confidence) - FMMT/core/BinaryFactoryProduct.py:176: unused attribute 'ROffset' (60% confidence) - FMMT/core/BinaryFactoryProduct.py:229: unused attribute 'ROffset' (60% confidence) - FMMT/core/BinaryFactoryProduct.py:365: unused class 'ElfSectionProduct' (60% confidence) - FMMT/core/BinaryFactoryProduct.py:369: unused method 'ParserSectionData' (60% confidence) - FMMT/core/BinaryFactoryProduct.py:371: unused method 'ParserProgramData' (60% confidence) - FMMT/core/BiosTree.py:76: unused method 'insertRel' (60% confidence) - FMMT/core/BiosTree.py:84: unused method 'deleteNode' (60% confidence) - FMMT/core/BiosTreeNode.py:63: unused attribute 'ROffset' (60% confidence) - FMMT/core/BiosTreeNode.py:125: unused attribute 'ROffset' (60% confidence) - FMMT/core/BiosTreeNode.py:182: unused attribute 'ROffset' (60% confidence) - FMMT/core/BiosTreeNode.py:185: unused attribute 'SectionMaxAlignment' (60% confidence) - FMMT/core/BiosTreeNode.py:220: unused attribute 'ROffset' (60% confidence) - FMMT/core/BiosTreeNode.py:223: unused attribute 'OriHeader' (60% confidence) - FMMT/core/BiosTreeNode.py:226: unused attribute 'SectionMaxAlignment' (60% confidence) - FMMT/core/BiosTreeNode.py:247: unused attribute 'ROffset' (60% confidence) - FMMT/FMMT.py:52: unused attribute 'firmware_packet' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: Eot: Remove unnecessary codePierre Gondois7-308/+0
Running the vulture tool on the Eot folder gave the following report. Remove the unnecessary code. - Eot/CodeFragment.py:47: unused class 'AssignmentExpression' (60% confidence) - Eot/CodeFragmentCollector.py:75: unused attribute '__Token' (60% confidence) - Eot/CodeFragmentCollector.py:76: unused attribute '__SkippedChars' (60% confidence) - Eot/CodeFragmentCollector.py:104: unused method '__EndOfLine' (60% confidence) - Eot/CodeFragmentCollector.py:129: unused method '__UndoOneChar' (60% confidence) - Eot/CodeFragmentCollector.py:215: unused method '__InsertComma' (60% confidence) - Eot/Database.py:81: unused attribute 'text_factory' (60% confidence) - Eot/EotMain.py:1012: unused method 'SetFreeSpace' (60% confidence) - Eot/Identification.py:36: unused method 'GetFileFullPath' (60% confidence) - Eot/Identification.py:43: unused method 'GetFileRelativePath' (60% confidence) - Eot/Parser.py:119: unused function 'AddToGlobalMacro' (60% confidence) - Eot/Parser.py:238: unused function 'GetAllSourceFiles' (60% confidence) - Eot/Parser.py:257: unused function 'ParseConditionalStatementMacros' (60% confidence) - Eot/Parser.py:267: unused function 'GetAllFiles' (60% confidence) - Eot/Parser.py:291: unused function 'ParseConditionalStatement' (60% confidence) - Eot/Parser.py:367: unused function 'GetConditionalStatementStatus' (60% confidence) - Eot/Parser.py:722: unused function 'ConvertGuid' (60% confidence) - Eot/Parser.py:857: unused function 'ConvertGuid2' (60% confidence) - Eot/Report.py:161: unused method 'GeneratePpi' (60% confidence) - Eot/Report.py:173: unused method 'GenerateProtocol' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: Ecc: Remove unnecessary codePierre Gondois5-200/+0
Running the vulture tool on the Ecc folder gave the following report. Remove the unnecessary code. - Ecc/c.py:52: unused function 'GetConfig' (60% confidence) - Ecc/c.py:484: unused function 'GetFileModificationTimeFromDB' (60% confidence) - Ecc/CodeFragmentCollector.py:77: unused attribute '__Token' (60% confidence) - Ecc/CodeFragmentCollector.py:78: unused attribute '__SkippedChars' (60% confidence) - Ecc/CodeFragmentCollector.py:109: unused method '__EndOfLine' (60% confidence) - Ecc/CodeFragmentCollector.py:134: unused method '__UndoOneChar' (60% confidence) - Ecc/CodeFragmentCollector.py:221: unused method '__InsertComma' (60% confidence) - Ecc/CodeFragmentCollector.py:539: unused method 'PrintFragments' (60% confidence) - Ecc/Database.py:81: unused attribute 'text_factory' (60% confidence) - Ecc/Database.py:214: unused method 'UpdateIdentifierBelongsToFunction_disabled' (60% confidence) - Ecc/MetaFileWorkspace/MetaDataTable.py:142: unused method 'IsIntegral' (60% confidence) - Ecc/MetaFileWorkspace/MetaDataTable.py:205: unused method 'GetCrossIndex' (60% confidence) - Ecc/Xml/XmlRoutines.py:145: unused function 'XmlElementData' (60% confidence) - Ecc/Xml/XmlRoutines.py:162: unused function 'XmlElementList' (60% confidence) - Ecc/Xml/XmlRoutines.py:192: unused function 'XmlNodeName' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: Capsule: Remove unnecessary codePierre Gondois1-5/+0
Running the vulture tool on the Capsule folder gave the following report. Remove the unnecessary code. - Capsule/WindowsCapsuleSupportHelper.py:26: unused method 'RegisterHelpers' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: build: Remove unnecessary codePierre Gondois2-85/+0
Running the vulture tool on the build folder gave the following report. Remove the unnecessary code. - build/build.py:79: unused function 'IsToolInPath' (60% confidence) - build/build.py:396: unused class 'PlatformMakeUnit' (60% confidence) - build/build.py:570: unused method 'GetErrorMessage' (60% confidence) - build/build.py:806: unused attribute 'HashSkipModules' (60% confidence) - build/build.py:807: unused attribute 'Db_Flag' (60% confidence) - build/build.py:1048: unused attribute 'Db_Flag' (60% confidence) - build/build.py:2500: unused method 'GetRealPathOfTool' (60% confidence) - build/BuildReport.py:1497: unused method 'StrtoHex' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: AutoGen: Remove unnecessary codePierre Gondois8-126/+0
Running the vulture tool on the AutoGen folder gave the following report. Remove the unnecessary code. - AutoGen/BuildEngine.py:333: unused attribute 'SupportedToolChainFamilyList' (60% confidence) - AutoGen/BuildEngine.py:346: unused attribute '_RuleObjectList' (60% confidence) - AutoGen/GenMake.py:450: unused attribute 'FileBuildTargetList' (60% confidence) - AutoGen/GenMake.py:452: unused attribute 'PendingBuildTargetList' (60% confidence) - AutoGen/GenMake.py:458: unused attribute 'LibraryBuildCommandList' (60% confidence) - AutoGen/GenMake.py:459: unused attribute 'LibraryFileList' (60% confidence) - AutoGen/GenMake.py:462: unused attribute 'SystemLibraryList' (60% confidence) - AutoGen/GenMake.py:1168: unused method 'GetFileDependency' (60% confidence) - AutoGen/GenMake.py:1466: unused attribute 'ModuleBuildCommandList' (60% confidence) - AutoGen/GenPcdDb.py:442: unused class 'DbSkuHeadTableItemList' (60% confidence) - AutoGen/GenVar.py:31: unused attribute 'VpdRegionOffset' (60% confidence) - AutoGen/GenVar.py:43: unused attribute 'VpdRegionOffset' (60% confidence) - AutoGen/ModuleAutoGen.py:257: unused attribute 'FileDependCache' (60% confidence) - AutoGen/ModuleAutoGen.py:684: unused method 'BuildOptionIncPathList' (60% confidence) - AutoGen/PlatformAutoGen.py:994: unused method 'EdkBuildOption' (60% confidence) - AutoGen/UniClassObject.py:171: unused attribute 'StringNameByteList' (60% confidence) - AutoGen/UniClassObject.py:181: unused attribute 'StringNameByteList' (60% confidence) - AutoGen/UniClassObject.py:366: unused method 'GetIncludeFile' (60% confidence) - AutoGen/UniClassObject.py:606: unused method 'FindStringValue' (60% confidence) - AutoGen/UniClassObject.py:616: unused method 'FindByToken' (60% confidence) - AutoGen/ValidCheckingInfoObject.py:228: unused attribute 'ValidData' (60% confidence) - AutoGen/ValidCheckingInfoObject.py:231: unused attribute 'ValidData' (60% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: Remove unreachable codePierre Gondois4-37/+0
Running the vulture tool gave the following report. Remove the unreachable code. - TargetTool/TargetTool.py:49: unreachable code after 'raise' (100% confidence) - UPT/Library/UniClassObject.py:137: unreachable code after 'return' (100% confidence) - UPT/Object/Parser/InfDefineObject.py:795: unreachable code after 'if' (100% confidence) - Ecc/Check.py:1504: unreachable code after 'return' (100% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
10 daysBaseTools: Remove unused importPierre Gondois12-12/+0
Running the vulture tool gave the following report. Remove the unused import. - BPDG/BPDG.py:21: unused import 'encodings' (90% confidence) - build/build.py:61: unused import 'Manager' (90% confidence) - Ecc/CParser4/CLexer.py:4: unused import 'TextIO' (90% confidence) - Ecc/CParser4/CParser.py:5: unused import 'TextIO' (90% confidence) - Eot/CParser4/CLexer.py:4: unused import 'TextIO' (90% confidence) - Eot/CParser4/CParser.py:5: unused import 'TextIO' (90% confidence) - Eot/EotMain.py:28: unused import 'ConvertGuid' (90% confidence) - GenFds/FdfParser.py:16: unused import 'hexdigits' (90% confidence) - Table/TableEotReport.py:16: unused import 'EotToolError' (90% confidence) - UPT/Library/CommentGenerating.py:19: unused import 'USAGE_ITEM_NOTIFY' (90% confidence) - UPT/Library/ParserValidate.py:18: unused import 'COMPONENT_TYPE_LIST' (90% confidence) - UPT/Library/UniClassObject.py:25: unused import 'CheckUTF16FileHeader' (90% confidence) Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-06-24BaseTools/GetFw: Skip R_X86_64_NONE relocationsMichael D Kinney1-0/+12
Building .aslc files in a module for host-based unit testing in Linux/GCC X64 environments may introduce relocations for a symbol in a shared library from lcov or asan. Update logic to not generate an error message and exit if the symbol is unknown but the relocation type is R_X86_64_NONE. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-06-07BaseTools: Add support for mingw-w64Nate DeSimone14-106/+518
Adds support for building the C language BaseTools for Windows using toolchains based on mingw-w64. Mingw-w64 is a collection of header files, libraries, and tools that when combined with a compiler enable development of Windows software. Mingw-w64 is a fork of the original MinGW (Minimalist GNU for Windows). Most active development on MinGW has ceased and mingw-w64 is now the actively maintained successor. Mingw-w64 provides a libc implementation built on top of Microsoft's UCRT (Universal C Runtime) with all nessesary compiler bindings needed to support the C++11 feature set. Modern mingw-w64 development appears to have coalesced around MSYS2, which produces a distributions of both GCC and LLVM/Clang that use mingw-w64 to target the Windows OS. This MSYS2 Clang distribution has a UNIX-like directory layout and includes Windows binaries of GNU Make. Combined with the open source licensing, MSYS2's Clang distribution is a highly attractive choice as an alternative Windows SDK for open source projects such as TianoCore. If one wishes to use EDK II to build UEFI firmware on the Windows platform, then the C BaseTools need to be compiled as Windows applications. This includes the PcdValueInit.exe program, which needs to be recompiled every time a firmware build is run in order to regenerate the initial values for structured PCDs. Currently, BaseTools only supports the Visual C++ toolchain on the Windows platform. The following new features have been added to enable usage of the toolchains derived from mingw-w64: - Fixes to the BaseTools C source code to support the use of a GCC-style compiler on the Windows OS. - The GNU Make-style Makefiles for the C BaseTools have been modified to support Windows. Both GCC + mingw-w64 and Clang + mingw-w64 have been tested and confirmed to build a working BaseTools. - BaseTools now supports generating GNU Make-style Makefiles on the Windows platform for the purpose of building firmware. - edksetup.bat has been modified to optionally build BaseTools via mingw-w64. There is no impact to the existing support for Visual C++ and Visual C++ remains the default toolchain. Usage Instructions: For the vast majority of users, the only system setup change nessesary to use a mingw-w64 toolchain is to set the BASETOOLS_MINGW_PATH to the directory containing the desired mingw-w64 based toolchain. A new command line argument has been added to edksetup.bat: Mingw-w64 If this command line argument is set, then the script will set the BASETOOLS_MINGW_BUILD environment variable. The user can also opt to set this environment variable manually before running edksetup.bat If BASETOOLS_MINGW_BUILD is defined, then the BASETOOLS_MINGW_PATH environment variable must point to the directory containing the mingw-w64 toolchain. If CLANG_BIN is not defined and %BASETOOLS_MINGW_PATH%\bin\clang.exe exists, then edksetup.bat will set CLANG_BIN=%BASETOOLS_MINGW_PATH%\bin\ This removes the requirement to configure the CLANG_BIN environment variable manually in order to run a CLANGPDB or CLANGDWARF build if one has the MSYS2 Clang distribution installed. If one wishes to use a different copy of Clang (for example official LLVM binaries) to build firmware and only use the MSYS2 Clang to build BaseTools, then one can continue to set the CLANG_BIN environment variable, same as before. I have tested the MSYS2 Clang distribution against the official LLVM distribution and can confirm that if the compiler version is the same the emitted machine code is identical between the two. Interestingly, the MSYS2 Clang distribution emits the path to the PDB file using "/" as the path seperator instead of "\". That appears to be the only difference in output. Therefore, using the MSYS2 Clang distribution to compile firmware seems a reasonable choice. If CLANG_HOST_BIN is not defined and BASETOOLS_MINGW_BUILD is defined and %BASETOOLS_MINGW_PATH%\bin\mingw32-make.exe exists, then edksetup.bat will add %BASETOOLS_MINGW_PATH%\bin\ to the PATH and set CLANG_HOST_BIN=mingw32- This enable usage of the GNU Make included in the mingw-w64 toolchain to build firmware in addition to BaseTools. if BASETOOLS_MINGW_BUILD is not defined, edksetup.bat will continue to set CLANG_HOST_BIN=n, which uses nmake to build firmware. This behavior can be overridden by manually setting the value of CLANG_HOST_BIN before executing edksetup.bat if one wishes to use a specific Make utility for the CLANGPDB/CLANGDWARF toolchains. References: - https://www.mingw-w64.org/ - https://www.msys2.org/ Co-authored-by: Sandesh Jain <sandesh.jain@intel.com> Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2025-05-28BaseTools: Add GUID section for build reportZhiguang Liu1-2/+7
Add GUID section for build report. Also, change the GUID format to string format to be easier to parse Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2025-05-26BaseTools: Update CParser4 to import TextIO from typingRebecca Cran4-4/+4
In Python 3.13 typing.io no longer exists. Instead, import TextIO from typing. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-05-09BaseTools: Fix Macro Expansion on Machine Architecture for ComponentsNate DeSimone1-3/+4
BaseTools currently does not expand macros for component architecture when nested !include directives are used. This breaks use cases like [Component.$(DXE_ARCH)]. The fix is to add explicit macro expansion when computing the Arch value for component lines in DscParser. Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2025-04-28BaseTools: Add support for GCC preprocessor line directivesNate DeSimone1-1/+2
This change adds support for GCC-style preprocessor line directives as documented in: https://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html On Windows systems, one can use line-markers to see which .vfr file was used to generate a *.i file in the Build directory. This is useful for debugging VFR compilation failures. With this change, the VfrCompiler will not generate compilation errors if the *.i file contains GCC-style line-markers. Without this change, one must disable the pre-processor's emission of line-markers, removing the debug aid they provide. Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2025-04-14BaseTools:Expression.py Adding a check for missing '}' in the parserpg/proximity_domain_reworkDoug Flick1-1/+1
This check is to catch cases where a missing '}' exists in a dec or dsc file. Signed-off-by: Doug Flick <dougflick@microsoft.com>
2025-04-14BaseTools:Expression.py Add Assertion for PCD with value {}Doug Flick1-0/+2
This adds an assertion to the PCD class in the Expression.py file to check for zero-byte PCDs. Signed-off-by: Doug Flick <dougflick@microsoft.com>
2025-04-14BaseTools:Expression.py Size used before InitDoug Flick1-1/+1
The following example fails to be parsed correctly due to Size being used in the outer scope but initialized in the inner scope ``` gPlatformPkgTokenSpaceGuid.PcdSecureBootDbxBinaryFile|{} ``` Problematic code: ```python for Item in NewPcdValueList: Size = 0 # .... if Size > 0: PcdValue = '{' + ', '.join(AllPcdValueList) + '}' ```` Signed-off-by: Doug Flick <dougflick@microsoft.com>
2025-04-11BaseTools: Fix FMMT Compress wrong behaviorYuwei Chen1-1/+1
When using the replace function, if the replaced file located in a compress section, then the tool will re-build the section. As the compress status set in the wrong place, in some situation, the compress will do twice times which is a wrong behavior. This patch is used to fix this issue. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Ashraf Ali S <ashraf.ali.s@intel.com> Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
2025-04-08BaseTools: Dump library dependency chain on build failureRay Ni1-2/+14
When a module M depends on L1, which depends on L2, which depends on L3, the build fails when the library instance of L3 cannot be found according to the library class-instance mapping configuration specified in the DSC file. When such failure happens, the build tool only prints that the instance of L3 required by module M cannot be found. But it does not tell how L3 is required by M. The change enhances build tool to print the entire dependency chain when such failure happens. With the change, the new error message will be as follows: <dsc-path>(...): error 4000: Instance of library class [L3] is not found for module [M], [L3] is: consumed by <instance of L2> consumed by <instance of L1> Signed-off-by: Ray Ni <ray.ni@intel.com>
2025-03-31BaseTools/build: Reduce special FV full to warningMichael D Kinney1-3/+12
If an FV_SPARE_SPACE_THRESHOLD is enabled and an FV is 100% full with 0 bytes free, then this is likely a special FV that may have alignment requirements for the FFS file for both the start address and the length and the FFS file consumes all the available FV space. Reduce FV_SPARE_SPACE_THRESHOLD from an error to a warning if this FV 0 bytes free condition is detected. PR #10828 introduced the generation of these error conditions for an FV with large alignment requirements. The pad region before the aligned FFS file used to be counted as free space even though it could never be used due to the alignment requirements. There was actually no free space available. PR #10828 fixed the free space calculation to properly show it as 0 bytes free, and this change then caused build error when FV_SPARE_SPACE_THRESHOLD feature was enabled. The reduction to a warning for this condition allows the build to complete with errors and also provides a build log warning message for review. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-03-26BaseTools/FMMT: Fix GUID Tool Not Found the Shell Script IssueJason1 Lin1-3/+3
- FMMT tool would use the "PATH" environment variable for locating the required GUID tool. - On Windows-like system, batch file not found in the "PATH" environment variable when "shell=False". - This issue required commands to include program extensions or absolute paths. - This patch sets "shell=True" to extend the support for batch files, including scripts in BinWrappers under BaseTools. - Converted input commands from lists to strings to ensure proper argument interpretation in POSIX-like shell scripts. Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
2025-03-25BaseTools: Fix missing module PCD in compile information of build reportZhiguang Liu1-1/+1
Module PCD in compile information is missed in module_report.json Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2025-03-22BaseTools/GenFv: Ensure the minimum pad file size for the FV with VTFPhil Noh1-14/+29
In case of the FV with VTF, the left size should be enough to add the minimum pad file size (EFI_FFS_FILE_HEADER, 0x18). It prevents the build error, "GenFv: ERROR 0006: invalid FFS file header checksum" caused by the pad file overwriting some header data in VTF. This includes these updates for CalculateFvSize() function. 1. If NumBlocks is not defined, ensure the minimum pad file size for the left size (if the pad file is required as VTF is not bottom aligned at end of block, insert EFI_FFS_FILE_HEADER to ensure the pad file size) 2. If NumBlocks is defined, report more clear error message (the required fv image size = 0x%x. the set fv image size = 0x%x. Free space left is not enough to add a pad file (0x18)) 3. Remove MaxPadFileSize, which is reported when the taken size is same as the total size. It can not be the actual left size to add an FFS file. It causes confusion when referring to the build log (FV Space Information) Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2025-03-12BaseTools/Source/C: Disable VS flexible array member warningMichael D Kinney1-1/+8
Add /wd4200 to all visual studio builds of C tools in BaseTools. This disables warnings for use of flexible array members that are allowed in edk2 include files. Some tools use include files from MdePkg that use flexible array members. This matches the warning disables used to build structured PCD in BaseTools/Source/Python/Workspace/DscBuildData.py where flexible array members are more widely used. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-02-04BaseTools: Add @verbatim as allowed Doxygen tagRebecca Cran2-2/+2
Per the discussion in https://github.com/tianocore/edk2/pull/6476, update Ecc code to allow the @verbatim Doxygen tag. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-02-02BaseTools/AutoGen: GenMake response file quotes stringsMichael D Kinney1-3/+14
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>
2025-01-31BaseTools/Pccts: set C standardGerd Hoffmann2-2/+2
The prehistoric code base doesn't build with ISO C23. Set the C standard to C11 (for both clang and gcc) so it continues to build with gcc 15 (which uses C23 by default). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2025-01-27BaseTools: Fix NoneType parent reference in FMMT operationsAshraf Ali S1-3/+12
This patch addresses an issue in the FMMT operations where the parent reference is not checked for NoneType. This oversight can lead to an AttributeError: 'NoneType' object has no attribute 'Name' when attempting to access the parent reference. The fix involves adding a check for NoneType before accessing the parent reference to ensure that the operations handle such cases gracefully. The affected functions include: - AddNewFfs - ReplaceFfs - ExtractFfs These functions now include proper checks to prevent the AttributeError. Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
2025-01-09BaseTools: Clean up os.path.normcase and os.path.normpath usageYang Gang5-12/+12
Refer to the docs of python, `os.path.normcase(path)` function: "Normalize the case of a pathname. On Windows, convert all characters in the pathname to lowercase, and also convert forward slashes to backward slashes. On other operating systems, return the path unchanged." `os.path.normpath(path)` also convert forward slashes to backward slashes. So call `os.path.normcase` after `os.path.normpath` just convert path to lowercase on Windows(only). And Windows is case-insensitive but case-preserving. So the usage of `os.path.normcase(os.path.normpath(path))` can be simplified to `os.path.normpath(path)`. Then we can use case-preserving paths rather than lowercase paths in compile_commands.json file or build log. But this patch continue to use `os.path.normcase` when comparing/searching paths. Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2024-12-24Remove dependancy on re.TAshraf Ali1-1/+0
Signed-off-by: Ashraf Ali <ashraf.ali.s@intel.com>
2024-12-20BaseTools: Support custom library build for base tools on Linux ARMkuqin126-6/+36
This change added the build script to cross compile the base tool binaries for Linux ARM/AARCH64 systems. The needed libuuid system library is pulled from source file and rebuilt to support the corresponding library dependencies. Individual tools' makefiles are also updated to link the cross compiled library as well. The EDK2 base tool build script was also updated to support such change. This was tested functional on Linux ARM host system. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2024-12-20BaseTools: Adding cross compilation of BaseTool for Windows ARM/ARM64Kun Qin3-6/+26
This change adds the support of crossbuilding basetool for Windows ARM/ ARM64 systems, which will enable the generally available pipeline agents to build binary tools and make releases as they see fit. The EDK2 base tools build script is also updated to support cross compilation using this script. The crossbuilt binary output is tested on Windows ARM based hardware systems. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2024-12-20BaseTools: Adding support of building BaseTool on Windows ARM/ARM64kuqin127-0/+29
This change focuses on the support of building basetool natively for Windows ARM/ARM64 host system, which will enable the ARM based platforms to build UEFI and unit tests. Note that the warnings due to integer conversions are suppressed for this specific target to avoid too much local changes carried in MU. The formal change should drop all these binaries and move to pythonic scripts. The binary output is tested on Windows ARM based hardware systems. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2024-12-11BaseTools: Typo fixesDionna Glaze6-15/+13
Some in error messages, some in local variable names. Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
2024-12-06BaseTools: Improve error messages from UefiCapsuleHeader.pyRebecca Cran1-2/+2
Instead of throwing ValueErrors with no explanation, add a message explaining what went wrong. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-10-23BaseTools/GenFw X64: Detect GOTCPRELX relaxations applied by LLDArd Biesheuvel1-1/+10
GenFw relies on static ELF relocation tables emitted by the linker (via the --emit-relocs command line switch). These are different from the dynamic relocations that a dynamic loader uses: static relocations are emitted by the compiler/assembler, and consumed by the linker to construct the executable. Only when the load address is a priori unknown are dynamic relocations emitted, by the linker, in a format that the dynamic loader can consume. This distinction is relevant because only dynamic relocations cover the GOT, and so GOT based indirections are better avoided. Unfortunately, there are cases where the toolchain insists on emitting GOT based symbol references, and so we have to deal with them in one of 2 ways: - replace GOT based symbol references with direct references, so that the GOT entries themselves are no longer used, and can be ignored when generating the PE/COFF relocation tables (AARCH64 and RISCV64 take this approach); - infer the locations of the GOT slots from the references appearing in the code, and emit PE/COFF relocations for them so that their contents will be fixed up appropriately. The latter is the approach taken by GenFw for x86_64, which is the only feasible approach for its ISA, given that GOT slots can be used as memory operands in many different types of instructions, not all of which can be converted straight-forwardly. E.g., movq foo@GOTPCREL(%rip), %rax can always be converted into leaq foo(%rip), %rax whereas cmpq foo@GOTPCREL(%rip), %rax can only be converted under the 32-bit position dependent code model, into cmpq $foo, %rax and so the GOT references cannot be elided when generating position independent code, which is what GenFw requires. To remove the need for the linker to guess where the instructions start, the ELF psABI for x86_64 specifies a couple of relaxable alternatives for GOTPCREL, which are used to annotate particular classes of GOT referencing instructions that may be relaxed to their non-GOT counterparts. There is no specification for what --emit-relocs is supposed to produce, or whether or not its output is supposed to reflect such relaxations. ld.bfd and LLD behave differently in this regard, and the latter may emit R_X86_64_REX_GOTPCRELX relocations for MOV instructions that it already has relaxed into LEA instructions. This means the displacement in the instruction no longer refers to the GOT slot, but directly to the object itself, and emitting a relocation is not only unnecessary, but also harmful as the PE/COFF loader will corrupt the object when it applies the relocations at startup. Under the position independent code model, the only relaxation that the linker could have applied for a R_X86_64_REX_GOTPCRELX relocation is MOV to LEA, so detect whether the instruction is already LEA, and ignore the relocation if that is the case. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2024-09-27BaseTools: Fix redefinition of UINT8_MAX in Decompress.c on XCODE5Mike Beaton1-0/+2
This is part of a sequence of commits to restore build on the XCODE5 toolchain. The definition is required on other toolchains, but on XCODE5 results in a macro redefined error (from the existing value 255) from /usr/include/stdint.h. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-23BaseTools: Fix multiple 'invalid escape sequence' warnings in testsMike Beaton18-72/+72
In Python 3.12 invalid escape sequences in strings moved from DeprecationWarning to SyntaxWarning (ref https://docs.python.org/3/whatsnew/changelog.html#python-3-12-0-final and search for gh-98401). In a future Python version this will become SyntaxError. Multiple instances of these SyntaxWarnings are currently printed when running the BaseTools tests using Python 3.12 (though without actually failing the affected tests). This commit updates all lines which were causing this type of warning. Typical examples which needed fixing are: - "BaseTools\Source\Python" representing a path: "\S" and "\P" are invalid escape sequences, therefore left unchanged, therefore the test works (with a warning in Python 3.12). r"BaseTools\Source\Python" represents the same string, but with escapes turned off completely thus no warning. - Where '\t\s' is used as a regex pattern, then chr(9) + '\\s' is sent to the regex parser (with a warning in Python 3.12) since '\s' is not a valid Python escape sequence. This works correctly, though arguably for the wrong reasons. r'\t\s' sends the same as '\\t\\s', as originally intended and with no warning. (Note that ' and " are not fundamentally different in Python.) Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-20BaseTools: Update RETURN_ERROR Macro in BaseTypes.hAbdul Lateef Attar1-1/+3
This patch is to sync RETURN_ERROR macro with the MdePkg/Include/Base.h Ref: 1a89d9887f MdePkg:Update Return Error Macro in Base.h Fixing RETURN_ERROR macro. It is causing problem in Coverity Static analysis tool as we are directly converting the UINT value to INTN. Changing value from UINT to INTN might cause problema Here we know that the values would not be in loss of data. To increase the code quality and increase the static tool analysis score we have to change it Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2024-09-13BaseTools: Update Stack Cookie LogicTaylor Beebe3-1/+54
This patch updates the GenC logic to generate a random stack cookie value for the stack check libraries. These random values improve security for modules which cannot update the global intrinsics. If the stack cookie value is randomized in the AutoGen.h file each build, the build system will determine the module/library must be rebuilt causing effectively a clean build every time. This also makes binary reproducibility impossible. This patch updates the early build scripts to create 32 and 64-bit JSON files in the build output directory which each contain 100 randomized stack cookie values for each bitwidth. If the JSON files are already present, then they are not recreated which allows them to be stored and moved to other builds for binary reproducibility. Because they are in the build directory, a clean build will cause the values to be regenerated. The logic which creates AutoGen.h will read these JSON files and use a hash of the module GUID (the hash seed is fixed in Basetools) to index into the array of stack cookie values for the module bitwidth. This model is necessary because there isn't thread-consistent data so we cannot use a locking mechanism to ensure only one thread is writing to the stack cookie files at a time. With this model, the build threads only need to read from the files. Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>