From nobody Sun May 5 15:46:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+62063+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+62063+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1594017514; cv=none; d=zohomail.com; s=zohoarc; b=YaP3zr4zFrODPSFJYfXzjX7FE7Eiz44EY68F838HlZ5oRCvO167OTvELFvJSqRodv3RqmGZzfc/ngHPCOa9U+ULCFmqFjdl2rG5k6vhWiBZx7956QL6oHVCxdbWJZT369PqdVdyoOhi1+zIwlbZhPdnLsaYelmuH61kG8VHFGaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594017514; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=HgvAmmU5O6Guwxjz3PRGKOetTwql3wBNSEyvSjOzn7A=; b=D57iMBwj/Zl2xejtNwSzJol/90BJKIaMSc5WlUYTtQUaqB09CzBrNYF0FQ1A2puegau8mGN5PIqIUui2Y89cJArDZ6SifPbC1vK4tx4BI8h8ZdhXq03/5U2ht8+zIr3d4ilMwuCpTdDVLj92uLkV1uJ6dU/JZgOMfBXjZ87h+S4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+62063+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1594017514299794.027617567554; Sun, 5 Jul 2020 23:38:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 45RvYY1788612xfmKYjPbnqa; Sun, 05 Jul 2020 23:38:33 -0700 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.52507.1594017512360396127 for ; Sun, 05 Jul 2020 23:38:32 -0700 IronPort-SDR: 5F5IbqbiFYsNvRiW6XZAC5lGpZ4mCDwdbgLys/hdQPpSMvNFt7c1OXGWJLrUlQIxyQkKVNRNX6 JeAGzhHc+wOw== X-IronPort-AV: E=McAfee;i="6000,8403,9673"; a="145472468" X-IronPort-AV: E=Sophos;i="5.75,318,1589266800"; d="scan'208";a="145472468" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2020 23:38:31 -0700 IronPort-SDR: QPBa2krNW6KVCF5uT4T7J8fJvFFuEEQCT3vByiBDhkEjR5s12OoEtf1Acp5GrG3Qaof8LNkEDg V6A6g/PdW3iA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,318,1589266800"; d="scan'208";a="482599041" X-Received: from fieedk002.ccr.corp.intel.com ([10.239.158.178]) by fmsmga006.fm.intel.com with ESMTP; 05 Jul 2020 23:38:30 -0700 From: "Zhiguang Liu" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH] Using LLVM compiler set to build BaseTools in Linux Date: Mon, 6 Jul 2020 14:38:21 +0800 Message-Id: <20200706063821.1914-1-zhiguang.liu@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiguang.liu@intel.com X-Gm-Message-State: 4y7ckNuAzZD14xojzV3ULl2ix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1594017513; bh=NBR2tzSjxO7Ewt/QucFgatXLEmmDcbhN2xVhDdsys6s=; h=Cc:Date:From:Reply-To:Subject:To; b=Pla6nJIgRoCL1tmhrT2ei1qolzDEV1auefD0QtyrXmNd/SPbnKBOhRJAUjgdnhgVHvC Bg+iFtTBdAhule/vMHxCJpYIealEKl8u832NRuvD1B9NF3iiaU1lWMIum6F1X99OT8u0P G5xD3gkiFlMnssy6l7H/4qAMdqtb4U3rPxg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2842 To use LLVM to build BaseTools, first set the CLANG_BIN environment value, and add "CXX=3Dllvm" to choose LLVM compiler set when using make command. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Zhiguang Liu Reviewed-by: Bob Feng Reviewed-by: Yuwei Chen --- BaseTools/Source/C/Makefiles/header.makefile | 22 ++++++++++++++++++= ++-- BaseTools/Source/C/VfrCompile/GNUmakefile | 6 ++++-- BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 4 ++++ BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile | 4 ++++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Sourc= e/C/Makefiles/header.makefile index 4e9b36d98b..1c105ee7d4 100644 --- a/BaseTools/Source/C/Makefiles/header.makefile +++ b/BaseTools/Source/C/Makefiles/header.makefile @@ -38,12 +38,19 @@ endif CYGWIN:=3D$(findstring CYGWIN, $(shell uname -s)) LINUX:=3D$(findstring Linux, $(shell uname -s)) DARWIN:=3D$(findstring Darwin, $(shell uname -s)) - +ifeq ($(CXX), llvm) +BUILD_CC ?=3D $(CLANG_BIN)clang +BUILD_CXX ?=3D $(CLANG_BIN)clang++ +BUILD_AS ?=3D $(CLANG_BIN)clang +BUILD_AR ?=3D $(CLANG_BIN)llvm-ar +BUILD_LD ?=3D $(CLANG_BIN)llvm-ld +else BUILD_CC ?=3D gcc BUILD_CXX ?=3D g++ BUILD_AS ?=3D gcc BUILD_AR ?=3D ar BUILD_LD ?=3D ld +endif LINKER ?=3D $(BUILD_CC) ifeq ($(HOST_ARCH), IA32) ARCH_INCLUDE =3D -I $(MAKEROOT)/Include/Ia32/ @@ -72,14 +79,25 @@ ifeq ($(DARWIN),Darwin) BUILD_CFLAGS =3D -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror \ -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib= -g else +ifeq ($(CXX), llvm) +BUILD_CFLAGS =3D -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ +-fno-delete-null-pointer-checks -Wall -Werror \ +-Wno-deprecated-declarations -Wno-self-assign \ +-Wno-unused-result -nostdlib -g +else BUILD_CFLAGS =3D -MD -fshort-wchar -fno-strict-aliasing -fwrapv \ -fno-delete-null-pointer-checks -Wall -Werror \ -Wno-deprecated-declarations -Wno-stringop-truncation -Wno-restrict \ -Wno-unused-result -nostdlib -g endif +endif +ifeq ($(CXX), llvm) +BUILD_LFLAGS =3D +BUILD_CXXFLAGS =3D -Wno-deprecated-register -Wno-unused-result +else BUILD_LFLAGS =3D BUILD_CXXFLAGS =3D -Wno-unused-result - +endif ifeq ($(HOST_ARCH), IA32) # # Snow Leopard is a 32-bit and 64-bit environment. uname -m returns i386,= but gcc defaults diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C= /VfrCompile/GNUmakefile index 42e3d7da02..fc329944b9 100644 --- a/BaseTools/Source/C/VfrCompile/GNUmakefile +++ b/BaseTools/Source/C/VfrCompile/GNUmakefile @@ -16,9 +16,11 @@ TOOL_INCLUDE =3D -I Pccts/h #OBJECTS =3D VfrSyntax.o VfrServices.o DLGLexer.o EfiVfrParser.o ATokenBuf= fer.o DLexerBase.o AParser.o OBJECTS =3D AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.= o VfrSyntax.o \ VfrFormPkg.o VfrError.o VfrUtilityLib.o VfrCompiler.o - +ifeq ($(CXX), llvm) +VFR_CPPFLAGS =3D -Wno-deprecated-register -DPCCTS_USE_NAMESPACE_STD $(BUIL= D_CPPFLAGS) +else VFR_CPPFLAGS =3D -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS) - +endif # keep BUILD_OPTFLAGS last VFR_CXXFLAGS =3D $(BUILD_OPTFLAGS) =20 diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile b/BaseTools= /Source/C/VfrCompile/Pccts/antlr/makefile index 8f2cc78c59..559b1c99f1 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile +++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile @@ -164,7 +164,11 @@ PCCTS_H=3D../h # # UNIX (default) # +ifeq ($(CXX), llvm) +BUILD_CC?=3D$(CLANG_BIN)clang +else BUILD_CC?=3Dgcc +endif COPT=3D-O ANTLR=3D${BIN_DIR}/antlr DLG=3D${BIN_DIR}/dlg diff --git a/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile b/BaseTools/S= ource/C/VfrCompile/Pccts/dlg/makefile index b3a34d3b46..5a3561edec 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile +++ b/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile @@ -114,7 +114,11 @@ PCCTS_H=3D../h # # UNIX # +ifeq ($(CXX), llvm) +BUILD_CC?=3D$(CLANG_BIN)clang +else BUILD_CC?=3Dcc +endif COPT=3D-O ANTLR=3D${BIN_DIR}/antlr DLG=3D${BIN_DIR}/dlg --=20 2.25.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#62063): https://edk2.groups.io/g/devel/message/62063 Mute This Topic: https://groups.io/mt/75328235/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-