* [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs
@ 2021-06-02 7:45 Ni, Ray
2021-06-02 7:45 ` [PATCH 1/6] BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size Ni, Ray
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-02 7:45 UTC (permalink / raw)
To: devel
Universal payload requires its format in ELF format while today's EDKII
doesn't contain a cross OS toolchain that generates ELF images.
The patch set is based on Liming's work in year 2019 and some very minor
modifications are made:
1. Update toolchain name from CLANG8ELF to CLANGDWARF.
2. Update link script to keep dynamic section.
Liming Gao (4):
BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size
BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF
image
BaseTools: Update build_rule to skip CLANG resource section generation
BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8
Ray Ni (2):
BaseTools: Update ClangBase.lds to keep dynamic section
BaseTools: Change CLANG8ELF to CLANGDWARF
BaseTools/Conf/build_rule.template | 5 +-
BaseTools/Conf/tools_def.template | 109 +++++++++++++++++++++++-
BaseTools/Scripts/ClangBase.lds | 78 +++++++++++++++++
BaseTools/Source/C/GenFw/Elf32Convert.c | 12 +--
BaseTools/Source/C/GenFw/Elf64Convert.c | 5 +-
5 files changed, 192 insertions(+), 17 deletions(-)
create mode 100644 BaseTools/Scripts/ClangBase.lds
--
2.31.1.windows.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/6] BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
@ 2021-06-02 7:45 ` Ni, Ray
2021-06-02 7:45 ` [PATCH 2/6] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image Ni, Ray
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-02 7:45 UTC (permalink / raw)
To: devel; +Cc: Liming Gao, Feng Bob C
From: Liming Gao <liming.gao@intel.com>
LLVM LLD linker doesn't support common-page-size option. So, max-page-size
is used. To not impact GCC tool chain, new ClangBase.lds is added.
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
---
BaseTools/Scripts/ClangBase.lds | 79 +++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 BaseTools/Scripts/ClangBase.lds
diff --git a/BaseTools/Scripts/ClangBase.lds b/BaseTools/Scripts/ClangBase.lds
new file mode 100644
index 0000000000..8abd54aee6
--- /dev/null
+++ b/BaseTools/Scripts/ClangBase.lds
@@ -0,0 +1,79 @@
+/** @file
+
+ Unified linker script for GCC based builds
+
+ Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
+ (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+SECTIONS {
+
+ /*
+ * The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
+ * section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
+ * between 32-bit and 64-bit builds). The actual start of the .text section
+ * will be rounded up based on its actual alignment.
+ */
+ . = PECOFF_HEADER_SIZE;
+
+ .text : ALIGN(CONSTANT(MAXPAGESIZE)) {
+ *(.text .text.* .stub .gnu.linkonce.t.*)
+ *(.rodata .rodata.* .gnu.linkonce.r.*)
+ *(.got .got.*)
+
+ /*
+ * The contents of AutoGen.c files are mostly constant from the POV of the
+ * program, but most of it ends up in .data or .bss by default since few of
+ * the variable definitions that get emitted are declared as CONST.
+ * Unfortunately, we cannot pull it into the .text section entirely, since
+ * patchable PCDs are also emitted here, but we can at least move all of the
+ * emitted GUIDs here.
+ */
+ *:AutoGen.obj(.data.g*Guid)
+ }
+
+ /*
+ * The alignment of the .data section should be less than or equal to the
+ * alignment of the .text section. This ensures that the relative offset
+ * between these sections is the same in the ELF and the PE/COFF versions of
+ * this binary.
+ */
+ .data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(MAXPAGESIZE)) {
+ *(.data .data.* .gnu.linkonce.d.*)
+ *(.bss .bss.*)
+ }
+
+ .eh_frame ALIGN(CONSTANT(MAXPAGESIZE)) : {
+ KEEP (*(.eh_frame))
+ }
+
+ .rela (INFO) : {
+ *(.rela .rela.*)
+ }
+
+ .hii : ALIGN(CONSTANT(MAXPAGESIZE)) {
+ KEEP (*(.hii))
+ }
+
+ /*
+ * Retain the GNU build id but in a non-allocatable section so GenFw
+ * does not copy it into the PE/COFF image.
+ */
+ .build-id (INFO) : { *(.note.gnu.build-id) }
+
+ /DISCARD/ : {
+ *(.note.GNU-stack)
+ *(.gnu_debuglink)
+ *(.interp)
+ *(.dynsym)
+ *(.dynstr)
+ *(.dynamic)
+ *(.hash .gnu.hash)
+ *(.comment)
+ *(COMMON)
+ }
+}
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/6] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
2021-06-02 7:45 ` [PATCH 1/6] BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size Ni, Ray
@ 2021-06-02 7:45 ` Ni, Ray
2021-06-02 7:45 ` [PATCH 3/6] BaseTools: Update build_rule to skip CLANG resource section generation Ni, Ray
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-02 7:45 UTC (permalink / raw)
To: devel; +Cc: Liming Gao, Feng Bob C
From: Liming Gao <liming.gao@intel.com>
CLANG8ELF tool chain generated ELF image with the different attributes
in section. Update GenFw to handle them.
1. .text section with writable attribute (support)
2. .reloc section has the symbol for *ABS* (skip)
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
# Conflicts:
# BaseTools/Source/C/GenFw/Elf64Convert.c
---
BaseTools/Source/C/GenFw/Elf32Convert.c | 12 +++---------
BaseTools/Source/C/GenFw/Elf64Convert.c | 5 +++--
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index 2485b2cb7a..7c8a065678 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -238,7 +238,7 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC);
+ return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
}
STATIC
@@ -261,7 +261,7 @@ IsDataShdr (
if (IsHiiRsrcShdr(Shdr)) {
return FALSE;
}
- return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
+ return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
}
STATIC
@@ -749,13 +749,7 @@ WriteSections32 (
if (SymName == NULL) {
SymName = (const UINT8 *)"<unknown>";
}
-
- Error (NULL, 0, 3000, "Invalid",
- "%s: Bad definition for symbol '%s'@%#x or unsupported symbol type. "
- "For example, absolute and undefined symbols are not supported.",
- mInImageName, SymName, Sym->st_value);
-
- exit(EXIT_FAILURE);
+ continue;
}
SymShdr = GetShdrByIndex(Sym->st_shndx);
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index d097db8632..8fe672e984 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -246,7 +246,7 @@ IsTextShdr (
Elf_Shdr *Shdr
)
{
- return (BOOLEAN) ((Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == SHF_ALLOC);
+ return (BOOLEAN) ((Shdr->sh_flags & (SHF_EXECINSTR | SHF_ALLOC)) == (SHF_EXECINSTR | SHF_ALLOC));
}
STATIC
@@ -269,7 +269,7 @@ IsDataShdr (
if (IsHiiRsrcShdr(Shdr)) {
return FALSE;
}
- return (BOOLEAN) (Shdr->sh_flags & (SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
+ return (BOOLEAN) (Shdr->sh_flags & (SHF_EXECINSTR | SHF_WRITE | SHF_ALLOC)) == (SHF_ALLOC | SHF_WRITE);
}
STATIC
@@ -1060,6 +1060,7 @@ WriteSections64 (
exit(EXIT_FAILURE);
}
+ continue;
}
SymShdr = GetShdrByIndex(Sym->st_shndx);
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/6] BaseTools: Update build_rule to skip CLANG resource section generation
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
2021-06-02 7:45 ` [PATCH 1/6] BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size Ni, Ray
2021-06-02 7:45 ` [PATCH 2/6] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image Ni, Ray
@ 2021-06-02 7:45 ` Ni, Ray
2021-06-02 7:45 ` [PATCH 4/6] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8 Ni, Ray
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-02 7:45 UTC (permalink / raw)
To: devel; +Cc: Liming Gao, Feng Bob C
From: Liming Gao <liming.gao@intel.com>
LLVM/CLANG doesn't support resource section generation when ELF image generated.
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
# Conflicts:
# BaseTools/Conf/build_rule.template
---
BaseTools/Conf/build_rule.template | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template
index 1395792cd6..3add1029f2 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -669,6 +669,5 @@
<Command.GCC>
"$(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}
-
- <Command.XCODE, Command.RVCT>
- GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES)
+ <Command.XCODE, Command.RVCT, Command.CLANGGCC>
+ "$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/6] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
` (2 preceding siblings ...)
2021-06-02 7:45 ` [PATCH 3/6] BaseTools: Update build_rule to skip CLANG resource section generation Ni, Ray
@ 2021-06-02 7:45 ` Ni, Ray
2021-06-02 7:45 ` [PATCH 5/6] BaseTools: Update ClangBase.lds to keep dynamic section Ni, Ray
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-02 7:45 UTC (permalink / raw)
To: devel; +Cc: Liming Gao, Feng Bob C
From: Liming Gao <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>
Reviewed-by: Feng Bob C <bob.c.feng@intel.com>
# 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.template
index 498696e583..c8ef1a1421 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -292,6 +292,10 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
# Required to compile nasm source:
# nasm compiler from
# NASM -- http://www.nasm.us/
+# 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
@@ -2828,6 +2832,104 @@ NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:RE
NOOPT_CLANGPDB_X64_DLINK2_FLAGS =
NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable
+# 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
+
#
#
# XCODE5 support
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 5/6] BaseTools: Update ClangBase.lds to keep dynamic section
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
` (3 preceding siblings ...)
2021-06-02 7:45 ` [PATCH 4/6] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8 Ni, Ray
@ 2021-06-02 7:45 ` Ni, Ray
2021-06-02 7:45 ` [PATCH 6/6] BaseTools: Change CLANG8ELF to CLANGDWARF Ni, Ray
2021-06-03 1:17 ` 回复: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs gaoliming
6 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-02 7:45 UTC (permalink / raw)
To: devel; +Cc: Bob Feng, Liming Gao, Yuwei Chen
The .dynamic section is needed for ELF runtime relocation.
Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
BaseTools/Scripts/ClangBase.lds | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/BaseTools/Scripts/ClangBase.lds b/BaseTools/Scripts/ClangBase.lds
index 8abd54aee6..61452ddd95 100644
--- a/BaseTools/Scripts/ClangBase.lds
+++ b/BaseTools/Scripts/ClangBase.lds
@@ -1,8 +1,8 @@
/** @file
- Unified linker script for GCC based builds
+ Unified linker script for CLANG based builds
- Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2021, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
@@ -71,7 +71,6 @@ SECTIONS {
*(.interp)
*(.dynsym)
*(.dynstr)
- *(.dynamic)
*(.hash .gnu.hash)
*(.comment)
*(COMMON)
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 6/6] BaseTools: Change CLANG8ELF to CLANGDWARF
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
` (4 preceding siblings ...)
2021-06-02 7:45 ` [PATCH 5/6] BaseTools: Update ClangBase.lds to keep dynamic section Ni, Ray
@ 2021-06-02 7:45 ` Ni, Ray
2021-06-03 1:17 ` 回复: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs gaoliming
6 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-02 7:45 UTC (permalink / raw)
To: devel; +Cc: Bob Feng, Liming Gao, Yuwei Chen
CLANGDWARF is more proper because it's similar to CLANGPDB that generates
PE images but with DWARF debug symbols.
This toolchain is needed for creating ELF format universal payload that
follows https://universalpayload.github.io/documentation/.
Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
---
BaseTools/Conf/tools_def.template | 181 +++++++++++++++---------------
1 file changed, 91 insertions(+), 90 deletions(-)
diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.template
index c8ef1a1421..2e6b382ab6 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -292,13 +292,12 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
# Required to compile nasm source:
# nasm compiler from
# NASM -- http://www.nasm.us/
-# 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.
+# CLANGDWARF -Linux, Windows, Mac- Requires:
+# Clang 9 or above from http://releases.llvm.org/
# Optional:
-# Required to build platforms or ACPI tables:
-# Intel(r) ACPI Compiler from
-# https://acpica.org/downloads
+# Required to compile nasm source:
+# nasm compiler from
+# NASM -- http://www.nasm.us/
# VS2008x86 -win64- Requires:
# Microsoft Visual Studio 2008 (x86)
# Microsoft Windows Server 2003 Driver Development Kit (Microsoft WINDDK) version 3790.1830
@@ -2832,103 +2831,105 @@ NOOPT_CLANGPDB_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:RE
NOOPT_CLANGPDB_X64_DLINK2_FLAGS =
NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable
-# 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
+####################################################################################
+#
+# CLANGDWARF - This configuration is used to compile under Windows/Linux/Mac to produce
+# ELF binaries using LLVM/Clang/LLD with Link Time Optimization enabled
#
####################################################################################
-*_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)
+*_CLANGDWARF_*_*_FAMILY = GCC
+*_CLANGDWARF_*_*_BUILDRULEFAMILY = CLANGGCC
+*_CLANGDWARF_*_MAKE_PATH = ENV(CLANG_HOST_BIN)make
+*_CLANGDWARF_*_*_DLL = ENV(CLANGDWARF_DLL)
+*_CLANGDWARF_*_ASL_PATH = DEF(UNIX_IASL_BIN)
-*_CLANG8ELF_*_APP_FLAGS =
-*_CLANG8ELF_*_ASL_FLAGS = DEF(IASL_FLAGS)
-*_CLANG8ELF_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
+*_CLANGDWARF_*_APP_FLAGS =
+*_CLANGDWARF_*_ASL_FLAGS = DEF(IASL_FLAGS)
+*_CLANGDWARF_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
-DEFINE CLANG8ELF_IA32_PREFIX = ENV(CLANG8_BIN)
-DEFINE CLANG8ELF_X64_PREFIX = ENV(CLANG8_BIN)
+DEFINE CLANGDWARF_IA32_PREFIX = ENV(CLANG_BIN)
+DEFINE CLANGDWARF_X64_PREFIX = ENV(CLANG_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)
+DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON = -nostdlib -Wl,-q,--gc-sections -z max-page-size=0x40
+DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON = -Wl,--script=$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds
+DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
+DEFINE CLANGDWARF_IA32_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
+DEFINE CLANGDWARF_X64_DLINK2_FLAGS = -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 DEF(CLANGDWARF_DLINK2_FLAGS_COMMON)
###########################
-# CLANG8ELF IA32 definitions
+# CLANGDWARF 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
+*_CLANGDWARF_IA32_CC_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_SLINK_PATH = DEF(CLANGDWARF_IA32_PREFIX)llvm-ar
+*_CLANGDWARF_IA32_DLINK_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_ASLDLINK_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_ASM_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_PP_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_VFRPP_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_ASLCC_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_ASLPP_PATH = DEF(CLANGDWARF_IA32_PREFIX)clang
+*_CLANGDWARF_IA32_RC_PATH = DEF(CLANGDWARF_IA32_PREFIX)llvm-rc
+
+*_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 -fno-lto DEF(CLANG38_IA32_TARGET)
+*_CLANGDWARF_IA32_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_i386 -fuse-ld=lld
+*_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m32 -march=i386 DEF(CLANG38_IA32_TARGET)
+*_CLANGDWARF_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
+*_CLANGDWARF_IA32_OBJCOPY_FLAGS =
+*_CLANGDWARF_IA32_NASM_FLAGS = -f elf32
+*_CLANGDWARF_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_IA32_TARGET)
+*_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_IA32_TARGET)
+*_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_IA32_TARGET)
+
+DEBUG_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET) -g
+DEBUG_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
+DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
+
+RELEASE_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586 DEF(CLANG38_IA32_TARGET)
+RELEASE_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -flto -Wl,-O3 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
+RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O3 -fuse-ld=lld
+
+NOOPT_CLANGDWARF_IA32_CC_FLAGS = DEF(CLANG38_ALL_CC_FLAGS) -m32 -O0 -march=i586 DEF(CLANG38_IA32_TARGET) -g
+NOOPT_CLANGDWARF_IA32_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_i386 -Wl,--oformat,elf32-i386
+NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS = DEF(CLANGDWARF_IA32_DLINK2_FLAGS) -O0 -fuse-ld=lld
##########################
-# CLANG8ELF X64 definitions
+# CLANGDWARF 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
+*_CLANGDWARF_X64_CC_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_SLINK_PATH = DEF(CLANGDWARF_X64_PREFIX)llvm-ar
+*_CLANGDWARF_X64_DLINK_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_ASLDLINK_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_ASM_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_PP_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_VFRPP_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_ASLCC_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_ASLPP_PATH = DEF(CLANGDWARF_X64_PREFIX)clang
+*_CLANGDWARF_X64_RC_PATH = DEF(CLANGDWARF_X64_PREFIX)llvm-rc
+
+*_CLANGDWARF_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64 -fno-lto DEF(CLANG38_X64_TARGET)
+*_CLANGDWARF_X64_ASLDLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_ASLDLINK_FLAGS) -Wl,-m,elf_x86_64 -fuse-ld=lld
+*_CLANGDWARF_X64_ASM_FLAGS = DEF(GCC5_ASM_FLAGS) -m64 DEF(CLANG38_X64_TARGET)
+*_CLANGDWARF_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
+*_CLANGDWARF_X64_OBJCOPY_FLAGS =
+*_CLANGDWARF_X64_NASM_FLAGS = -f elf64
+*_CLANGDWARF_X64_PP_FLAGS = DEF(GCC_PP_FLAGS) DEF(CLANG38_X64_TARGET)
+*_CLANGDWARF_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS) DEF(CLANG38_X64_TARGET)
+*_CLANGDWARF_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS) DEF(CLANG38_X64_TARGET)
+
+DEBUG_CLANGDWARF_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_CLANGDWARF_X64_DLINK_FLAGS = DEF(CLANGDWARF_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_CLANGDWARF_X64_DLINK2_FLAGS = DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O3 -fuse-ld=lld
+
+RELEASE_CLANGDWARF_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_CLANGDWARF_X64_DLINK_FLAGS = DEF(CLANGDWARF_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_CLANGDWARF_X64_DLINK2_FLAGS = DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O3 -fuse-ld=lld
+
+NOOPT_CLANGDWARF_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_CLANGDWARF_X64_DLINK_FLAGS = DEF(CLANGDWARF_IA32_X64_DLINK_FLAGS) -Wl,-O0 -Wl,-melf_x86_64 -Wl,--oformat,elf64-x86-64 -Wl,-pie -mcmodel=small -Wl,--apply-dynamic-relocs
+NOOPT_CLANGDWARF_X64_DLINK2_FLAGS = DEF(CLANGDWARF_X64_DLINK2_FLAGS) -O0 -fuse-ld=lld
#
#
--
2.31.1.windows.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* 回复: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
` (5 preceding siblings ...)
2021-06-02 7:45 ` [PATCH 6/6] BaseTools: Change CLANG8ELF to CLANGDWARF Ni, Ray
@ 2021-06-03 1:17 ` gaoliming
2021-06-03 6:08 ` Ni, Ray
6 siblings, 1 reply; 10+ messages in thread
From: gaoliming @ 2021-06-03 1:17 UTC (permalink / raw)
To: devel, ray.ni
Ray:
Thanks for your effort to integrate CLANGDWARF tool chain. Previous work
bases on CLANG8. Now, which version CLANG compiler is used?
And, can you submit one BZ for this new feature? Then, I can add it to the
feature planning.
Besides, please remove conflict message in the commit message of patch
2~4.
Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Ni, Ray
> 发送时间: 2021年6月2日 15:46
> 收件人: devel@edk2.groups.io
> 主题: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal
> payload needs
>
> Universal payload requires its format in ELF format while today's EDKII
> doesn't contain a cross OS toolchain that generates ELF images.
>
> The patch set is based on Liming's work in year 2019 and some very minor
> modifications are made:
> 1. Update toolchain name from CLANG8ELF to CLANGDWARF.
> 2. Update link script to keep dynamic section.
>
> Liming Gao (4):
> BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size
> BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF
> image
> BaseTools: Update build_rule to skip CLANG resource section generation
> BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8
>
> Ray Ni (2):
> BaseTools: Update ClangBase.lds to keep dynamic section
> BaseTools: Change CLANG8ELF to CLANGDWARF
>
> BaseTools/Conf/build_rule.template | 5 +-
> BaseTools/Conf/tools_def.template | 109
> +++++++++++++++++++++++-
> BaseTools/Scripts/ClangBase.lds | 78 +++++++++++++++++
> BaseTools/Source/C/GenFw/Elf32Convert.c | 12 +--
> BaseTools/Source/C/GenFw/Elf64Convert.c | 5 +-
> 5 files changed, 192 insertions(+), 17 deletions(-)
> create mode 100644 BaseTools/Scripts/ClangBase.lds
>
> --
> 2.31.1.windows.1
>
>
>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs
2021-06-03 1:17 ` 回复: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs gaoliming
@ 2021-06-03 6:08 ` Ni, Ray
2021-06-03 6:09 ` Ni, Ray
0 siblings, 1 reply; 10+ messages in thread
From: Ni, Ray @ 2021-06-03 6:08 UTC (permalink / raw)
To: gaoliming, devel@edk2.groups.io
Liming,
I resent the V2 that removed the conflict messages and corrected your mail address.
I am using CLANG V11.
https://bugzilla.tianocore.org/show_bug.cgi?id=3431 was submitted.
Thanks,
Ray
> -----Original Message-----
> From: gaoliming <gaoliming@byosoft.com.cn>
> Sent: Thursday, June 3, 2021 9:18 AM
> To: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>
> Subject: 回复: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs
>
> Ray:
> Thanks for your effort to integrate CLANGDWARF tool chain. Previous work
> bases on CLANG8. Now, which version CLANG compiler is used?
>
> And, can you submit one BZ for this new feature? Then, I can add it to the
> feature planning.
>
> Besides, please remove conflict message in the commit message of patch
> 2~4.
>
> Thanks
> Liming
> > -----邮件原件-----
> > 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Ni, Ray
> > 发送时间: 2021年6月2日 15:46
> > 收件人: devel@edk2.groups.io
> > 主题: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal
> > payload needs
> >
> > Universal payload requires its format in ELF format while today's EDKII
> > doesn't contain a cross OS toolchain that generates ELF images.
> >
> > The patch set is based on Liming's work in year 2019 and some very minor
> > modifications are made:
> > 1. Update toolchain name from CLANG8ELF to CLANGDWARF.
> > 2. Update link script to keep dynamic section.
> >
> > Liming Gao (4):
> > BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size
> > BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF
> > image
> > BaseTools: Update build_rule to skip CLANG resource section generation
> > BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8
> >
> > Ray Ni (2):
> > BaseTools: Update ClangBase.lds to keep dynamic section
> > BaseTools: Change CLANG8ELF to CLANGDWARF
> >
> > BaseTools/Conf/build_rule.template | 5 +-
> > BaseTools/Conf/tools_def.template | 109
> > +++++++++++++++++++++++-
> > BaseTools/Scripts/ClangBase.lds | 78 +++++++++++++++++
> > BaseTools/Source/C/GenFw/Elf32Convert.c | 12 +--
> > BaseTools/Source/C/GenFw/Elf64Convert.c | 5 +-
> > 5 files changed, 192 insertions(+), 17 deletions(-)
> > create mode 100644 BaseTools/Scripts/ClangBase.lds
> >
> > --
> > 2.31.1.windows.1
> >
> >
> >
> >
> >
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs
2021-06-03 6:08 ` Ni, Ray
@ 2021-06-03 6:09 ` Ni, Ray
0 siblings, 0 replies; 10+ messages in thread
From: Ni, Ray @ 2021-06-03 6:09 UTC (permalink / raw)
To: Ni, Ray, devel
[-- Attachment #1: Type: text/plain, Size: 106 bytes --]
V2 is at https://edk2.groups.io/g/devel/message/75955?p=,,,20,0,0,0::Created,,CLANGDWARF,20,2,0,83253912
[-- Attachment #2: Type: text/html, Size: 239 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-06-03 6:09 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-02 7:45 [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs Ni, Ray
2021-06-02 7:45 ` [PATCH 1/6] BaseTools: Add ClangBase.lds for CLANG8 tool chain with max-page-size Ni, Ray
2021-06-02 7:45 ` [PATCH 2/6] BaseTools GenFw: Support CLANG8ELF with conversion ELF to PE/COFF image Ni, Ray
2021-06-02 7:45 ` [PATCH 3/6] BaseTools: Update build_rule to skip CLANG resource section generation Ni, Ray
2021-06-02 7:45 ` [PATCH 4/6] BaseTools: Add new CLANG8ELF tool chain for new LLVM/CLANG8 Ni, Ray
2021-06-02 7:45 ` [PATCH 5/6] BaseTools: Update ClangBase.lds to keep dynamic section Ni, Ray
2021-06-02 7:45 ` [PATCH 6/6] BaseTools: Change CLANG8ELF to CLANGDWARF Ni, Ray
2021-06-03 1:17 ` 回复: [edk2-devel] [PATCH 0/6] Add CLANGDWARF toolchain for universal payload needs gaoliming
2021-06-03 6:08 ` Ni, Ray
2021-06-03 6:09 ` Ni, Ray
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox