From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ml01.01.org (Postfix) with ESMTP id B6DFE1A1DF7 for ; Wed, 17 Aug 2016 20:10:09 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 17 Aug 2016 20:10:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,537,1464678000"; d="scan'208";a="1027406487" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 17 Aug 2016 20:10:03 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 17 Aug 2016 20:10:03 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 17 Aug 2016 20:10:02 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.147]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.181]) with mapi id 14.03.0248.002; Thu, 18 Aug 2016 11:10:02 +0800 From: "Gao, Liming" To: "Shi, Steven" , "edk2-devel@lists.01.org" CC: "ard.biesheuvel@linaro.org" Thread-Topic: [PATCH] BaseTools-CLANG38: Add O3 in Dlink2 flag Thread-Index: AQHR+IeJBr5fH1zL10KwgyyJ7wuXT6BOCt0g Date: Thu, 18 Aug 2016 03:10:00 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A1155EC57C@shsmsx102.ccr.corp.intel.com> References: <1471438897-32784-1-git-send-email-steven.shi@intel.com> In-Reply-To: <1471438897-32784-1-git-send-email-steven.shi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] BaseTools-CLANG38: Add O3 in Dlink2 flag X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2016 03:10:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable CLANG38 IA32 Arch also requires this change.=20 > -----Original Message----- > From: Shi, Steven > Sent: Wednesday, August 17, 2016 9:02 PM > To: edk2-devel@lists.01.org; Gao, Liming > Cc: ard.biesheuvel@linaro.org; Shi, Steven > Subject: [PATCH] BaseTools-CLANG38: Add O3 in Dlink2 flag >=20 > CLANG38 build fail after CC_FLAG is added in the link rule. > This failure is because the CLANG38 enable the LTO through LLVMgold.so > linker plugin, but the LLVMgold.so plugin cannot accept the clang -Oz > CC flag as build option. After CC_FLAG is added in the link rule, > the LLVMgold.so plugin reports linking error. LLVMgold.so only accept > -O0 ~ -O3, and you can see it in the LLVM gold plugin source code > in below: >=20 > http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_380/final/tools/gold/ > gold-plugin.cpp line173: >=20 > if (opt[1] < '0' || opt[1] > '3') > message(LDPL_FATAL, "Optimization level must be between 0 and 3"); >=20 > Add -O3 in the *_CLANG38_X64_DLINK2_FLAGS to override the -Oz flag in > *_CLANG38_X64_CC_FLAGS to pass LLVMgold.so linking. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Steven Shi > --- > BaseTools/Conf/tools_def.template | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/BaseTools/Conf/tools_def.template > b/BaseTools/Conf/tools_def.template > index 974656c..c8e80c9 100755 > --- a/BaseTools/Conf/tools_def.template > +++ b/BaseTools/Conf/tools_def.template > @@ -5518,7 +5518,7 @@ RELEASE_CLANG38_IA32_CC_FLAGS =3D > DEF(CLANG38_ALL_CC_FLAGS) -m32 -Oz -flto - > DEBUG_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) - > m64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall - > fpie -Oz -flto DEF(CLANG38_X64_TARGET) -g > RELEASE_CLANG38_X64_CC_FLAGS =3D DEF(CLANG38_ALL_CC_FLAGS) - > m64 "-DEFIAPI=3D__attribute__((ms_abi))" -mno-red-zone -mcmodel=3Dsmall - > fpie -Oz -flto DEF(CLANG38_X64_TARGET) > *_CLANG38_X64_DLINK_FLAGS =3D DEF(GCC5_IA32_X64_DLINK_FLAGS) - > Wl,-Oz -Wl,-melf_x86_64 -Wl,--oformat=3Delf64-x86-64 -Wl,-pie - > mcmodel=3Dsmall > -*_CLANG38_X64_DLINK2_FLAGS =3D DEF(GCC5_X64_DLINK2_FLAGS) > +*_CLANG38_X64_DLINK2_FLAGS =3D DEF(GCC5_X64_DLINK2_FLAGS) -O3 > *_CLANG38_X64_RC_FLAGS =3D DEF(GCC_X64_RC_FLAGS) > *_CLANG38_X64_OBJCOPY_FLAGS =3D > *_CLANG38_X64_NASM_FLAGS =3D -f elf64 > -- > 2.7.4