From: "Liming Gao" <liming.gao@intel.com>
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 [thread overview]
Message-ID: <20190426144242.19024-7-liming.gao@intel.com> (raw)
In-Reply-To: <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 <liming.gao@intel.com>
---
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
next prev parent reply other threads:[~2019-04-26 14:43 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 14:42 [Patch 0/7] Add new CLANG8ELF tool chain for new LLVM/CLANG8 Liming Gao
2019-04-26 14:42 ` [Patch 1/7] BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size Liming Gao
2019-04-26 14:42 ` [Patch 2/7] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image Liming Gao
2019-04-26 14:42 ` [Patch 3/7] BaseTools: Update build_rule.template for ASLC rule with full C flags Liming Gao
2019-04-26 14:42 ` [Patch 4/7] BaseTools: Update build_rule to skip CLANG resource section generation Liming Gao
2019-04-26 14:42 ` [Patch 5/7] BaseTools: Update tools_def.template to directly refer to AutoGen.h Liming Gao
2019-04-26 14:42 ` Liming Gao [this message]
2019-05-17 1:16 ` [edk2-devel] [Patch 6/7] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8 Bob Feng
2019-04-26 14:42 ` [Patch 7/7] OvmfPkg: Update DSC/FDF to support CLANG8ELF tool chain Liming Gao
2019-05-19 13:24 ` [edk2-devel] " Ard Biesheuvel
2019-05-19 13:45 ` Liming Gao
2019-05-20 14:33 ` Laszlo Ersek
2019-04-26 16:33 ` [edk2-devel] [Patch 0/7] Add new CLANG8ELF tool chain for new LLVM/CLANG8 Ard Biesheuvel
2019-04-28 0:55 ` Liming Gao
2019-04-29 16:51 ` Leif Lindholm
2019-04-30 4:21 ` Liming Gao
2019-04-30 11:01 ` Leif Lindholm
2019-04-30 13:11 ` Steven Shi
2019-05-05 6:18 ` Liming Gao
[not found] ` <159BB5054AE8ABA6.12625@groups.io>
2019-05-16 13:29 ` Liming Gao
2019-05-19 20:14 ` Jordan Justen
2019-05-20 13:47 ` Liming Gao
2019-05-20 22:52 ` Andrew Fish
2019-05-21 2:18 ` Liming Gao
2019-05-21 3:36 ` Andrew Fish
[not found] ` <15990D503F545BBC.4588@groups.io>
2019-05-19 11:59 ` [edk2-devel] [Patch 7/7] OvmfPkg: Update DSC/FDF to support CLANG8ELF tool chain Liming Gao
2019-05-21 21:13 ` [edk2-devel] [Patch 0/7] Add new CLANG8ELF tool chain for new LLVM/CLANG8 Laszlo Ersek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190426144242.19024-7-liming.gao@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox