From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: liming.gao@intel.com) Received: from mga11.intel.com (mga11.intel.com []) by groups.io with SMTP; Fri, 26 Apr 2019 07:43:03 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Apr 2019 07:43:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,397,1549958400"; d="scan'208";a="145975702" Received: from lgao4-mobl1.ccr.corp.intel.com ([10.255.29.102]) by orsmga003.jf.intel.com with ESMTP; 26 Apr 2019 07:43:02 -0700 From: "Liming Gao" To: devel@edk2.groups.io Subject: [Patch 6/7] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8 Date: Fri, 26 Apr 2019 22:42:41 +0800 Message-Id: <20190426144242.19024-7-liming.gao@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190426144242.19024-1-liming.gao@intel.com> References: <20190426144242.19024-1-liming.gao@intel.com> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1603 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=n, set CLANG8_BIN=LLVM installed directory For example: set CLANG_HOST_BIN=n # use windows nmake set CLANG8_BIN=C:\Program Files\LLVM\bin\ On Linux/Mac, set CLANG8_BIN=LLVM 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 --- BaseTools/Conf/tools_def.template | 105 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template index 29dc24774a..3d95a3a6a2 100755 --- a/BaseTools/Conf/tools_def.template +++ b/BaseTools/Conf/tools_def.template @@ -255,6 +255,13 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc # Required to build platforms or ACPI tables: # Intel(r) ACPI Compiler from # https://acpica.org/downloads +# CLANG8ELF -Linux,Windows,Mac- Requires: +# LLVM 8.0.0 or above, https://llvm.org/ +# On Windows OS, Visual Studio is required to be installed for nmake and compile BaseTools C tools. +# Optional: +# Required to build platforms or ACPI tables: +# Intel(r) ACPI Compiler from +# https://acpica.org/downloads # VS2008xASL -win32- Requires: # Microsoft Visual Studio 2008 Team Suite # Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830 @@ -3776,7 +3783,105 @@ DEFINE CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_TARGET) DEF(GCC_AARCH6 RELEASE_CLANG38_AARCH64_CC_FLAGS = DEF(CLANG38_AARCH64_CC_FLAGS) $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -flto -O3 RELEASE_CLANG38_AARCH64_DLINK_FLAGS = DEF(CLANG38_AARCH64_DLINK_FLAGS) -flto -Wl,-O3 -L$(WORKSPACE)/ArmPkg/Library/GccLto -llto-aarch64 -Wl,-plugin-opt=-pass-through=-llto-aarch64 +#################################################################################### +# +# Clang 8.0.0 - This configuration is used to compile under Windows, Linux, Mac to +# produce ELF image, and convert to PE/COFF image using LLVM/CLANG 8.0 with LTO +# +#################################################################################### +*_CLANG8ELF_*_*_FAMILY = GCC +*_CLANG8ELF_*_*_BUILDRULEFAMILY = CLANGGCC +*_CLANG8ELF_*_MAKE_PATH = ENV(CLANG_HOST_BIN)make +*_CLANG8ELF_*_*_DLL = ENV(CLANG8_DLL) +*_CLANG8ELF_*_ASL_PATH = DEF(UNIX_IASL_BIN) + +*_CLANG8ELF_*_APP_FLAGS = +*_CLANG8ELF_*_ASL_FLAGS = DEF(IASL_FLAGS) +*_CLANG8ELF_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS) + +DEFINE CLANG8ELF_IA32_PREFIX = ENV(CLANG8_BIN) +DEFINE CLANG8ELF_X64_PREFIX = ENV(CLANG8_BIN) + +# LLVM/CLANG doesn't support -n link option. So, it can't share the same IA32_X64_DLINK_COMMON flag. +# LLVM/CLANG doesn't support common page size. So, it can't share the same GccBase.lds script. +DEFINE CLANG8ELF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections -z max-page-size=0x40 +DEFINE CLANG8ELF_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds +DEFINE CLANG8ELF_IA32_X64_ASLDLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(CLANG8ELF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable +DEFINE CLANG8ELF_IA32_X64_DLINK_FLAGS = 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 +DEFINE CLANG8ELF_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(CLANG8ELF_DLINK2_FLAGS_COMMON) +DEFINE CLANG8ELF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF(CLANG8ELF_DLINK2_FLAGS_COMMON) + +########################### +# CLANG8ELF IA32 definitions +########################### +*_CLANG8ELF_IA32_CC_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_SLINK_PATH = DEF(CLANG8ELF_IA32_PREFIX)llvm-ar +*_CLANG8ELF_IA32_DLINK_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_ASLDLINK_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_ASM_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_PP_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_VFRPP_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_ASLCC_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_ASLPP_PATH = DEF(CLANG8ELF_IA32_PREFIX)clang +*_CLANG8ELF_IA32_RC_PATH = DEF(CLANG8ELF_IA32_PREFIX)llvm-rc + +*_CLANG8ELF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET) +*_CLANG8ELF_IA32_ASLDLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld +*_CLANG8ELF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET) +*_CLANG8ELF_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) +*_CLANG8ELF_IA32_OBJCOPY_FLAGS = +*_CLANG8ELF_IA32_NASM_FLAGS = -f elf32 +*_CLANG8ELF_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_IA32_TARGET) +*_CLANG8ELF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET) +*_CLANG8ELF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET) + +DEBUG_CLANG8ELF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g +DEBUG_CLANG8ELF_IA32_DLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386 +DEBUG_CLANG8ELF_IA32_DLINK2_FLAGS = DEF(CLANG8ELF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld + +RELEASE_CLANG8ELF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) +RELEASE_CLANG8ELF_IA32_DLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386 +RELEASE_CLANG8ELF_IA32_DLINK2_FLAGS = DEF(CLANG8ELF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld + +NOOPT_CLANG8ELF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g +NOOPT_CLANG8ELF_IA32_DLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386 +NOOPT_CLANG8ELF_IA32_DLINK2_FLAGS = DEF(CLANG8ELF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld +########################## +# CLANG8ELF X64 definitions +########################## +*_CLANG8ELF_X64_CC_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_SLINK_PATH = DEF(CLANG8ELF_X64_PREFIX)llvm-ar +*_CLANG8ELF_X64_DLINK_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_ASLDLINK_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_ASM_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_PP_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_VFRPP_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_ASLCC_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_ASLPP_PATH = DEF(CLANG8ELF_X64_PREFIX)clang +*_CLANG8ELF_X64_RC_PATH = DEF(CLANG8ELF_X64_PREFIX)llvm-rc + +*_CLANG8ELF_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANG38_X64_TARGET) +*_CLANG8ELF_X64_ASLDLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64 -fuse-ld=lld +*_CLANG8ELF_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG38_X64_TARGET) +*_CLANG8ELF_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) +*_CLANG8ELF_X64_OBJCOPY_FLAGS = +*_CLANG8ELF_X64_NASM_FLAGS = -f elf64 +*_CLANG8ELF_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_X64_TARGET) +*_CLANG8ELF_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X64_TARGET) +*_CLANG8ELF_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X64_TARGET) + +DEBUG_CLANG8ELF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g +DEBUG_CLANG8ELF_X64_DLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=small -Wl,--apply-dynamic-relocs +DEBUG_CLANG8ELF_X64_DLINK2_FLAGS = DEF(CLANG8ELF_X64_DLINK2_FLAGS) -O3 -fuse-ld=lld + +RELEASE_CLANG8ELF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz -flto DEF(CLANG38_X64_TARGET) +RELEASE_CLANG8ELF_X64_DLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=small -Wl,--apply-dynamic-relocs +RELEASE_CLANG8ELF_X64_DLINK2_FLAGS = DEF(CLANG8ELF_X64_DLINK2_FLAGS) -O3 -fuse-ld=lld + +NOOPT_CLANG8ELF_X64_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -O0 DEF(CLANG38_X64_TARGET) -g +NOOPT_CLANG8ELF_X64_DLINK_FLAGS = DEF(CLANG8ELF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=small -Wl,--apply-dynamic-relocs +NOOPT_CLANG8ELF_X64_DLINK2_FLAGS = DEF(CLANG8ELF_X64_DLINK2_FLAGS) -O0 -fuse-ld=lld # # -- 2.13.0.windows.1