diff --git a/.azurepipelines/BaseTools-Build-For-Publication.yml b/.azurepipelines/BaseTools-Build-For-Publication.yml index d62e922cab..ee8711d4be 100644 --- a/.azurepipelines/BaseTools-Build-For-Publication.yml +++ b/.azurepipelines/BaseTools-Build-For-Publication.yml @@ -19,7 +19,7 @@ name: BaseTools_Bin_$(release_version)_$(Rev:r) variables: linux_build_output_path: '$(Build.Repository.LocalPath)/BaseTools/Source/C/bin' linux_artifact_name: 'LinuxOutput' - windows_build_output_path: '$(Build.Repository.LocalPath)\BaseTools\Bin\Win32' + windows_build_output_path: '$(Build.Repository.LocalPath)\BaseTools\Bin' windows_artifact_name: 'WindowsOutput' temp_publication_directory: 'PackageStaging' package_artifact_name: 'NugetReleasePackage' @@ -86,8 +86,13 @@ jobs: matrix: TARGET_x86: Build.Targets: 'IA32' + Build.TargetFolder: 'Win32' TARGET_ARM: Build.Targets: 'ARM' + Build.TargetFolder: 'Win32' + TARGET_AArch64: + Build.Targets: 'AARCH64' + Build.TargetFolder: 'Win64' pool: vmImage: windows-latest @@ -126,7 +131,7 @@ jobs: extra_parameters: '--skip_path_env -a $(Build.Targets)' tool_chain_tag: 'VS2022' - - publish: $(windows_build_output_path) + - publish: '$(windows_build_output_path)\$(Build.TargetFolder)' artifact: $(windows_artifact_name)_$(Build.Targets) displayName: Publish To Pipeline condition: SucceededOrFailed() @@ -188,6 +193,7 @@ jobs: mv $(Pipeline.Workspace)/$(linux_artifact_name)_AARCH64 $(Build.StagingDirectory)/$(temp_publication_directory)/Linux-ARM-64; mv $(Pipeline.Workspace)/$(windows_artifact_name)_IA32 $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-x86; mv $(Pipeline.Workspace)/$(windows_artifact_name)_ARM $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-ARM; + mv $(Pipeline.Workspace)/$(windows_artifact_name)_AARCH64 $(Build.StagingDirectory)/$(temp_publication_directory)/Windows-ARM-64; displayName: Stage Package Files - powershell: diff --git a/BaseTools/.gitignore b/BaseTools/.gitignore index ec9c69f8b2..5a057b604d 100644 --- a/BaseTools/.gitignore +++ b/BaseTools/.gitignore @@ -17,5 +17,6 @@ Source/C/VfrCompile/VfrTokens.h Source/C/bin/ Source/C/libs/ Bin/Win32 +Bin/Win64 Lib -BaseToolsBuild/ \ No newline at end of file +BaseToolsBuild/ diff --git a/BaseTools/Edk2ToolsBuild.py b/BaseTools/Edk2ToolsBuild.py index e7a202857a..0add59b5bb 100644 --- a/BaseTools/Edk2ToolsBuild.py +++ b/BaseTools/Edk2ToolsBuild.py @@ -138,9 +138,19 @@ def Go(self): if self.target_arch == "IA32": VcToolChainArch = "x86" TargetInfoArch = "x86" + OutputDir = "Win32" elif self.target_arch == "ARM": VcToolChainArch = "x86_arm" TargetInfoArch = "ARM" + OutputDir = "Win32" + elif self.target_arch == "X64": + VcToolChainArch = "amd64" + TargetInfoArch = "x86" + OutputDir = "Win64" + elif self.target_arch == "AARCH64": + VcToolChainArch = "amd64_arm64" + TargetInfoArch = "ARM" + OutputDir = "Win64" else: raise NotImplementedError() # MU_CHANGE @@ -166,7 +176,7 @@ def Go(self): shell_env.set_shell_var('HOST_ARCH', self.target_arch) self.OutputDir = os.path.join( - shell_env.get_shell_var("EDK_TOOLS_PATH"), "Bin", "Win32") + shell_env.get_shell_var("EDK_TOOLS_PATH"), "Bin", OutputDir) # compiled tools need to be added to path because antlr is referenced # MU_CHANGE: Added logic to support cross compilation scenarios diff --git a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h b/BaseTools/Source/C/Include/AArch64/ProcessorBind.h index dfa725b2e3..4995eff3ce 100644 --- a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h +++ b/BaseTools/Source/C/Include/AArch64/ProcessorBind.h @@ -24,26 +24,82 @@ #pragma pack() #endif +// MU_CHANGE Starts: Fixing basic ARM definitions in Windows #if _MSC_EXTENSIONS + +// +// Disable warning that make it impossible to compile at /W4 +// This only works for Microsoft* tools +// + +// +// Disabling bitfield type checking warnings. +// +#pragma warning ( disable : 4214 ) + +// +// Disabling the unreferenced formal parameter warnings. +// +#pragma warning ( disable : 4100 ) + +// +// Disable slightly different base types warning as CHAR8 * can not be set +// to a constant string. +// +#pragma warning ( disable : 4057 ) + +// +// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning +// +#pragma warning ( disable : 4127 ) + + +#endif + +#if !defined(__GNUC__) && (__STDC_VERSION__ < 199901L) // - // use Microsoft* C compiler dependent integer width types + // No ANSI C 2000 stdint.h integer width declarations, so define equivalents // - typedef unsigned __int64 UINT64; - typedef __int64 INT64; - typedef unsigned __int32 UINT32; - typedef __int32 INT32; - typedef unsigned short UINT16; - typedef unsigned short CHAR16; - typedef short INT16; - typedef unsigned char BOOLEAN; - typedef unsigned char UINT8; - typedef char CHAR8; - typedef signed char INT8; + + #if _MSC_EXTENSIONS + // + // use Microsoft* C compiler dependent integer width types + // + #include + typedef unsigned __int64 UINT64; + typedef __int64 INT64; + typedef unsigned __int32 UINT32; + typedef __int32 INT32; + typedef unsigned short UINT16; + typedef unsigned short CHAR16; + typedef short INT16; + typedef unsigned char BOOLEAN; + typedef unsigned char UINT8; + typedef char CHAR8; + typedef signed char INT8; + #else + // + // Assume standard ARM alignment. + // + typedef unsigned long long UINT64; + typedef long long INT64; + typedef unsigned int UINT32; + typedef int INT32; + typedef unsigned short UINT16; + typedef unsigned short CHAR16; + typedef short INT16; + typedef unsigned char BOOLEAN; + typedef unsigned char UINT8; + typedef char CHAR8; + typedef signed char INT8; + + #endif + #else // // Use ANSI C 2000 stdint.h integer width declarations // - #include + #include "stdint.h" typedef uint8_t BOOLEAN; typedef int8_t INT8; typedef uint8_t UINT8; @@ -57,6 +113,7 @@ typedef uint16_t CHAR16; #endif +// MU_CHANGE Ends /// /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common index 9ba7f10edb..05f54719aa 100644 --- a/BaseTools/Source/C/Makefiles/ms.common +++ b/BaseTools/Source/C/Makefiles/ms.common @@ -44,13 +44,23 @@ LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64 SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64 SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64 -# MU_CHANGE Starts: Adding support to build base tools for ARM +# MU_CHANGE Starts: Adding support to build base tools for ARM and AARCH64 !ELSEIF "$(HOST_ARCH)"=="ARM" ARCH_INCLUDE = $(SOURCE_PATH)\Include\Arm BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win32 LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win32 SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win32 SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win32 +!ELSEIF "$(HOST_ARCH)"=="AARCH64" +ARCH_INCLUDE = $(SOURCE_PATH)\Include\AArch64 +BIN_PATH = $(BASE_TOOLS_PATH)\Bin\Win64 +LIB_PATH = $(BASE_TOOLS_PATH)\Lib\Win64 +SYS_BIN_PATH = $(EDK_TOOLS_PATH)\Bin\Win64 +SYS_LIB_PATH = $(EDK_TOOLS_PATH)\Lib\Win64 +# Note: These are bit-width conversion related warning suppressions we carry to avoid much more +# overrides in the C code. The future plan is to replace all of these binary based tools +# with python scripts, when it happens in tianocore.. +CFLAGS = $(CFLAGS) /wd4267 /wd4244 /wd4334 # MU_CHANGE Ends !ELSE