From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com []) by mx.groups.io with SMTP id smtpd.web12.9878.1622619979686731258 for ; Wed, 02 Jun 2021 00:46:24 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: ray.ni@intel.com) IronPort-SDR: bciIoTYymEkyl0r9U/K/1FeitMR/jlrbbuSfB6G+KqJe/P4/Eb1Zp21ZQ9bnyMmoe3H8IknBQU tONHQV/1uH5g== X-IronPort-AV: E=McAfee;i="6200,9189,10002"; a="183409097" X-IronPort-AV: E=Sophos;i="5.83,241,1616482800"; d="scan'208";a="183409097" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2021 00:46:24 -0700 IronPort-SDR: zHypwbXjObBXm4/zt/18vmQUorKA01rd3lXpYxSclIFYbw5ORusC+7/I0tgNjGjHXfiQvGTxsG 6egf8vcEYhYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,241,1616482800"; d="scan'208";a="479607258" Received: from ray-dev.ccr.corp.intel.com ([10.239.158.87]) by orsmga001.jf.intel.com with ESMTP; 02 Jun 2021 00:46:22 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Liming Gao , Feng Bob C Subject: [PATCH 4/6] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8 Date: Wed, 2 Jun 2021 15:45:52 +0800 Message-Id: <20210602074554.244-5-ray.ni@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20210602074554.244-1-ray.ni@intel.com> References: <20210602074554.244-1-ray.ni@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Liming Gao BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3D1603 LLVM/CLANG8 formal release http://releases.llvm.org/download.html#8.0.0 It can be downloaded and installed in Windows/Linux/Mac OS. CLANG8ELF tool chain is added to generate ELF image, and convert to PE/COFF. On Windows OS, set CLANG_HOST_BIN=3Dn, set CLANG8_BIN=3DLLVM installed dire= ctory For example: set CLANG_HOST_BIN=3Dn # use windows nmake set CLANG8_BIN=3DC:\Program Files\LLVM\bin\ On Linux/Mac, set CLANG8_BIN=3DLLVM installed directory This tool chain can be used to compile the firmware code. On windows OS, Visual Studio is still required to compile BaseTools C tools and nmake.exe. On Linux/Mac OS, gcc is used to compile BaseTools C tools. make is used for makefile. This tool chain is verified on OVMF Ia32, X64 and Ia32X64 to boot Shell. This tool chain is verified in Windows/Linux and Mac OS. Signed-off-by: Liming Gao Reviewed-by: Feng Bob C # Conflicts: # BaseTools/Conf/tools_def.template --- BaseTools/Conf/tools_def.template | 102 ++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate index 498696e583..c8ef1a1421 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -292,6 +292,10 @@ DEFINE DTC_BIN =3D ENV(DTC_PREFIX)dtc # Required to compile nasm source:=0D # nasm compiler from=0D # NASM -- http://www.nasm.us/=0D +# CLANG8ELF -Linux,Windows,Mac- Requires:=0D +# LLVM 8.0.0 or above, https://llvm.org/=0D +# On Windows OS, Visual Studio is required to = be installed for nmake and compile BaseTools C tools.=0D +# Optional:=0D # Required to build platforms or ACPI tables:= =0D # Intel(r) ACPI Compiler from=0D # https://acpica.org/downloads=0D @@ -2828,6 +2832,104 @@ NOOPT_CLANGPDB_X64_DLINK_FLAGS =3D /NOLOGO /NO= DEFAULTLIB /IGNORE:4001 /OPT:RE NOOPT_CLANGPDB_X64_DLINK2_FLAGS =3D=0D NOOPT_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable=0D =0D +# Clang 8.0.0 - This configuration is used to compile under Windows, Linux= , Mac to=0D +# produce ELF image, and convert to PE/COFF image using LLVM/CLANG 8.0 wit= h LTO=0D +#=0D +##########################################################################= ##########=0D +*_CLANG8ELF_*_*_FAMILY =3D GCC=0D +*_CLANG8ELF_*_*_BUILDRULEFAMILY =3D CLANGGCC=0D +*_CLANG8ELF_*_MAKE_PATH =3D ENV(CLANG_HOST_BIN)make=0D +*_CLANG8ELF_*_*_DLL =3D ENV(CLANG8_DLL)=0D +*_CLANG8ELF_*_ASL_PATH =3D DEF(UNIX_IASL_BIN)=0D +=0D +*_CLANG8ELF_*_APP_FLAGS =3D=0D +*_CLANG8ELF_*_ASL_FLAGS =3D DEF(IASL_FLAGS)=0D +*_CLANG8ELF_*_ASL_OUTFLAGS =3D DEF(IASL_OUTFLAGS)=0D +=0D +DEFINE CLANG8ELF_IA32_PREFIX =3D ENV(CLANG8_BIN)=0D +DEFINE CLANG8ELF_X64_PREFIX =3D ENV(CLANG8_BIN)=0D +=0D +# LLVM/CLANG doesn't support -n link option. So, it can't share the same I= A32_X64_DLINK_COMMON flag.=0D +# LLVM/CLANG doesn't support common page size. So, it can't share the same= GccBase.lds script.=0D +DEFINE CLANG8ELF_IA32_X64_DLINK_COMMON =3D -nostdlib -Wl,-q,--gc-section= s -z max-page-size=3D0x40=0D +DEFINE CLANG8ELF_DLINK2_FLAGS_COMMON =3D -Wl,--script=3D$(EDK_TOOLS_PA= TH)/Scripts/ClangBase.lds=0D +DEFINE CLANG8ELF_IA32_X64_ASLDLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_= COMMON) -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0 DEF(CLANG8ELF_DLINK2_FLAGS_CO= MMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable=0D +DEFINE CLANG8ELF_IA32_X64_DLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_= COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$= (DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive=0D +DEFINE CLANG8ELF_IA32_DLINK2_FLAGS =3D -Wl,--defsym=3DPECOFF_HEADER_= SIZE=3D0x220 DEF(CLANG8ELF_DLINK2_FLAGS_COMMON)=0D +DEFINE CLANG8ELF_X64_DLINK2_FLAGS =3D -Wl,--defsym=3DPECOFF_HEADER_= SIZE=3D0x228 DEF(CLANG8ELF_DLINK2_FLAGS_COMMON)=0D +=0D +###########################=0D +# CLANG8ELF IA32 definitions=0D +###########################=0D +*_CLANG8ELF_IA32_CC_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_SLINK_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)llvm-a= r=0D +*_CLANG8ELF_IA32_DLINK_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_ASLDLINK_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_ASM_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_PP_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_VFRPP_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_ASLCC_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_ASLPP_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)clang= =0D +*_CLANG8ELF_IA32_RC_PATH =3D DEF(CLANG8ELF_IA32_PREFIX)llvm-r= c=0D +=0D +*_CLANG8ELF_IA32_ASLCC_FLAGS =3D DEF(GCC_ASLCC_FLAGS) -m32 -fno-l= to DEF(CLANG38_IA32_TARGET)=0D +*_CLANG8ELF_IA32_ASLDLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_ASLDLINK_= FLAGS) -Wl,-m,elf_i386 -fuse-ld=3Dlld=0D +*_CLANG8ELF_IA32_ASM_FLAGS =3D DEF(GCC5_ASM_FLAGS) -m32 -march= =3Di386 DEF(CLANG38_IA32_TARGET)=0D +*_CLANG8ELF_IA32_RC_FLAGS =3D DEF(GCC_IA32_RC_FLAGS)=0D +*_CLANG8ELF_IA32_OBJCOPY_FLAGS =3D=0D +*_CLANG8ELF_IA32_NASM_FLAGS =3D -f elf32=0D +*_CLANG8ELF_IA32_PP_FLAGS =3D DEF(GCC_PP_FLAGS) DEF(CLANG38_IA= 32_TARGET)=0D +*_CLANG8ELF_IA32_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANG38= _IA32_TARGET)=0D +*_CLANG8ELF_IA32_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANG38= _IA32_TARGET)=0D +=0D +DEBUG_CLANG8ELF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m32 -= Oz -flto -march=3Di586 DEF(CLANG38_IA32_TARGET) -g=0D +DEBUG_CLANG8ELF_IA32_DLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_FLA= GS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386=0D +DEBUG_CLANG8ELF_IA32_DLINK2_FLAGS =3D DEF(CLANG8ELF_IA32_DLINK2_FLAGS)= -O3 -fuse-ld=3Dlld=0D +=0D +RELEASE_CLANG8ELF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m32 -= Oz -flto -march=3Di586 DEF(CLANG38_IA32_TARGET)=0D +RELEASE_CLANG8ELF_IA32_DLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_FLA= GS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386=0D +RELEASE_CLANG8ELF_IA32_DLINK2_FLAGS =3D DEF(CLANG8ELF_IA32_DLINK2_FLAGS)= -O3 -fuse-ld=3Dlld=0D +=0D +NOOPT_CLANG8ELF_IA32_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m32 -= O0 -march=3Di586 DEF(CLANG38_IA32_TARGET) -g=0D +NOOPT_CLANG8ELF_IA32_DLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_FLA= GS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386=0D +NOOPT_CLANG8ELF_IA32_DLINK2_FLAGS =3D DEF(CLANG8ELF_IA32_DLINK2_FLAGS)= -O0 -fuse-ld=3Dlld=0D +=0D +##########################=0D +# CLANG8ELF X64 definitions=0D +##########################=0D +*_CLANG8ELF_X64_CC_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_SLINK_PATH =3D DEF(CLANG8ELF_X64_PREFIX)llvm-ar= =0D +*_CLANG8ELF_X64_DLINK_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_ASLDLINK_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_ASM_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_PP_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_VFRPP_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_ASLCC_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_ASLPP_PATH =3D DEF(CLANG8ELF_X64_PREFIX)clang=0D +*_CLANG8ELF_X64_RC_PATH =3D DEF(CLANG8ELF_X64_PREFIX)llvm-rc= =0D +=0D +*_CLANG8ELF_X64_ASLCC_FLAGS =3D DEF(GCC_ASLCC_FLAGS) -m64 -fno-lt= o DEF(CLANG38_X64_TARGET)=0D +*_CLANG8ELF_X64_ASLDLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_ASLDLINK_F= LAGS) -Wl,-m,elf_x86_64 -fuse-ld=3Dlld=0D +*_CLANG8ELF_X64_ASM_FLAGS =3D DEF(GCC5_ASM_FLAGS) -m64 DEF(CLAN= G38_X64_TARGET)=0D +*_CLANG8ELF_X64_RC_FLAGS =3D DEF(GCC_X64_RC_FLAGS)=0D +*_CLANG8ELF_X64_OBJCOPY_FLAGS =3D=0D +*_CLANG8ELF_X64_NASM_FLAGS =3D -f elf64=0D +*_CLANG8ELF_X64_PP_FLAGS =3D DEF(GCC_PP_FLAGS) DEF(CLANG38_X64= _TARGET)=0D +*_CLANG8ELF_X64_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_= X64_TARGET)=0D +*_CLANG8ELF_X64_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_= X64_TARGET)=0D +=0D +DEBUG_CLANG8ELF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "-= DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -Oz= -flto DEF(CLANG38_X64_TARGET) -g=0D +DEBUG_CLANG8ELF_X64_DLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_FLAG= S) -flto -Wl,-O3 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmo= del=3Dsmall -Wl,--apply-dynamic-relocs=0D +DEBUG_CLANG8ELF_X64_DLINK2_FLAGS =3D DEF(CLANG8ELF_X64_DLINK2_FLAGS) -= O3 -fuse-ld=3Dlld=0D +=0D +RELEASE_CLANG8ELF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "-= DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -Oz= -flto DEF(CLANG38_X64_TARGET)=0D +RELEASE_CLANG8ELF_X64_DLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_FLAG= S) -flto -Wl,-O3 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmo= del=3Dsmall -Wl,--apply-dynamic-relocs=0D +RELEASE_CLANG8ELF_X64_DLINK2_FLAGS =3D DEF(CLANG8ELF_X64_DLINK2_FLAGS) -= O3 -fuse-ld=3Dlld=0D +=0D +NOOPT_CLANG8ELF_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) -m64 "-= DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie -O0= DEF(CLANG38_X64_TARGET) -g=0D +NOOPT_CLANG8ELF_X64_DLINK_FLAGS =3D DEF(CLANG8ELF_IA32_X64_DLINK_FLAG= S) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=3D= small -Wl,--apply-dynamic-relocs=0D +NOOPT_CLANG8ELF_X64_DLINK2_FLAGS =3D DEF(CLANG8ELF_X64_DLINK2_FLAGS) -= O0 -fuse-ld=3Dlld=0D +=0D #=0D #=0D # XCODE5 support=0D --=20 2.31.1.windows.1