diff options
author | Nate DeSimone <nathaniel.l.desimone@intel.com> | 2025-06-25 15:48:35 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2025-07-09 22:06:53 +0000 |
commit | e2a30df32e523ec19abd980f9665dee4ab620917 (patch) | |
tree | de4bf75b88a5e6aa08bd2bd1bef655e76d548549 /BaseTools | |
parent | 965a754f19e7f9434e598af6e99f012d462a91bc (diff) | |
download | edk2-e2a30df32e523ec19abd980f9665dee4ab620917.zip edk2-e2a30df32e523ec19abd980f9665dee4ab620917.tar.gz edk2-e2a30df32e523ec19abd980f9665dee4ab620917.tar.bz2 |
BaseTools/tools_def: Use MSVC ABI for CLANGPDB Targets
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>
Diffstat (limited to 'BaseTools')
-rwxr-xr-x | BaseTools/Conf/tools_def.template | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index cca699c..2108948 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -1932,11 +1932,11 @@ RELEASE_GCC_LOONGARCH64_CC_FLAGS = DEF(GCC5_LOONGARCH64_CC_FLAGS) -Wno-unu DEFINE CLANGPDB_IA32_PREFIX = ENV(CLANG_BIN)
DEFINE CLANGPDB_X64_PREFIX = ENV(CLANG_BIN)
-DEFINE CLANGPDB_IA32_TARGET = -target i686-unknown-windows-gnu
-DEFINE CLANGPDB_X64_TARGET = -target x86_64-unknown-windows-gnu
+DEFINE CLANGPDB_IA32_TARGET = -target i686-pc-windows-msvc
+DEFINE CLANGPDB_X64_TARGET = -target x86_64-pc-windows-msvc
DEFINE CLANGPDB_WARNING_OVERRIDES = -Wno-parentheses-equality -Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-unaligned-access -Wno-microsoft-enum-forward-reference
-DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned-char -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -Wno-null-dereference -mno-implicit-float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh-exceptions
+DEFINE CLANGPDB_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGPDB_WARNING_OVERRIDES) -fno-stack-protector -funsigned-char -ftrap-function=undefined_behavior_has_been_optimized_away_by_clang -Wno-address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclaration -Wno-null-dereference -mno-implicit-float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fno-omit-frame-pointer -U _MSC_VER -D __GNUC__
###########################
# CLANGPDB IA32 definitions
|