- Str is not being used in FvHeader.py
- Removed import of ast.Str as it was removed in Python 3.14.
- Ensures compatibility with Python 3.14 and later.
- https://docs.python.org/3/whatsnew/3.14.html#id9
This addresses ImportError caused by removal of deprecated AST classes
including ast.Str.
Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
Building the C BaseTools using Clang on a Windows system that has the Python
interpreter installed to a path that contains spaces (for example
C:\Program Files\Python314\python.exe) currently fails.
This change adds quoting to fix that issue.
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Update GCC linker script to always keep .prmexportdescriptor
sections and merge them into the .data section.
The .prmexportdescriptor section is only used by PRM modules
for the PRM Export Descriptor Structure that must be kept
in the final image to support adding the PRM Export
Descriptor Structure and its associated PRM Handlers APIs
to a PE/COFF DLL Export section.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Add --image-version option that takes a version value
of the form MMMM.mmmm where MMMM and mmmm are decimal
values < 65536. The MMMM and mmmm values are used to
set the PE/COFF optional header fields MajorImageVersion
and MinorImageVersion.
If MMMM or mmmm are larger than 65535, then generate
Error() condition.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
When --prm is specified, a search for the symbol with the
name PRM_MODULE_EXPORT_DESCRIPTOR_NAME is performed. If
the symbol is not found, then GENFW generates an exception
due to a loop with a terminal count of -1.
Update logic to not search for PRM Handler symbols if the
PRM_MODULE_EXPORT_DESCRIPTOR_NAME was not found and add
an Error() message when --prm is specified and
PRM_MODULE_EXPORT_DESCRIPTOR_NAME was not found.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Currently the FMMT tool supports CRC32 GUID section (Ref. GuidTools.py).
But it is found that there are errors for the FV with CRC32 section.
For example, the errors are checked on the following commands.
--v : Show FV information except for the FV
--a : Show "Target Fv not found!!!" when adding an FFS file to the FV
--d : Show "Target Ffs not found!!!" when deleting an FFS file in the FV
They are caused by the mismatch for CRC32 section data between the FMMT
and GenCrc32 tools. The FMMT tool returns CRC32 section data without CRC
checksum field (4 bytes). The GenCrc32 tool (with -d option, verify CRC32
value for the input file) requires CRC32 section data including CRC
checksum field (4 bytes).
Fix the issue through adjusting the section data to include CRC checksum
field. Currently DataOffset field for CRC32 GUID section is reported as
0x1C differently (GUID Section header length: 0x18 + Checksum field: 0x4).
Instead of DataOffset field that includes CRC checksum field, configure
the section data based on the offset from section header length (0x18)
that was previously calculated. This update enables GUID sections to use
the same offset consistently.
Signed-off-by: Phil Noh <Phil.Noh@amd.com>
Set BUILD_TIME_EPOCH to the current UTC timestamp if not already present
in the environment.
Use the resulting value to print the "Build start time:" message.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
The function CheckEnvVariable in fact checks several environment
variables. And the comment at its invocation enumerates a specific set of
variables, which defeats half the point of abstracting it out into a
helper function.
Rename the function to the plural form and turn the comment into a list
of examples.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Update HostBasedUnitTestRunner to generate merged Cobertura
coverage.xml output file using CLANG code coverage data
from -fprofile-instr-generate -fcoverage-mapping options.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 code from BaseTools.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Update the CLANGPDB toolchain to define the __GNUC__, __GNUC_MINOR__,
__GNUC_PATCHLEVEL__, and __MINGW32__ macros with values that match the
pre-defined values seen when using the x86_64-unknown-windows-gnu target
triple. This minimizes the differences in pre-processor macros between the
CLANGPDB and CLANGDWARF targets.
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Update build rules to split C file rules from C++ file
rules and introduce CXX_FLAGS to provide compiler options
that are only used to compile C++ files.
This is required because the compiler options to specify
the C++ standard generate errors when used to compile
C files.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Remove -nostdlib and -nostdlibinc from CC_FLAGS for CLANG
builds to support using CLANGPDB and CLANGDWARF for modules
of type HOST_APPLICATION that require use of standard C libs.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
All ASM files are processed using PP_FLAGS that includes
AutoGen.h. Remove redundant -imacros AutoGen.h option from
GCC_ASM_FLAGS. This also removes warnings generated in
CLANG builds when an ASM file is processed and an
AutoGen.h file is not present.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Update ASLCC_FLAGS in tools_def.template too provide all
the options required to compile ACPI Table source files
without any dependencies on CC_FLAGS. This allows CC_FLAGS
to only be used to compile C source files and for
ASLCC_FLAGS to only be used to compile ACPI Tables source
files.
No changes are required for the MSFT or XCODE tool chain
families. Only the GCC tool chain family requires updates
to the ASLCC_FLAGS in tools_def.template along with updates
to build_rule.template to not use CC_FLAGS for ACPI Table
rules.
This change is required to avoid use of ASAN and code
coverage flags when building ACPI Table source files that
break CLANGDWARF builds of ACPI Table source files.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
* Add CLANGDWARF support to USER_DEFINED module type rules.
* Add CLANGDWARF support to HOST_APPLICATION module type rules.
* Add missing -c option to CLANGPDB HOST_APPLICATION module
type rules
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
The register keyword was deprecated in C++11 and removed in C++17,
which causes multiple compiler warnings when building VfrCompile:
"ISO C++17 does not allow ‘register’ storage class specifier".
Resolve the warnings by removing instances of register keyword.
Signed-off-by: Vishal Oliyil Kunnil <vishalo@qti.qualcomm.com>
Subject Check was added to PatchCheck.py to enforce that if a package
was touched in a commit that it be referenced in the subject line.
However, this is impractical for multipackage commits with many
packages, e.g. when stack cookies were added, every package was
touched, but in a rote way, and it is not reasonable to put every
package in a subject line.
This updates PatchCheck.py to check if ignore_multi_package is set
and if so only require that package names be included in the subject
if there are fewer than 3 packages touched. Otherwise, PatchCheck will
require the message to start with `Global:` to indicate it touches
more than 3 packages.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
PatchCheck.py currently parses the CI options as the last
step it does before reporting results. This means that the
other checking logic cannot use any of the CI options that
are passed in.
This updates the order of operations to process CI options
before running other checks so that they can be used in
performing checks.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
- Remove IPF since it's no longer supported in edk2.
- Rename AArch64 to AARCH64 for greater accuracy.
- Add newly supported RISCV64 and LOONGARCH64.
Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
Commit f0a2015373 ("UefiPayloadPkg: Add AARCH64 support") changed
`[Components.X64]` to `[Components.X64, Components.AARCH64]` which
resulted in the following code within that section to not work as
expected (the code wasn't there, just providing a real world example
that uncovered the issue):
[Components.X64, Components.AARCH64]
FmpDevicePkg/FmpDxe/FmpDxe.inf {
...
<PcdsFixedAtBuild>
!include .../...PcdFmpDevicePkcs7CertBufferXdr.inc
...
}
At the same time `[Components.X64]` or even `[Components.AARCH64,
Components.X64]` (notice the swapped order) worked fine for X64 target.
The cause of the issue turned out to be skipping includes inside
`_PostProcess()` method of `DscParser` class. This method processes
list of items stored in a database filled on the first pass through a
DSC file in `Start()` method. One of the fields stored in each row
of a table is link to a parent object (owner). A section like
`[Components.X64, Components.AARCH64]` creates two objects and all of
its subelements are duplicated for both X64 and AARCH64. This was not
happening for !include statement in the example above.
Because `_PostProcess()` contracted a sequence of !include objects
disregarding their owner, it did not create instance for each of the
requested targets. Codewise, `self._ContentIndex` was incremented more
than once, while `__ProcessDirective()` method (invoked indirectly as
`Processer[self._ItemType]()`) queried owner of the current directive
as:
if self._InSubsection:
Owner = self._Content[self._ContentIndex - 1][8]
else: # not taken in this case
This is why order of targets made a difference, only the last was fully
initialized in this case.
An alternative fix is completely dropping merging of !include
directives, but hard to say whether it still has some utility (the code
is complex, hard to follow and barely documented). Safer to keep it, in
the worst case it doesn't do anything now.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
It's illegal that string default is numeric type in vfr string definition.
This patch add a check to the illegal behavior. If numeric string default
is encountered, throw a invalid parameter error to break VfrCompile.
Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
When using the FMMT FvHandler function, new padding size
should be calculated correctly comparing with origin ffs
and new ffs, else it will cause the binary size changes.
This patch is used to fix the bug.
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Add -fno-omit-frame-pointer to RISC-V targets to ensure frame pointers
are preserved, supporting stack backtraces for debugging.
Signed-off-by: Tuan Phan <tphan@ventanamicro.com>
Commit a257988f59 added -Wl,-z,notext, but
only when linking for IA32/X64 with LLD.
BFD can also be configured to either warn or error when text relocations
are detected. It does not check at all by default, but Gentoo Linux
tells it to warn in its regular configuration and tells it to error in
its hardened configuration.
Commit 14cb48b0a0 made linker warnings
fatal in all BFD cases. At least the AARCH64 and IA32/X64 code does
include text relocations, so this now fails to build on Gentoo Linux.
We should therefore always use -Wl,-z,notext.
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
These haven't been used since before 2d07607d8b,
when UNIXGCC support was dropped.
The recent change in 14cb48b0a0 to make
linker warnings fatal was therefore ineffective for these architectures.
As requested, also make linker warnings fatal for GCC5 only. The last
release made them fatal for AARCH64 on GCC48/GCC49, but it seems likely
no one has actually tested that yet.
Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
If IASL_PREFIX is not already defined, then edksetup.bat should set it.
This unifies the behavior between Visual Studio and Mingw-w64.
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Update the CLANGPDB toolchain configuration to use MSVC ABI targets and
retain frame pointers in generated code. This improves compatibility with
the Microsoft Debug Interface Access (DIA) SDK and improves debuggability
with any debugger that uses the Microsoft PDB parser, for example the Visual
Studio debugger or windbg.
Without these changes, code generated by the Clang compiler will have a mix
of calling conventions. With the current configuration, any function declared
with EFIAPI will use the Microsoft x64 calling convention. However, the default
calling convention will be the SysV x64 calling convention. This mixing of
calling conventions prevents debuggers from decoding the call stack.
With these changes, only the Microsoft x64 calling convention will be used.
These modifications enable debuggers to properly parse and
display call stacks on binaries built with the CLANGPDB toolchain.
The changes include:
- Switch from GNU ABI target (*-unknown-windowsl-gnu) to MSVC ABI targets
(*-pc-windows-msvc) for both IA32 and X64 architectures.
- Remove -fseh-exceptions as not supported.
- Add -fno-omit-frame-pointer as required for call stack.
- Undefine the _MSC_VER macro, and define the __GNUC__ macro, so that
pre-processor conditionals will continue to function as expected.
Co-authored-by: Muhammad Mustafa <muhammad.mustafa@intel.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
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>
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>
Commit b55530ad44
("BaseTools/PatchCheck.py: verify commit message lists package(s)")
introduced a check for the requirement to enumerate all modified packages
in the commit subject line. But it did leave the maximum line length at
75 characters (for non-CVE commits), which can get a bit cramped for
changes to several packages.
Introduce a new arbitrary "at least 20 characters after the :" limit.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Use a temporary variable for max subject line length and log
result of test in one location.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Before doing the subject line length check, the script checks that the
number of lines in the commit message (including subject) is not less
than or equal to zero - and returns if it is.
However, then the test for whether the subject line starts with a CVE
tag inexplicably also checks for whether the number of lines are
greater than or equal to one. This is just clutter, so drop it.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
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>
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>
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>