From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.4556.1622017420589843784 for ; Wed, 26 May 2021 01:23:40 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ray.ni@intel.com) IronPort-SDR: IlJvrCn4rbzpErhvBFIL8p78u13MDXzrdrmp5562FtXKeNmeoJPiCZ+gdw+cHY9Zv7JIbjOZYV PyxdY99UNU6A== X-IronPort-AV: E=McAfee;i="6200,9189,9995"; a="202448787" X-IronPort-AV: E=Sophos;i="5.82,331,1613462400"; d="scan'208";a="202448787" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2021 01:23:36 -0700 IronPort-SDR: WYHy8m4WSAAmuCGvle67aBk5zJthDMzTeurto6YjWnFzPVdq7w6OiRGbLhTnc7TTAtk3PcvUTl 6eAc82Hk5jsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,331,1613462400"; d="scan'208";a="479780437" Received: from ray-dev.ccr.corp.intel.com ([10.239.158.87]) by fmsmga002.fm.intel.com with ESMTP; 26 May 2021 01:23:35 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Subject: [PATCH 1/4] BaseTools: Create CLANGDWARF toolchain Date: Wed, 26 May 2021 16:23:07 +0800 Message-Id: <20210526082310.1597-2-ray.ni@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20210526082310.1597-1-ray.ni@intel.com> References: <20210526082310.1597-1-ray.ni@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Signed-off-by: Ray Ni --- 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 @@ =0D $(MAKE_FILE)=0D =0D - =0D + =0D + $(DEBUG_DIR)(+)$(MODULE_NAME).elf=0D +=0D + =0D $(DEBUG_DIR)(+)$(MODULE_NAME).dll=0D =0D =0D @@ -303,6 +306,11 @@ =0D "$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIB= RARY_FILES_LIST) $(DLINK2_FLAGS)=0D =0D + =0D + "$(DLINK)" -o ${dst} $(DLINK_FLAGS) @$(STATIC_LIBRARY_FILES_LIST) = =0D + "$(CP)" ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).debug=0D + "$(OBJCOPY)" --strip-unneeded -R .eh_frame ${dst}=0D +=0D =0D "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LI= BRARY_FILES_LIST),--end-group $(CC_FLAGS) $(DLINK2_FLAGS)=0D "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}=0D diff --git a/BaseTools/Conf/tools_def.template b/BaseTools/Conf/tools_def.t= emplate 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 =3D /NOLOGO /NO= DEFAULTLIB /IGNORE:4001 /OPT:RE NOOPT_CLANGPDB_X64_DLINK2_FLAGS =3D=0D NOOPT_CLANGPDB_X64_GENFW_FLAGS =3D --keepexceptiontable=0D =0D +##########################################################################= ##########=0D +#=0D +# CLANGDWARF - This configuration is used to compile under Windows/Linux/M= ac to produce=0D +# ELF binaries using LLVM/Clang/LLD with Link Time Optimization enabled=0D +#=0D +##########################################################################= ##########=0D +*_CLANGDWARF_*_*_FAMILY =3D GCC=0D +*_CLANGDWARF_*_*_BUILDRULEFAMILY =3D CLANGDWARF=0D +*_CLANGDWARF_*_MAKE_PATH =3D ENV(CLANG_HOST_BIN)make=0D +*_CLANGDWARF_*_*_DLL =3D ENV(CLANGPDB_DLL)=0D +*_CLANGDWARF_*_ASL_PATH =3D DEF(UNIX_IASL_BIN)=0D +=0D +*_CLANGDWARF_*_APP_FLAGS =3D=0D +*_CLANGDWARF_*_ASL_FLAGS =3D DEF(DEFAULT_WIN_ASL_FLAGS)=0D +*_CLANGDWARF_*_ASL_OUTFLAGS =3D DEF(DEFAULT_WIN_ASL_OUTFLAGS)=0D +*_CLANGDWARF_*_ASLDLINK_FLAGS =3D DEF(MSFT_ASLDLINK_FLAGS)=0D +*_CLANGDWARF_*_DEPS_FLAGS =3D DEF(GCC_DEPS_FLAGS)=0D +=0D +DEFINE CLANGDWARF_IA32_PREFIX =3D ENV(CLANG_BIN)=0D +DEFINE CLANGDWARF_X64_PREFIX =3D ENV(CLANG_BIN)=0D +=0D +DEFINE CLANGDWARF_IA32_TARGET =3D -target i686-pc-linux-gnu=0D +DEFINE CLANGDWARF_X64_TARGET =3D -target x86_64-pc-linux-gnu=0D +=0D +DEFINE CLANGDWARF_WARNING_OVERRIDES =3D -Wno-parentheses-equality -Wno-tau= tological-compare -Wno-tautological-constant-out-of-range-compare -Wno-empt= y-body -Wno-unused-const-variable -Wno-varargs -Wno-unknown-warning-option = -Wno-microsoft-enum-forward-reference=0D +DEFINE CLANGDWARF_ALL_CC_FLAGS =3D DEF(GCC48_ALL_CC_FLAGS) DEF(CLANGD= WARF_WARNING_OVERRIDES) -fno-stack-protector -funsigned-char -ftrap-functio= n=3Dundefined_behavior_has_been_optimized_away_by_clang -Wno-address -Wno-s= hift-negative-value -Wno-unknown-pragmas -Wno-incompatible-library-redeclar= ation -Wno-null-dereference -mno-implicit-float -mms-bitfields -mno-stack-a= rg-probe -nostdlib -nostdlibinc -fseh-exceptions=0D +=0D +###########################=0D +# CLANGDWARF IA32 definitions=0D +###########################=0D +*_CLANGDWARF_IA32_CC_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)clan= g=0D +*_CLANGDWARF_IA32_SLINK_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)llvm= -ar=0D +*_CLANGDWARF_IA32_DLINK_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)ld.l= ld=0D +*_CLANGDWARF_IA32_ASLDLINK_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)clan= g=0D +*_CLANGDWARF_IA32_ASM_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)clan= g=0D +*_CLANGDWARF_IA32_PP_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)clan= g=0D +*_CLANGDWARF_IA32_VFRPP_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)clan= g=0D +*_CLANGDWARF_IA32_ASLCC_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)clan= g=0D +*_CLANGDWARF_IA32_ASLPP_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)clan= g=0D +*_CLANGDWARF_IA32_OBJCOPY_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)llvm= -objcopy=0D +=0D +*_CLANGDWARF_IA32_ASLCC_FLAGS =3D DEF(GCC_ASLCC_FLAGS) -m32 -fno-= lto DEF(CLANGDWARF_IA32_TARGET)=0D +*_CLANGDWARF_IA32_ASM_FLAGS =3D DEF(GCC_ASM_FLAGS) -m32 -march= =3Di386 DEF(CLANGDWARF_IA32_TARGET)=0D +*_CLANGDWARF_IA32_OBJCOPY_FLAGS =3D=0D +*_CLANGDWARF_IA32_NASM_FLAGS =3D -f elf32=0D +*_CLANGDWARF_IA32_PP_FLAGS =3D DEF(GCC_PP_FLAGS) DEF(CLANGDWAR= F_IA32_TARGET)=0D +*_CLANGDWARF_IA32_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANGD= WARF_IA32_TARGET)=0D +*_CLANGDWARF_IA32_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANGD= WARF_IA32_TARGET)=0D +=0D +DEBUG_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANGDWARF_ALL_CC_FLAGS) -m= 32 -Oz -flto -march=3Di586 DEF(CLANGDWARF_IA32_TARGET) -g=0D +DEBUG_CLANGDWARF_IA32_DLINK_FLAGS =3D --eh-frame-hdr -q --gc-sections= -z common-page-size=3D0x40 --entry $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DE= BUG)/$(BASE_NAME).map --whole-archive -O3 -melf_i386 --format=3Delf=0D +DEBUG_CLANGDWARF_IA32_DLINK2_FLAGS =3D=0D +=0D +RELEASE_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANGDWARF_ALL_CC_FLAGS) -m= 32 -Oz -flto -march=3Di586 DEF(CLANGDWARF_IA32_TARGET)=0D +RELEASE_CLANGDWARF_IA32_DLINK_FLAGS =3D --eh-frame-hdr -q --gc-sections= -z common-page-size=3D0x40 --entry $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DE= BUG)/$(BASE_NAME).map --whole-archive -O3 -melf_i386 --format=3Delf=0D +RELEASE_CLANGDWARF_IA32_DLINK2_FLAGS =3D=0D +=0D +NOOPT_CLANGDWARF_IA32_CC_FLAGS =3D DEF(CLANGDWARF_ALL_CC_FLAGS) -m= 32 -O0 -march=3Di586 DEF(CLANGDWARF_IA32_TARGET) -g=0D +NOOPT_CLANGDWARF_IA32_DLINK_FLAGS =3D --eh-frame-hdr -q --gc-sections= -z common-page-size=3D0x40 --entry $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DE= BUG)/$(BASE_NAME).map --whole-archive -O0 -melf_i386 --format=3Delf=0D +NOOPT_CLANGDWARF_IA32_DLINK2_FLAGS =3D=0D +=0D +##########################=0D +# CLANGDWARF X64 definitions=0D +##########################=0D +*_CLANGDWARF_X64_CC_PATH =3D DEF(CLANGDWARF_X64_PREFIX)clang= =0D +*_CLANGDWARF_X64_SLINK_PATH =3D DEF(CLANGDWARF_X64_PREFIX)llvm-a= r=0D +*_CLANGDWARF_X64_DLINK_PATH =3D DEF(CLANGDWARF_X64_PREFIX)ld.lld= =0D +*_CLANGDWARF_X64_ASLDLINK_PATH =3D DEF(CLANGDWARF_X64_PREFIX)clang= =0D +*_CLANGDWARF_X64_ASM_PATH =3D DEF(CLANGDWARF_X64_PREFIX)clang= =0D +*_CLANGDWARF_X64_PP_PATH =3D DEF(CLANGDWARF_X64_PREFIX)clang= =0D +*_CLANGDWARF_X64_VFRPP_PATH =3D DEF(CLANGDWARF_X64_PREFIX)clang= =0D +*_CLANGDWARF_X64_ASLCC_PATH =3D DEF(CLANGDWARF_X64_PREFIX)clang= =0D +*_CLANGDWARF_X64_ASLPP_PATH =3D DEF(CLANGDWARF_X64_PREFIX)clang= =0D +*_CLANGDWARF_X64_OBJCOPY_PATH =3D DEF(CLANGDWARF_IA32_PREFIX)llvm-= objcopy=0D +=0D +*_CLANGDWARF_X64_ASLCC_FLAGS =3D DEF(GCC_ASLCC_FLAGS) -m64 -fno-l= to DEF(CLANGDWARF_X64_TARGET)=0D +*_CLANGDWARF_X64_ASM_FLAGS =3D DEF(GCC_ASM_FLAGS) -m64 DEF(CLAN= GDWARF_X64_TARGET)=0D +*_CLANGDWARF_X64_OBJCOPY_FLAGS =3D=0D +*_CLANGDWARF_X64_NASM_FLAGS =3D -f elf64=0D +*_CLANGDWARF_X64_PP_FLAGS =3D DEF(GCC_PP_FLAGS) DEF(CLANGDWARF= _X64_TARGET)=0D +*_CLANGDWARF_X64_ASLPP_FLAGS =3D DEF(GCC_ASLPP_FLAGS) DEF(CLANGDW= ARF_X64_TARGET)=0D +*_CLANGDWARF_X64_VFRPP_FLAGS =3D DEF(GCC_VFRPP_FLAGS) DEF(CLANGDW= ARF_X64_TARGET)=0D +=0D +DEBUG_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANGDWARF_ALL_CC_FLAGS) -m6= 4 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie= -Oz -flto DEF(CLANGDWARF_X64_TARGET) -g=0D +DEBUG_CLANGDWARF_X64_DLINK_FLAGS =3D --eh-frame-hdr -q --gc-sections = -z common-page-size=3D0x40 --entry $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEB= UG)/$(BASE_NAME).map --whole-archive -O3 -melf_x86_64 --format=3Delf -pie=0D +DEBUG_CLANGDWARF_X64_DLINK2_FLAGS =3D=0D +DEBUG_CLANGDWARF_X64_GENFW_FLAGS =3D --keepexceptiontable=0D +=0D +RELEASE_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANGDWARF_ALL_CC_FLAGS) -m6= 4 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie= -Oz -flto DEF(CLANGDWARF_X64_TARGET)=0D +RELEASE_CLANGDWARF_X64_DLINK_FLAGS =3D --eh-frame-hdr -q --gc-sections = -z common-page-size=3D0x40 --entry $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEB= UG)/$(BASE_NAME).map --whole-archive -O3 -melf_x86_64 --format=3Delf -pie=0D +RELEASE_CLANGDWARF_X64_DLINK2_FLAGS =3D=0D +RELEASE_CLANGDWARF_X64_GENFW_FLAGS =3D=0D +=0D +NOOPT_CLANGDWARF_X64_CC_FLAGS =3D DEF(CLANGDWARF_ALL_CC_FLAGS) -m6= 4 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall -fpie= -O0 DEF(CLANGDWARF_X64_TARGET) -g=0D +NOOPT_CLANGDWARF_X64_DLINK_FLAGS =3D --eh-frame-hdr -q --gc-sections = -z common-page-size=3D0x40 --entry $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEB= UG)/$(BASE_NAME).map --whole-archive -O0 -melf_x86_64 --format=3Delf -pie=0D +NOOPT_CLANGDWARF_X64_DLINK2_FLAGS =3D=0D +NOOPT_CLANGDWARF_X64_GENFW_FLAGS =3D --keepexceptiontable=0D +=0D #=0D #=0D # XCODE5 support=0D --=20 2.31.1.windows.1