From fadeea6d0ab21196973d307450176eb7f9b75009 Mon Sep 17 00:00:00 2001 From: Sean Brogan Date: Wed, 23 Oct 2019 05:46:48 +0000 Subject: [PATCH] Add VS Compiler prebuild plugins and extdeps for GCC to match edk2 --- BaseTools/Conf/build_rule.template | 50 +++++++++++++++++++++++++++--- BaseTools/Conf/tools_def.template | 7 +++-- 2 files changed, 50 insertions(+), 7 deletions(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index 76b1429018..ea4c8f2c83 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -2,6 +2,7 @@ # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
# Copyright (c) 2020, ARM Ltd. All rights reserved.
+# Copyright (c) Microsoft Corporation # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -108,6 +109,13 @@ ## Build Rule Version Number # build_rule_version=0.1 # +# +# 1.00 - Increase this version tag any time you want user to get warning about updating this file in the Conf dir. By default it does not do update existing conf dirs. +# 1.01 - Add MASM for Microsoft ARM assembly files. "MS-ARMx-Assembly-Code-File.COMMON.COMMON" +# 2.00 - Add .slib and .efi support in the sources file +# 2.01 - Add support for DEPS_FLAGS as well as + +#!VERSION=2.01 [C-Code-File] @@ -170,8 +178,9 @@ # The C pre-processor is used to insert code snippets in assembly from preprocessor macros. Unfortunately # the preprocessor doesn't also insert CR/LF and Microsoft's assembler expects each instruction to be on its own # line. We search and replace a special string (__CR__) with CR. - type ${d_path}(+)${s_base}.i | python -c "import sys; print sys.stdin.read().replace('__CR__','\n')" > ${d_path}(+)${s_base}.ii + type ${d_path}(+)${s_base}.i | python -c "import sys; print (sys.stdin.read().replace('__CR__','\n'))" > ${d_path}(+)${s_base}.ii Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.ii + # NOTE- need to review why the command is different. Missing /Fo and /I options "$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii [Assembly-Code-File.COMMON.COMMON] @@ -363,7 +372,7 @@ "$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) - + [Static-Library-File.SEC.AARCH64, Static-Library-File.PEI_CORE.AARCH64, Static-Library-File.PEIM.AARCH64,Static-Library-File.SEC.ARM, Static-Library-File.PEI_CORE.ARM, Static-Library-File.PEIM.ARM] *.lib @@ -398,7 +407,7 @@ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) - + [Dynamic-Library-File] ?.dll @@ -539,7 +548,7 @@ "$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff $(GENFW_FLAGS) - + [Masm16-Code-File] ?.asm16, ?.Asm16, ?.ASM16, ?.s16, ?.S16 @@ -573,6 +582,39 @@ "$(SLINK)" $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj otool -t $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib | hex2bin.py ${dst} +#MU_CHANGE +# Build Rule to support using precompiled +# LIB files. Just copies the LIB from src to output +# so the rest of the build system works. +# +[Precompiled-Lib-File] + + *.slib + + + + + $(OUTPUT_DIR)(+)$(MODULE_NAME).lib + + + -$(CP) ${src} ${dst} + +#MU_CHANGE +# Build Rule to support using precompiled +# EFI files. Just copies the EFI from src to output +# so the rest of the build system works. +# +[Precompiled-Efi-File] + + ?.preefi + + + + + $(OUTPUT_DIR)(+)${s_base}.efi + + + -$(CP) ${src} ${dst} [Nasm-to-Binary-Code-File] diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 2c292093f7..3405c4d07a 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -22,6 +22,7 @@ # - Deprecate GCC48, GCC49 and GCC5. # 3.01 - Update toolchain for VS2022 # 3.02 - Enable stack cookies for IA32, ARM, and AARCH64 builds for GCC and MSVC +# 3.03 - Remove WHOLEARCHIVE as this breaks the build for VS2017/VS2019 (MU_CHANGE) # #!VERSION=3.02 @@ -467,7 +468,7 @@ NOOPT_VS2015x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF *_VS2017_*_APP_FLAGS = /nologo /E /TC *_VS2017_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h *_VS2017_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h -*_VS2017_*_DLINK2_FLAGS = /WHOLEARCHIVE +# *_VS2017_*_DLINK2_FLAGS = /WHOLEARCHIVE # MU_CHANGE *_VS2017_*_ASM16_PATH = DEF(VS2017_BIN_IA32)\ml.exe *_VS2017_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS) ################## @@ -608,7 +609,7 @@ NOOPT_VS2017_AARCH64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:REF *_VS2019_*_APP_FLAGS = /nologo /E /TC *_VS2019_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h *_VS2019_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h -*_VS2019_*_DLINK2_FLAGS = /WHOLEARCHIVE +# *_VS2019_*_DLINK2_FLAGS = /WHOLEARCHIVE # MU_CHANGE *_VS2019_*_ASM16_PATH = DEF(VS2019_BIN_IA32)\ml.exe *_VS2019_*_DEPS_FLAGS = DEF(MSFT_DEPS_FLAGS) ################## @@ -2314,7 +2315,7 @@ RELEASE_XCODE5_X64_CC_FLAGS = -target x86_64-pc-win32-macho -c -Os -W ################# # ASM 16 linker definitions ################# -*_*_*_ASMLINK_PATH = DEF(WINDDK_BIN16)\link16.exe +*_*_*_ASMLINK_PATH = ENV(LINK_16_PREFIX)link16.exe # MU_CHANGE - change to prefix *_*_*_ASMLINK_FLAGS = /nologo /tiny ##################