From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from loongson.cn (loongson.cn [114.242.206.163]) by mx.groups.io with SMTP id smtpd.web09.1694.1662612642794158730 for ; Wed, 07 Sep 2022 21:50:43 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: loongson.cn, ip: 114.242.206.163, mailfrom: lichao@loongson.cn) Received: from code-server.gen (unknown [10.2.9.245]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxT+CfdBljMSgUAA--.17030S2; Thu, 08 Sep 2022 12:50:40 +0800 (CST) From: "Chao Li" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen , Dongyan Qian , Baoqi Zhang Subject: [PATCH v1 16/34] BaseTools: BaseTools changes for LoongArch platform. Date: Thu, 8 Sep 2022 12:50:39 +0800 Message-Id: <20220908045039.1191214-1-lichao@loongson.cn> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxT+CfdBljMSgUAA--.17030S2 X-Coremail-Antispam: 1UD129KBjvJXoW3CFWfKr4rAr15tFWfWr4kZwb_yoWDWr45pa yxKr45G3WxJrn7KF4xK3Wa9FW2vF4IkryUGrW7Cr4rCa1Du3s8Jas8ta1UGrWjgr1Iy3yU C34q9wsxur10kwUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkq14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxV W0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv 7VC0I7IYx2IY67AKxVWUAVWUtwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r 1j6r4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE-syl 42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJV WUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAK I48JMIIF0xvE2Ix0cI8IcVAFwI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26F4j6r 4UJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAI cVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUb4v3UUUUUU== X-CM-SenderInfo: xolfxt3r6o00pqjv00gofq/1tbiAQADCGMYidshUQAls2 Content-Transfer-Encoding: quoted-printable BaseTools define template files changes for building EDK2 LoongArch platform. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Chao Li Co-authored-by: Dongyan Qian Co-authored-by: Baoqi Zhang --- BaseTools/Conf/tools_def.template | 54 +++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 5ed19810b7..9ceadeaa59 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -4,6 +4,7 @@ # Portions copyright (c) 2011 - 2019, ARM Ltd. All rights reserved.
=0D # Copyright (c) 2015, Hewlett-Packard Development Company, L.P.
=0D # (C) Copyright 2020, Hewlett Packard Enterprise Development LP
=0D +# Copyright (c) 2022, Loongson Technology Corporation Limited. All rights= reserved.
=0D # Copyright (c) Microsoft Corporation=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D @@ -267,7 +268,7 @@ DEFINE DTC_BIN =3D ENV(DTC_PREFIX)dtc # Intel(r) ACPI Compiler from=0D # https://acpica.org/downloads=0D # GCC5 -Linux,Windows- Requires:=0D -# GCC 5 with LTO support, targeting x86_64-lin= ux-gnu, aarch64-linux-gnu, arm-linux-gnueabi or riscv64-linux-gnu=0D +# GCC 5 with LTO support, targeting x86_64-lin= ux-gnu, aarch64-linux-gnu, arm-linux-gnueabi, riscv64-linux-gnu or loongarc= h64-linux-gnu=0D # Optional:=0D # Required to build platforms or ACPI tables:= =0D # Intel(r) ACPI Compiler from=0D @@ -1852,6 +1853,7 @@ DEFINE GCC_ALL_CC_FLAGS =3D -g -Os -fshort= -wchar -fno-builtin -fno-stri DEFINE GCC_IA32_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -m32 -malign-= double -freorder-blocks -freorder-blocks-and-partition -O2 -mno-stack-arg-p= robe=0D DEFINE GCC_X64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mno-red-zone= -Wno-address -mno-stack-arg-probe=0D DEFINE GCC_ARM_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mlittle-endi= an -mabi=3Daapcs -fno-short-enums -funsigned-char -ffunction-sections -fdat= a-sections -fomit-frame-pointer -Wno-address -mthumb -mfloat-abi=3Dsoft -fn= o-pic -fno-pie=0D +DEFINE GCC_LOONGARCH64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mabi=3Dlp64d= -fno-asynchronous-unwind-tables -fno-plt -Wno-address -fno-short-enums -fs= igned-char -ffunction-sections -fdata-sections=0D DEFINE GCC_ARM_CC_XIPFLAGS =3D -mno-unaligned-access=0D DEFINE GCC_AARCH64_CC_FLAGS =3D DEF(GCC_ALL_CC_FLAGS) -mlittle-endi= an -fno-short-enums -fverbose-asm -funsigned-char -ffunction-sections -fda= ta-sections -Wno-address -fno-asynchronous-unwind-tables -fno-unwind-tables= -fno-pic -fno-pie -ffixed-x18=0D DEFINE GCC_AARCH64_CC_XIPFLAGS =3D -mstrict-align -mgeneral-regs-only= =0D @@ -1859,12 +1861,15 @@ DEFINE GCC_DLINK_FLAGS_COMMON =3D -nostdlib --= pie DEFINE GCC_DLINK2_FLAGS_COMMON =3D -Wl,--script=3D$(EDK_TOOLS_PATH)/Sc= ripts/GccBase.lds=0D DEFINE GCC_IA32_X64_DLINK_COMMON =3D DEF(GCC_DLINK_FLAGS_COMMON) --gc-se= ctions=0D DEFINE GCC_ARM_AARCH64_DLINK_COMMON=3D -Wl,--emit-relocs -nostdlib -Wl,--g= c-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_= DIR_DEBUG)/$(BASE_NAME).map=0D +DEFINE GCC_LOONGARCH64_DLINK_COMMON=3D -Wl,--emit-relocs -nostdlib -Wl,--g= c-sections -u $(IMAGE_ENTRY_POINT) -Wl,-e,$(IMAGE_ENTRY_POINT),-Map,$(DEST_= DIR_DEBUG)/$(BASE_NAME).map=0D DEFINE GCC_ARM_DLINK_FLAGS =3D DEF(GCC_ARM_AARCH64_DLINK_COMMON) -= z common-page-size=3D0x20 -Wl,--pic-veneer=0D DEFINE GCC_AARCH64_DLINK_FLAGS =3D DEF(GCC_ARM_AARCH64_DLINK_COMMON) -= z common-page-size=3D0x20=0D +DEFINE GCC_LOONGARCH64_DLINK_FLAGS =3D DEF(GCC_LOONGARCH64_DLINK_COMMON) -= z common-page-size=3D0x20=0D DEFINE GCC_ARM_AARCH64_ASLDLINK_FLAGS =3D -Wl,--defsym=3DPECOFF_HEADER_SIZ= E=3D0 DEF(GCC_DLINK2_FLAGS_COMMON) -z common-page-size=3D0x20=0D DEFINE GCC_IA32_X64_ASLDLINK_FLAGS =3D DEF(GCC_IA32_X64_DLINK_COMMON) --en= try _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)=0D DEFINE GCC_ARM_ASLDLINK_FLAGS =3D DEF(GCC_ARM_DLINK_FLAGS) -Wl,--entr= y,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLINK_F= LAGS)=0D DEFINE GCC_AARCH64_ASLDLINK_FLAGS =3D DEF(GCC_AARCH64_DLINK_FLAGS) -Wl,--= entry,ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEF(GCC_ARM_AARCH64_ASLDLI= NK_FLAGS)=0D +DEFINE GCC_LOONGARCH64_ASLDLINK_FLAGS =3D DEF(GCC_LOONGARCH64_DLINK_FLAGS)= --entry ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)=0D DEFINE GCC_IA32_X64_DLINK_FLAGS =3D DEF(GCC_IA32_X64_DLINK_COMMON) --en= try _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -M= ap $(DEST_DIR_DEBUG)/$(BASE_NAME).map=0D DEFINE GCC_ASM_FLAGS =3D -c -x assembler -imacros AutoGen.h= =0D DEFINE GCC_PP_FLAGS =3D -E -x assembler-with-cpp -include A= utoGen.h=0D @@ -1873,11 +1878,12 @@ DEFINE GCC_ASLPP_FLAGS =3D -x c -E -inc= lude AutoGen.h DEFINE GCC_ASLCC_FLAGS =3D -x c=0D DEFINE GCC_WINDRES_FLAGS =3D -J rc -O coff=0D DEFINE GCC_DTCPP_FLAGS =3D -E -x assembler-with-cpp -imacros A= utoGen.h -nostdinc -undef=0D -DEFINE GCC_IA32_RC_FLAGS =3D -I binary -O elf32-i386 -B= i386 --rename-section .data=3D.hii=0D -DEFINE GCC_X64_RC_FLAGS =3D -I binary -O elf64-x86-64 -B= i386 --rename-section .data=3D.hii=0D -DEFINE GCC_ARM_RC_FLAGS =3D -I binary -O elf32-littlearm -B= arm --rename-section .data=3D.hii=0D -DEFINE GCC_AARCH64_RC_FLAGS =3D -I binary -O elf64-littleaarch64 -B= aarch64 --rename-section .data=3D.hii=0D -DEFINE GCC_RISCV64_RC_FLAGS =3D -I binary -O elf64-littleriscv -B= riscv --rename-section .data=3D.hii=0D +DEFINE GCC_IA32_RC_FLAGS =3D -I binary -O elf32-i386 -B= i386 --rename-section .data=3D.hii=0D +DEFINE GCC_X64_RC_FLAGS =3D -I binary -O elf64-x86-64 -B= i386 --rename-section .data=3D.hii=0D +DEFINE GCC_ARM_RC_FLAGS =3D -I binary -O elf32-littlearm -B= arm --rename-section .data=3D.hii=0D +DEFINE GCC_AARCH64_RC_FLAGS =3D -I binary -O elf64-littleaarch64 -B= aarch64 --rename-section .data=3D.hii=0D +DEFINE GCC_RISCV64_RC_FLAGS =3D -I binary -O elf64-littleriscv -B= riscv --rename-section .data=3D.hii=0D +DEFINE GCC_LOONGARCH64_RC_FLAGS =3D -I binary -O elf64-loongarch -B= loongarch64 --rename-section .data=3D.hii=0D =0D # GCC Build Flag for included header file list generation=0D DEFINE GCC_DEPS_FLAGS =3D -MMD -MF $@.deps=0D @@ -1967,6 +1973,14 @@ DEFINE GCC5_RISCV64_CC_FLAGS =3D DEF(G= CC5_RISCV_ALL_CC_FLAGS) DEF(GC DEFINE GCC5_RISCV64_DLINK_FLAGS =3D DEF(GCC5_RISCV_ALL_DLINK_FL= AGS) -Wl,-melf64lriscv,--oformat=3Delf64-littleriscv,--no-relax=0D DEFINE GCC5_RISCV64_DLINK2_FLAGS =3D DEF(GCC5_RISCV_ALL_DLINK2_F= LAGS)=0D DEFINE GCC5_RISCV64_ASM_FLAGS =3D DEF(GCC5_RISCV_ALL_ASM_FLAG= S) -march=3DDEF(GCC5_RISCV64_ARCH) -mcmodel=3Dmedany -mabi=3Dlp64=0D +=0D +DEFINE GCC5_LOONGARCH64_CC_FLAGS =3D DEF(GCC_LOONGARCH64_CC_FLAG= S) -march=3Dloongarch64 -mno-memcpy -Werror -Wno-maybe-uninitialized -Wno-s= tringop-overflow -Wno-pointer-to-int-cast -no-pie -fno-stack-protector -mno= -explicit-relocs=0D +DEFINE GCC5_LOONGARCH64_DLINK_FLAGS =3D DEF(GCC_LOONGARCH64_DLINK_F= LAGS)=0D +DEFINE GCC5_LOONGARCH64_DLINK2_FLAGS =3D DEF(GCC_DLINK2_FLAGS_COMMON= ) -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0x228=0D +DEFINE GCC5_LOONGARCH64_ASLDLINK_FLAGS =3D DEF(GCC_LOONGARCH64_ASLDLIN= K_FLAGS)=0D +DEFINE GCC5_LOONGARCH64_ASM_FLAGS =3D -x assembler-with-cpp -mabi= =3Dlp64d -march=3Dloongarch64 -fno-builtin -c -Wall -mno-explicit-relocs=0D +DEFINE GCC5_LOONGARCH64_PP_FLAGS =3D -mabi=3Dlp64d -march=3Dloon= garch64 DEF(GCC_PP_FLAGS)=0D +=0D DEFINE GCC_PP_FLAGS =3D -E -x assembler-with-cpp -i= nclude AutoGen.h DEF(GCC5_RISCV_OPENSBI_TYPES)=0D =0D ##########################################################################= ##########=0D @@ -2445,6 +2459,34 @@ RELEASE_GCC5_AARCH64_DLINK_XIPFLAGS =3D -z common-pa= ge-size=3D0x20 *_GCC5_RISCV64_OBJCOPY_FLAGS =3D=0D *_GCC5_RISCV64_DTCPP_FLAGS =3D DEF(GCC_DTCPP_FLAGS)=0D =0D +##################=0D +# GCC5 LOONGARCH64 definitions=0D +##################=0D +*_GCC5_LOONGARCH64_OBJCOPY_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)ob= jcopy=0D +*_GCC5_LOONGARCH64_CC_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_SLINK_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c-ar=0D +*_GCC5_LOONGARCH64_DLINK_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_ASLDLINK_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_ASM_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_PP_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_VFRPP_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_ASLCC_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_ASLPP_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)gc= c=0D +*_GCC5_LOONGARCH64_RC_PATH =3D ENV(GCC5_LOONGARCH64_PREFIX)ob= jcopy=0D +=0D +*_GCC5_LOONGARCH64_ASLCC_FLAGS =3D DEF(GCC_ASLCC_FLAGS)=0D +*_GCC5_LOONGARCH64_ASLDLINK_FLAGS =3D DEF(GCC5_LOONGARCH64_ASLDLINK_= FLAGS)=0D +*_GCC5_LOONGARCH64_ASM_FLAGS =3D DEF(GCC5_LOONGARCH64_ASM_FLAGS= )=0D +*_GCC5_LOONGARCH64_DLINK_FLAGS =3D DEF(GCC5_LOONGARCH64_DLINK_FLA= GS)=0D +*_GCC5_LOONGARCH64_DLINK2_FLAGS =3D DEF(GCC5_LOONGARCH64_DLINK2_FL= AGS)=0D +*_GCC5_LOONGARCH64_RC_FLAGS =3D DEF(GCC_LOONGARCH64_RC_FLAGS)= =0D +*_GCC5_LOONGARCH64_OBJCOPY_FLAGS =3D=0D +*_GCC5_LOONGARCH64_NASM_FLAGS =3D -f elf32=0D +*_GCC5_LOONGARCH64_PP_FLAGS =3D DEF(GCC5_LOONGARCH64_PP_FLAGS)= =0D +=0D +DEBUG_GCC5_LOONGARCH64_CC_FLAGS =3D DEF(GCC5_LOONGARCH64_CC_FLAGS)= =0D +RELEASE_GCC5_LOONGARCH64_CC_FLAGS =3D DEF(GCC5_LOONGARCH64_CC_FLAGS)= -Wno-unused-but-set-variable -Wno-unused-variable=0D +=0D ##########################################################################= ##########=0D #=0D # CLANG35 - This configuration is used to compile under Linux to produce= =0D --=20 2.27.0