From: "Steven Shi" <steven.shi@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Ni, Ray" <ray.ni@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/4] BaseTools: Create CLANGDWARF toolchain
Date: Wed, 26 May 2021 11:35:05 +0000 [thread overview]
Message-ID: <MWHPR11MB1950EB171867B8330973E7DF8C249@MWHPR11MB1950.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210526082310.1597-2-ray.ni@intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 12600 bytes --]
Some suggestions:
1. There are many blanks appending the line "+ "$(DLINK)" -o ${dst} $(DLINK_FLAGS) @$(STATIC_LIBRARY_FILES_LIST) "
[cid:image001.png@01D75263.998291F0]
1. We need a toolchain dependency descirption in the BaseTools\Conf\tools_def.template. Below is the example for CLANGPDB. Please add one for the CLANGDWARF.
# CLANGPDB -Linux, Windows, Mac- Requires:
# Clang 9 or above from http://releases.llvm.org/
# Optional:
# Required to compile nasm source:
# nasm compiler from
# NASM -- http://www.nasm.us/
# Required to build platforms or ACPI tables:
# Intel(r) ACPI Compiler from
# https://acpica.org/downloads
1. We could merge the CLANG38 and the CLANGDWARF toolchains together in the future.
Thanks
Steven Shi
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray
> Sent: Wednesday, May 26, 2021 4:23 PM
> To: devel@edk2.groups.io
> Subject: [edk2-devel] [PATCH 1/4] BaseTools: Create CLANGDWARF
> toolchain
>
> Signed-off-by: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>>
> ---
> BaseTools/Conf/build_rule.template | 10 ++-
> BaseTools/Conf/tools_def.template | 98
> ++++++++++++++++++++++++++++++
> 2 files changed, 107 insertions(+), 1 deletion(-)
>
> diff --git a/BaseTools/Conf/build_rule.template
> b/BaseTools/Conf/build_rule.template
> index 1395792cd6..e69f963cc8 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -293,7 +293,10 @@
> <ExtraDependency>
>
> $(MAKE_FILE)
>
>
>
> - <OutputFile>
>
> + <OutputFile.CLANGDWARF>
>
> + $(DEBUG_DIR)(+)$(MODULE_NAME).elf
>
> +
>
> + <OutputFile.MSFT, OutputFile.INTEL, OutputFile.GCC>
>
> $(DEBUG_DIR)(+)$(MODULE_NAME).dll
>
>
>
> <Command.MSFT, Command.INTEL>
>
> @@ -303,6 +306,11 @@
> <Command.CLANGPDB>
>
> "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH)
> @$(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
>
>
>
> + <Command.CLANGDWARF>
>
> + "$(DLINK)" -o ${dst} $(DLINK_FLAGS) @$(STATIC_LIBRARY_FILES_LIST)
>
> + "$(CP)" ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
>
> + "$(OBJCOPY)" --strip-unneeded -R .eh_frame ${dst}
>
> +
>
> <Command.GCC>
>
> "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-
> group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS)
> $(DLINK2_FLAGS)
>
> "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
>
> diff --git a/BaseTools/Conf/tools_def.template
> b/BaseTools/Conf/tools_def.template
> index 498696e583..390e297cc1 100755
> --- a/BaseTools/Conf/tools_def.template
> +++ b/BaseTools/Conf/tools_def.template
> @@ -2828,6 +2828,104 @@ NOOPT_CLANGPDB_X64_DLINK_FLAGS =
> /NOLOGO /NODEFAULTLIB /IGNORE:4001 /OPT:RE
> NOOPT_CLANGPDB_X64_DLINK2_FLAGS =
>
> NOOPT_CLANGPDB_X64_GENFW_FLAGS = --keepexceptiontable
>
>
>
> +#########################################################
> ###########################
>
> +#
>
> +# CLANGDWARF - This configuration is used to compile under
> Windows/Linux/Mac to produce
>
> +# ELF binaries using LLVM/Clang/LLD with Link Time Optimization enabled
>
> +#
>
> +#########################################################
> ###########################
>
> +*_CLANGDWARF_*_*_FAMILY = GCC
>
> +*_CLANGDWARF_*_*_BUILDRULEFAMILY = CLANGDWARF
>
> +*_CLANGDWARF_*_MAKE_PATH = ENV(CLANG_HOST_BIN)make
>
> +*_CLANGDWARF_*_*_DLL = ENV(CLANGPDB_DLL)
>
> +*_CLANGDWARF_*_ASL_PATH = DEF(UNIX_IASL_BIN)
>
> +
>
> +*_CLANGDWARF_*_APP_FLAGS =
>
> +*_CLANGDWARF_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
>
> +*_CLANGDWARF_*_ASL_OUTFLAGS =
> DEF(DEFAULT_WIN_ASL_OUTFLAGS)
>
> +*_CLANGDWARF_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
>
> +*_CLANGDWARF_*_DEPS_FLAGS = DEF(GCC_DEPS_FLAGS)
>
> +
>
> +DEFINE CLANGDWARF_IA32_PREFIX = ENV(CLANG_BIN)
>
> +DEFINE CLANGDWARF_X64_PREFIX = ENV(CLANG_BIN)
>
> +
>
> +DEFINE CLANGDWARF_IA32_TARGET = -target i686-pc-linux-gnu
>
> +DEFINE CLANGDWARF_X64_TARGET = -target x86_64-pc-linux-gnu
>
> +
>
> +DEFINE CLANGDWARF_WARNING_OVERRIDES = -Wno-parentheses-
> equality -Wno-tautological-compare -Wno-tautological-constant-out-of-
> range-compare -Wno-empty-body -Wno-unused-const-variable -Wno-
> varargs -Wno-unknown-warning-option -Wno-microsoft-enum-forward-
> reference
>
> +DEFINE CLANGDWARF_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS)
> DEF(CLANGDWARF_WARNING_OVERRIDES) -fno-stack-protector -
> funsigned-char -ftrap-
> function=undefined_behavior_has_been_optimized_away_by_clang -Wno-
> address -Wno-shift-negative-value -Wno-unknown-pragmas -Wno-
> incompatible-library-redeclaration -Wno-null-dereference -mno-implicit-
> float -mms-bitfields -mno-stack-arg-probe -nostdlib -nostdlibinc -fseh-
> exceptions
>
> +
>
> +###########################
>
> +# CLANGDWARF IA32 definitions
>
> +###########################
>
> +*_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)ld.lld
>
> +*_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_OBJCOPY_PATH =
> DEF(CLANGDWARF_IA32_PREFIX)llvm-objcopy
>
> +
>
> +*_CLANGDWARF_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
> -fno-lto DEF(CLANGDWARF_IA32_TARGET)
>
> +*_CLANGDWARF_IA32_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m32 -
> march=i386 DEF(CLANGDWARF_IA32_TARGET)
>
> +*_CLANGDWARF_IA32_OBJCOPY_FLAGS =
>
> +*_CLANGDWARF_IA32_NASM_FLAGS = -f elf32
>
> +*_CLANGDWARF_IA32_PP_FLAGS = DEF(GCC_PP_FLAGS)
> DEF(CLANGDWARF_IA32_TARGET)
>
> +*_CLANGDWARF_IA32_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
> DEF(CLANGDWARF_IA32_TARGET)
>
> +*_CLANGDWARF_IA32_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
> DEF(CLANGDWARF_IA32_TARGET)
>
> +
>
> +DEBUG_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANGDWARF_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
> DEF(CLANGDWARF_IA32_TARGET) -g
>
> +DEBUG_CLANGDWARF_IA32_DLINK_FLAGS = --eh-frame-hdr -q --gc-
> sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -Map
> $(DEST_DIR_DEBUG)/$(BASE_NAME).map --whole-archive -O3 -melf_i386 --
> format=elf
>
> +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =
>
> +
>
> +RELEASE_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANGDWARF_ALL_CC_FLAGS) -m32 -Oz -flto -march=i586
> DEF(CLANGDWARF_IA32_TARGET)
>
> +RELEASE_CLANGDWARF_IA32_DLINK_FLAGS = --eh-frame-hdr -q --gc-
> sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -Map
> $(DEST_DIR_DEBUG)/$(BASE_NAME).map --whole-archive -O3 -melf_i386 --
> format=elf
>
> +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =
>
> +
>
> +NOOPT_CLANGDWARF_IA32_CC_FLAGS =
> DEF(CLANGDWARF_ALL_CC_FLAGS) -m32 -O0 -march=i586
> DEF(CLANGDWARF_IA32_TARGET) -g
>
> +NOOPT_CLANGDWARF_IA32_DLINK_FLAGS = --eh-frame-hdr -q --gc-
> sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -Map
> $(DEST_DIR_DEBUG)/$(BASE_NAME).map --whole-archive -O0 -melf_i386 --
> format=elf
>
> +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =
>
> +
>
> +##########################
>
> +# CLANGDWARF X64 definitions
>
> +##########################
>
> +*_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)ld.lld
>
> +*_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_OBJCOPY_PATH =
> DEF(CLANGDWARF_IA32_PREFIX)llvm-objcopy
>
> +
>
> +*_CLANGDWARF_X64_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m64
> -fno-lto DEF(CLANGDWARF_X64_TARGET)
>
> +*_CLANGDWARF_X64_ASM_FLAGS = DEF(GCC_ASM_FLAGS) -m64
> DEF(CLANGDWARF_X64_TARGET)
>
> +*_CLANGDWARF_X64_OBJCOPY_FLAGS =
>
> +*_CLANGDWARF_X64_NASM_FLAGS = -f elf64
>
> +*_CLANGDWARF_X64_PP_FLAGS = DEF(GCC_PP_FLAGS)
> DEF(CLANGDWARF_X64_TARGET)
>
> +*_CLANGDWARF_X64_ASLPP_FLAGS = DEF(GCC_ASLPP_FLAGS)
> DEF(CLANGDWARF_X64_TARGET)
>
> +*_CLANGDWARF_X64_VFRPP_FLAGS = DEF(GCC_VFRPP_FLAGS)
> DEF(CLANGDWARF_X64_TARGET)
>
> +
>
> +DEBUG_CLANGDWARF_X64_CC_FLAGS =
> DEF(CLANGDWARF_ALL_CC_FLAGS) -m64 "-
> DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz
> -flto DEF(CLANGDWARF_X64_TARGET) -g
>
> +DEBUG_CLANGDWARF_X64_DLINK_FLAGS = --eh-frame-hdr -q --gc-
> sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -Map
> $(DEST_DIR_DEBUG)/$(BASE_NAME).map --whole-archive -O3 -
> melf_x86_64 --format=elf -pie
>
> +DEBUG_CLANGDWARF_X64_DLINK2_FLAGS =
>
> +DEBUG_CLANGDWARF_X64_GENFW_FLAGS = --keepexceptiontable
>
> +
>
> +RELEASE_CLANGDWARF_X64_CC_FLAGS =
> DEF(CLANGDWARF_ALL_CC_FLAGS) -m64 "-
> DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -Oz
> -flto DEF(CLANGDWARF_X64_TARGET)
>
> +RELEASE_CLANGDWARF_X64_DLINK_FLAGS = --eh-frame-hdr -q --gc-
> sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -Map
> $(DEST_DIR_DEBUG)/$(BASE_NAME).map --whole-archive -O3 -
> melf_x86_64 --format=elf -pie
>
> +RELEASE_CLANGDWARF_X64_DLINK2_FLAGS =
>
> +RELEASE_CLANGDWARF_X64_GENFW_FLAGS =
>
> +
>
> +NOOPT_CLANGDWARF_X64_CC_FLAGS =
> DEF(CLANGDWARF_ALL_CC_FLAGS) -m64 "-
> DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -mcmodel=small -fpie -O0
> DEF(CLANGDWARF_X64_TARGET) -g
>
> +NOOPT_CLANGDWARF_X64_DLINK_FLAGS = --eh-frame-hdr -q --gc-
> sections -z common-page-size=0x40 --entry $(IMAGE_ENTRY_POINT) -Map
> $(DEST_DIR_DEBUG)/$(BASE_NAME).map --whole-archive -O0 -
> melf_x86_64 --format=elf -pie
>
> +NOOPT_CLANGDWARF_X64_DLINK2_FLAGS =
>
> +NOOPT_CLANGDWARF_X64_GENFW_FLAGS = --keepexceptiontable
>
> +
>
> #
>
> #
>
> # XCODE5 support
>
> --
> 2.31.1.windows.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#75599): https://edk2.groups.io/g/devel/message/75599
> Mute This Topic: https://groups.io/mt/83095853/1781003
> Group Owner: devel+owner@edk2.groups.io<mailto:devel+owner@edk2.groups.io>
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [steven.shi@intel.com]
> -=-=-=-=-=-=
>
[-- Attachment #1.2: Type: text/html, Size: 33864 bytes --]
[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 8405 bytes --]
next prev parent reply other threads:[~2021-05-26 11:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-26 8:23 [PATCH 0/4] Support payload in ELF format Ni, Ray
2021-05-26 8:23 ` [PATCH 1/4] BaseTools: Create CLANGDWARF toolchain Ni, Ray
2021-05-26 11:35 ` Steven Shi [this message]
2021-05-28 2:52 ` 回复: [edk2-devel] " gaoliming
2021-05-28 14:31 ` Ni, Ray
2021-05-31 3:23 ` 回复: " gaoliming
2021-06-01 15:11 ` Ni, Ray
2021-06-02 2:18 ` 回复: " gaoliming
2021-05-26 8:23 ` [PATCH 2/4] MdePkg/UniversalPayload: Add definition for extra info in payload Ni, Ray
2021-05-26 8:23 ` [PATCH 3/4] UefiPayloadPkg: Add PayloadLoaderPeim which can load ELF payload Ni, Ray
2021-06-02 4:35 ` Guo Dong
2021-05-26 8:23 ` [PATCH 4/4] PeiCore: Remove assertion when failing to load PE image Ni, Ray
2021-05-26 10:53 ` [edk2-devel] [PATCH 0/4] Support payload in ELF format Steven Shi
2021-05-27 12:51 ` Ni, Ray
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=MWHPR11MB1950EB171867B8330973E7DF8C249@MWHPR11MB1950.namprd11.prod.outlook.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