From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web10.26760.1574355363590451458 for ; Thu, 21 Nov 2019 08:56:04 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linaro.org header.s=google header.b=oEKAW5g2; spf=pass (domain: linaro.org, ip: 209.85.221.66, mailfrom: leif.lindholm@linaro.org) Received: by mail-wr1-f66.google.com with SMTP id n1so5267993wra.10 for ; Thu, 21 Nov 2019 08:56:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=BMKuvxkpbSKq9RyYeb0T1mN42YAFh9NNk9VgTTJUJRE=; b=oEKAW5g2wYEB7TaLjtfG7h2kdWFWx/St5Z3vbKkK+89dK43yrD8paCfX9L3S5oOsTA Qg2QW1Q0QrF8RqS6Zvnno4+OY484NeAmcAOWgG6eoiWdV0eMOSCZKF1ZbG9Jzyzf9BNe IPdToybLwLJlLSaHKOmnJhTeNwCZ//y/faCE//OxE5XRvSZuE83CJyoju0Xrye/zBr9C p629st1Z0OW8eUQT3k/nv9ebMC5+I2LJlflrNdWqQy8zl3urTA1adZ0DShy4nMaavacp RnQ/UueTyRNgJqZIwP1YXTVSUgpVdVwJswk0cC5vWm9aPsLMn3ynG3D8qYQG4g5cHSFl iWsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=BMKuvxkpbSKq9RyYeb0T1mN42YAFh9NNk9VgTTJUJRE=; b=kvgf0P3/XpT3hjoRrQPsOX0pPx3tCbmdoBtI8Op71tDe4tniv2wWWPE1dxPgSJdd3H KnUOc++q9dxgoky0h+wSa1gucXwA9p0QmcOJGC0/tpZCUU0CPMyirYp4o99EXWNOJQmd 14/g3jcqm53nMwb3pNyQe5u7Y8KmAAMMImn5+rr83kfsZBrZIpdQhNy0vMDmTC/d3GLV sVMe3aMlQNU5y5prBq0+EE1FhzJsdNN0+AFd4a8YBYB5rddTe7ZNnuvWi+/p33NZ7LMB /cRrayofjE2TaZaOpVfjQDYVUnY/ycj+p/8xuk70sLaKfTCgy+Ha3OM7c6olI0hSaCu3 huvg== X-Gm-Message-State: APjAAAUnOvSvD2qPqscM9uhVUyKG92VycfjYR/CsPS7Eak7l7WwFIUYg jt6sffp6MzljI/euc6c3RxwfYg== X-Google-Smtp-Source: APXvYqyxwvf6RQc2uExkcXAfrviUHdq3NyAubN86IYYJDX7nxEc2gpVYJ1ZdPP3Z4aqRNPaJQsU9ow== X-Received: by 2002:a05:6000:150:: with SMTP id r16mr11699211wrx.313.1574355362061; Thu, 21 Nov 2019 08:56:02 -0800 (PST) Return-Path: Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id f67sm264782wme.16.2019.11.21.08.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Nov 2019 08:56:01 -0800 (PST) Date: Thu, 21 Nov 2019 16:55:59 +0000 From: "Leif Lindholm" To: Abner Chang Cc: devel@edk2.groups.io, Bob Feng , Liming Gao , Gilbert Chen Subject: Re: [edk2-staging/RISC-V-V2 PATCH v3 24/39] BaseTools: BaseTools changes for RISC-V platform. Message-ID: <20191121165559.GM7359@bivouac.eciton.net> References: <1572227957-13169-1-git-send-email-abner.chang@hpe.com> <1572227957-13169-25-git-send-email-abner.chang@hpe.com> MIME-Version: 1.0 In-Reply-To: <1572227957-13169-25-git-send-email-abner.chang@hpe.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Oct 28, 2019 at 09:59:02 +0800, Abner Chang wrote: > BaseTools changes for building EDK2 RISC-V platform. > The changes made to build_rule.template is to avoid build errors > caused by GCC5 tool chain. > > Signed-off-by: Abner Chang > > Cc: Bob Feng > Cc: Liming Gao > Cc: Leif Lindholm > Cc: Gilbert Chen > --- > BaseTools/Source/C/Common/PeCoffLib.h | 9 + > BaseTools/Source/C/GenFw/elf_common.h | 62 +++++ > .../Source/C/Include/IndustryStandard/PeImage.h | 6 + > BaseTools/Source/C/Common/BasePeCoff.c | 15 +- > BaseTools/Source/C/Common/PeCoffLoaderEx.c | 86 +++++++ > BaseTools/Source/C/GenFv/GenFvInternalLib.c | 128 +++++++++- > BaseTools/Source/C/GenFw/Elf32Convert.c | 5 +- > BaseTools/Source/C/GenFw/Elf64Convert.c | 282 ++++++++++++++++++++- > BaseTools/Conf/build_rule.template | 54 ++-- > BaseTools/Conf/tools_def.template | 64 ++++- > BaseTools/Source/Python/Common/DataType.py | 7 +- > BaseTools/Source/Python/Common/buildoptions.py | 6 +- > 12 files changed, 685 insertions(+), 39 deletions(-) > > diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template > index db06d3a..57c3cf7 100755 > --- a/BaseTools/Conf/build_rule.template > +++ b/BaseTools/Conf/build_rule.template > @@ -1,6 +1,7 @@ > # > # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
> # Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
> +# Portions Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent > # > > @@ -266,10 +267,10 @@ > > $(RM) ${dst} > "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST) > - > + There are a bunch of whitespace-only diffs in this file. Please get rid of them. (Or are you able to drop all of these changes after Mark's linker script fix?) / Leif > > "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST) > - > + > > # $(OBJECT_FILES_LIST) has wrong paths for cygwin > "$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES) > @@ -304,8 +305,8 @@ > > > "$(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 > @@ -321,6 +322,21 @@ > "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} > > > +[Static-Library-File.COMMON.RISCV64, Static-Library-File.COMMON.RISCV32] > + > + *.lib > + > + > + $(MAKE_FILE) > + > + > + $(DEBUG_DIR)(+)$(MODULE_NAME).dll > + > + > + "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) --end-group $(DLINK2_FLAGS) > + "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} > + > + > [Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION] > > *.lib > @@ -346,8 +362,8 @@ > > > "$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS) > - > - > + > + > [Dynamic-Library-File] > > ?.dll > @@ -360,7 +376,7 @@ > $(CP) ${dst} $(DEBUG_DIR) > $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi > -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR) > - -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) > + -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) > > $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug > $(OBJCOPY) --strip-unneeded -R .eh_frame ${src} > @@ -375,7 +391,7 @@ > $(CP) ${dst} $(DEBUG_DIR) > $(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi > -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR) > - > + > > # tool to convert Mach-O to PE/COFF > "$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff > @@ -414,13 +430,13 @@ > > Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src} > "$(ASLPP)" $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii > - Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii > + Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii > "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii > > > Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src} > "$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii > - Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii > + Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii > "$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii > > [C-Code-File.AcpiTable] > @@ -462,14 +478,14 @@ > "$(ASLCC)" -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src} > "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj > "$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS) > - > - > + > + > "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(INC) ${src} > "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj > "$(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 > @@ -492,14 +508,14 @@ > Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i > "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii > "$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj --end-group > - > + > > "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i > Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i > "$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii > "$(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} > - > + > > [Nasm-to-Binary-Code-File] > > @@ -635,8 +651,8 @@ > > "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS) > "$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst} > - > + > > GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) > - > - > + > + > diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/Python/Common/DataType.py > index 8ae1bd2..0bc5d47 100644 > --- a/BaseTools/Source/Python/Common/DataType.py > +++ b/BaseTools/Source/Python/Common/DataType.py > @@ -3,6 +3,7 @@ > # > # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
> # Portions copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
> +# Portions Copyright (c) 2016 - 2019, Hewlett Packard Enterprise Development LP. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent > > ## > @@ -52,7 +53,9 @@ TAB_ARCH_ARM = 'ARM' > TAB_ARCH_EBC = 'EBC' > TAB_ARCH_AARCH64 = 'AARCH64' > > -ARCH_SET_FULL = {TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_ARM, TAB_ARCH_EBC, TAB_ARCH_AARCH64, TAB_ARCH_COMMON} > +TAB_ARCH_RISCV64 = 'RISCV64' > + > +ARCH_SET_FULL = {TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_ARM, TAB_ARCH_EBC, TAB_ARCH_AARCH64, TAB_ARCH_RISCV64, TAB_ARCH_COMMON} > > SUP_MODULE_BASE = 'BASE' > SUP_MODULE_SEC = 'SEC' > @@ -532,4 +535,4 @@ PACK_CODE_BY_SIZE = {8:'=Q', > 0:'=B', > 16:""} > > -TAB_COMPILER_MSFT = 'MSFT' > \ No newline at end of file > +TAB_COMPILER_MSFT = 'MSFT' > \ No newline at end of file The above hunk shouldn't be there. / Leif