Commit Graph

2932 Commits

Author SHA1 Message Date
Leif Lindholm 14bf2cb411 BaseTools: drop tautological warning overrides for CLANGDWARF
The CLANGDWARF profile sets both -Wno-tautological-compare and
-Wno-tautological-constant-out-of-range-compare, but this prevents
compile-time detection of certain errors.
Drop these flags.

Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
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>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-08-29 12:24:01 +00:00
Joey Vagedes fa789cc68a BaseTools: scan Edk2ToolsBuild.py make output
Adds edk2_logging.scan_compiler_output() to Edk2ToolsBuild.py to catch
some compilation errors and log them as an error.

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: Joey Vagedes <joeyvagedes@gmail.com>

Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-08-02 15:20:47 +00:00
Joey Vagedes 5cadb8ce21 BaseTools: BinToPcd: Resolve xdrlib deprecation
Removes the dependency on xdrlib and replaces it with custom logic to
pack a per the xdr requirements. Necessary as xdrlib is being deprecated
in python 3.13.

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>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Joey Vagedes <joeyvagedes@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-08-02 05:23:00 +00:00
Sunil V L 3f49462558 BaseTools/tools_def: Add CLANGDWARF support for RISC-V
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4478

Add tools_def definitions to support CLANGDWARF toolchain
for RISC-V. This uses clang and the llvm LLD linker. This
helps people by not requiring to install multiple
cross compilers for different architectures.

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>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Ard Biesheuvel <ardb@kernel.org> # Debian clang version 14.0.6
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-07-31 12:37:12 +00:00
Sunil V L 1a39bdf2c5 BaseTools/tools_def: Add "-fno-unwind-tables" to GCC5_RISCV64_CC_FLAGS
gcc-13 for RISC-V enables unwind tables by default similar to ARM64.
This generates .eh_frame_hdr section which is not handled well by
GenFw causing failures.

Disable the unwind tables by adding -fno-unwind-tables flag similar
to [1].

[1] - https://github.com/tianocore/edk2/commit/cbf00651eda6

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
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>
Cc: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-27 18:20:06 +00:00
Gerd Hoffmann 1df6658bcb BaseTools: remove duplicate includes: IndustryStandard/*.h
Use the MdePkg versions instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann 6101bd125a BaseTools: remove duplicate includes: IndustryStandard/PeImage.h
Use the MdePkg version instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann c15941a643 BaseTools: switch from EFI_IMAGE_MACHINE_* to IMAGE_FILE_MACHINE_*
Use the newer versions of the machine #defines.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann fdc6288f81 BaseTools: drop IMAGE_FILE_MACHINE_ARM hacks
The #define for IMAGE_FILE_MACHINE_ARM is not present in MdePkg,
this looks like a relic not used any more.  Remove.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann 26d6ef38e7 BaseTools: remove duplicate includes: IndustryStandard/Acpi*.h
Use the MdePkg version instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann 69ac88cabd BaseTools: remove duplicate includes: <arch>/ProcessorBind.h
Use the MdePkg version instead of maintaining a copy in BaseTools.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann 6a07d9cacf BaseTools: remove WinNtInclude.h
Appears to be a relic for ancient windows / compiler versions,
windows builds in CI work just fine without it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann bd035a066f BaseTools: add -fdirect-access-external-data to clang pie builds
Tell clang to not use external (via got) references for data access.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-06-01 10:53:35 +00:00
Gerd Hoffmann 7ffc433c2e BaseTools: make sure the got is empty
Add ASSERT()s that .got and .got.plt sections are empty
to linker scripts for gcc and clang.

Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-06-01 10:53:35 +00:00
Gua Guo 0f8323b44b BaseTools: toolsetup.bat always execute PYTHON_HOME
Ideally behavior is like below order that can support one local build
machine, clone multiple Edk2, some of edk2 repo use old tag and
some of edk2 repo use new tag, they can both support on one machine.

1. if defined PYTHON_COMMAND only
   - use PYTHON_COMMAND = user assigned
2. if not defined PYTHON_COMMAND, auto detect py -3
   - use PYTHON_COMMAND = py -3
3. if defined PYTHON_COMMAND and PYTHON_HOME, use PYTHON_COMMAND
   - use PYTHON_COMMAND = user assigned
4. if defined PYTHON_HOME only,
   - use PYTHON_COMMAND = %PYTHON_HOME%/python.exe

SCRIPT_ERROR should return for paraent batch file to consume
for error handle.

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: Gua Guo <gua.guo@intel.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-05-29 01:34:28 +00:00
Ard Biesheuvel d322557712 BaseTools/tools_def: Disable overzealous unused variable warning on Clang
The warnings Clang emits when enabling -Wunneeded-internal-declaration
(which is part of -Wall) are generating false positives for variables
whose size gets taken but are not referenced beyond yet.

This may happen legitimately in debug code, so let's disable this
warning for Clang, rather than tiptoe around it in the code.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2023-05-12 13:12:35 +00:00
Ard Biesheuvel e2607d3a78 BaseTools/tools_def: Drop ref to undefined CLANGDWARF_ARM_PREFIX
When using CLANGDWARF to build for the ARM architecture, objcopy is
references via the wrong environment variable, resulting in the wrong
llvm-objcopy to be used (if one exists), or the build to fail (if
CLANGDWARF_BIN points to the only available instance)

So use CLANGDWARF_BIN instead, which was what was intended.

Fixes: ecbc394365 ("BaseTools: Set CLANGDWARF RC path ...")
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-05-12 13:12:35 +00:00
Gua Guo 6dd64168ed BaseTools/Plugin: Too many execute files cause "cmd too long" failure
Windows command prompt have 8191 characters limitation,
enhance it to make command too long can be resloved.

Provide an example, if have too many cov files, it causes to run single
command over the 8191 characters limitation.
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  ...
>  --input_coverage=NNN.cov

The solution is passing many coverage files in single command line to
breaking it up into many command lines with one coverage file per
command line in order to prevent single line is over to 8191 characters.

- Command Line 1
> OpenCppCoverage
>  --export_type binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=AAA.cov
>  --input_coverage=coverage.cov
...

- Command Line N
> OpenCppCoverage
>  --export_type. binary:coverage.cov
>  --working_dir={workspace}Build
>  --input_coverage=NNN.cov
>  --input_coverage=coverage.cov

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
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: Gua Guo <gua.guo@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-11 05:45:51 +00:00
Rebecca Cran 77f75c7fb8 BaseTools: Update Tests/TestTools.py to allow it to work on Windows
On Windows, executables have a '.exe' suffix which needs to be added for
them to be found in a path.

Also, files need to be explicitly opened as binary.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2023-05-11 02:14:12 +00:00
Rebecca Cran b9bbb4ae93 BaseTools: only print the environment once in toolsetup.bat
Avoid printing %PATH% twice: move the printing of the environment down
to print_python_info.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2023-05-11 02:14:12 +00:00
Rebecca Cran dd246227d6 BaseTools: Update toolsetup.bat to not use BASETOOLS_PYTHON_SOURCE
The BASETOOLS_PYTHON_SOURCE environment variable is only used temporarily to
set PYTHONPATH. Since it doesn't help improve clarity, remove it.

While here, make sure we set PYTHONPATH when we're using Pip BaseTools
so that build etc. can be found.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2023-05-11 02:14:12 +00:00
Rebecca Cran f47415e031 BaseTools: Revert Set the CLANGDWARF OBJCOPY path in tools_def.template
This reverts commit 11f62f4cc0.

While GCC uses objcopy for the OBJCOPY command, it's not needed for the
CLANGDWARF toolchain and can be left as echo.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Ard BIesheuvel <ardb@kernel.org>
2023-05-11 00:37:05 +00:00
Rebecca Cran e6447d2a08 Remove bashisms from edksetup.sh and BaseTools/BuildEnv
Remove bashisms from edksetup.sh and BaseTools/BuildEnv. This allows any
POSIX shell to use those scripts, removing the dependency on bash.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-05-10 12:02:34 +00:00
Rebecca Cran 373a95532a BaseTools: Remove the CLANGCC build rule for Hii-Binary-Package.UEFI_HII
The build rule for Hii-Binary-Package.UEFI_HII should be the same as for
GCC, using $(RC) to embed the HII resource into the binary. Since the
build rule defaults to GCC, just remove CLANGGCC from the section.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-10 09:45:17 +00:00
Rebecca Cran ecbc394365 BaseTools: Set CLANGDWARF RC path to llvm-objcopy in tools_def.template
The llvm-rc tool is for Windows PE resources. Since the CLANGDWARF
toolchain creates ELF binaries, update the RC path to be llvm-objcopy.
This follows the GCC toolchain which uses objcopy for the RC path.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-10 09:45:17 +00:00
Rebecca Cran 11f62f4cc0 BaseTools: Set the CLANGDWARF OBJCOPY path in tools_def.template
Set the OBJCOPY path for the CLANGDWARF toolchain to 'llvm-objcopy' to
override the default of 'echo'.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-10 09:45:17 +00:00
Rebecca Cran c6f47e678f BaseTools: Remove BUILDRULEFAMILY from CLANGDWARF in tools_def.template
There's only a single rule in build_rule.template for CLANGGCC, and it's
incorrect. We should instead just use the rules for GCC, so remove the
BUILDRULEFAMILY line for the CLANGDWARF toolchain definition.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-10 09:45:17 +00:00
Rebecca Cran 5215cd5baf BaseTools: Update toolsetup.bat and Tests/PythonTest.py to check ver
Update toolsetup.bat and Tests/PythonTest.py to check if we're running a
version of Python that's compatible with BaseTools and the Pip
BaseTools.

BaseTools uses syntax from Python 3.6 or newer, so set that as the minimum
version EDK2 requires.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-05-08 19:03:18 +00:00
Rebecca Cran 11ec5161fa BaseTools: use threading.current_thread in NmakeSubdirs.py
threading.currentThread is a deprecated alias for
threading.current_thread, and causes a warning to be displayed when it's
called. Update NmakeSubdirs.py to use the latter method instead.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-05-08 19:03:18 +00:00
Rebecca Cran db7e6291c0 BaseTools: Remove Python2/Python3 detection from toolset.bat
Since Python3 is now required, we can remove the checks for PYTHON3_ENABLE
and PYTHON3 and simplify the code in toolsetup.bat. Also, remove the
leftover from when we supported freezing Python code.

While here, fix a couple of typos and improve error messages.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-05-08 19:03:18 +00:00
Michael D Kinney 4dea9e4a0e BaseTools/Conf: Add quotes to ADDDEBUGFLAG in tools_def.txt
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4448

Update tools_def.txt to add quotes around the file target in
OBJCOPY_ADDDEBUGFLAGS for compatibility with GCC like tool
chains used on Windows.

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: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-05-06 20:08:53 +00:00
Michael D Kinney 8e985ac3fd BaseTools/Conf: Align CLANGDWARF and CLANGPDB warning overrides
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4447

Fix build error related to use of DEBUG_CODE_BEGIN() and
DEBUG_CODE_END(). CLANGPDB requires extra warning disables
for use of DebugLib.h macros.  This change aligns the warning
disables between CLANGDWARF and CLANGPDB.

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: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-05-06 19:07:03 +00:00
Rebecca Cran 757f502a3b BaseTools/Conf/tools_def.template: Bump VERSION to 3.00
Bump VERSION to 3.00 and explain the changes made to the toolchains.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 050d6e9434 BaseTools: Delete CLANG38 from tools_def.template
Clang 3.8 is a very old release and is no longer relevant. Delete the
CLANG38 toolchain from tools_def.template.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 128547b081 BaseTools: Remove CLANG35 toolchain from tools_def.template
Clang 3.5 is a very old release and is no longer relevant. Remove the
CLANG35 toolchain from tools_def.template.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 4ef4b81c9b BaseTools: As with CLANGDWARF IA32 and X64, use lld for ARM and AARCH64
As with the IA32 and X64 CLANGDWARF toolchain definitions, use ld.lld
for ARM and AARCH64.

Add -Wl,--no-pie,--no-relax to the command line to fix linking when
using lld.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 98edce75fa BaseTools: Add ARM and AARCH64 CLANGDWARF support in tools_def.template
Add ARM and AARCH64 support to CLANGDWARF in tools_def.template, copying
the CLANG38 definitions.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 0fc07b1c6a BaseTools/Conf/tools_def.template: Add section for deprecated toolchains
In order to make it clear for anyone reading tools_def.template, add
a section for deprecated tool chains and move GCC48, GCC49 and GCC5
into it.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 01225075db Add GCC and GCCNOLTO toolchains to tools_def.txt and update packages
Add a 'GCC' toolchain that's a copy of the existing GCC5 definition.
Add a 'GCCNOLTO' toolchain that's a copy of the existing GCC49
toolchain.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 66803cafcf BaseTools: Update VS toolchain descriptions in tools_def.txt.template
Update the Visual Studio toolchain descriptions in
tools_def.txt.template:

- The WinDDK is no longer needed.
- Update 3 is required for VS 2015.
- VS 2005 has been removed.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran d7c6030a47 BaseTools: Remove EBC (EFI Byte Code) compiler definitions
The edk2-stable202302 release was the last to support building
EFI Byte Code drivers. Since the Intel EFI Byte Code Compiler is no
longer available, a decision has been made to remove support for EBC
from edk2.

Remove the definitions for Intel's EBC compiler from
Conf/tools_def.template.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 8b441847e3 BaseTools: Remove unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS defs
Remove the unused IPHONE_TOOLS and SOURCERY_CYGWIN_TOOLS definitions
from Conf/tools_def.template.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran c3ac3301e9 BaseTools: Remove VS2008-VS2013 remnants
Remove remnants of Visual Studio 2008-2013 support from
Conf/tools_def.txt and various batch scripts.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Rebecca Cran 0363584ac9 BaseTools: Remove VS2008, 2010, 2012 and 2013 toolchain definitions
With recent changes, Visual Studio versions older than VS2015 are
unable to build EDK2 code.

To avoid confusion, remove VS2008, 2010, 2012 and 2013 toolchain
definitions from Conf/tools_def.template, leaving only versions that can
be used to successfully build firmware.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Tested-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-05-05 11:41:35 +00:00
Gua Guo 9688e231d7 BaseTools/Plugin: Report error if code coverage failure
If code coverage exist failure, CI/CD need to catch it

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Signed-off-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
2023-04-27 21:55:58 +00:00
Rebecca Cran 6127bf1f30 BaseTools: Add quotes around OBJCOPY cmd in build_rule.template
Add quotes around the OBJCOPY command in build_rule.template to fix the
case where LLVM is installed on Windows in a path with spaces such as
C:\Program Files\LLVM.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2023-04-25 06:49:26 +00:00
Michael Kubacki 3163f34a42 BaseTools/Plugin: Clarify code coverage failure message
HostBasedUnitTestRunner.py is a build plugin responsible for locating
and executing host-based unit tests.

Recently, commit 6bb00aa introduced support for the plugin to
generate code coverage reports via lcov and OpenCppCoverage.

The plugin has discovered unit tests by searching for executables
with "Test" in the name for a while. However, the test coverage
change makes assumptions about test presence when crafting the
OpenCppCoverage command that ultimately fails with an ambiguous error
message if no host-based unit tests are discovered (see "ERROR").

```
SECTION - Run Host based Unit Tests
SUBSECTION - Testing for architecture: X64
ERROR - UnitTest Coverage: Failed to generate cobertura format xml in
        single package.
PROGRESS - --->Test Success: Host Unit Test Compiler Plugin NOOPT
```

This change preempts that message with a check in the plugin to
determine if any host-based tests were discovered. If not, a message
is printed with more guidance about how the developer should proceed
to either (1) fix their tests so code coverage is generated as
expected or (2) prevent the error message.

New message:

```
SECTION - Run Host based Unit Tests
SUBSECTION - Testing for architecture: X64
WARNING - UnitTest Coverage:
  No unit tests discovered. Test coverage will not be generated.

  Prevent this message by:
  1. Adding host-based unit tests to this package
  2. Ensuring tests have the word "Test" in their name
  3. Disabling HostUnitTestCompilerPlugin in the package CI YAML file
PROGRESS - --->Test Success: Host Unit Test Compiler Plugin NOOPT
```

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>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
2023-04-20 22:39:10 +00:00
Rebecca Cran 797f526ae2 BaseTools: Update SetupGit.py to add new 'fp' alias for patch formatting
To help people format patches with the correct options, add an alias
named 'fp' to SetupGit.py that runs format-patch with '-M --stat=1000
--stat-graph-width=20'.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-04-14 14:28:43 +00:00
Rebecca Cran c9fb11f92f BaseTools: Update PatchCheck.py to check for __FUNCTION__
New code should use the C99 macro __func__ instead of the pre-Standard
macro __FUNCTION__. Update PatchCheck.py to reject patches with the
latter.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2023-04-14 13:15:19 +00:00
Ard Biesheuvel b62d7ac97b BaseTools/GenFw: Add DllCharacteristicsEx field to debug data
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4405

The PE/COFF spec describes an additional DllCharacteristics field
implemented as a debug directory entry, which carries flags related to
which control flow integrity (CFI) features are supported by the binary.

So let's add this entry when doing ELF to PE/COFF conversion - we will
add support for setting the flags in a subsequent patch.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2023-04-07 13:18:38 +00:00