From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 84BE682220 for ; Wed, 22 Feb 2017 17:02:41 -0800 (PST) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B4BF9C05AA61; Thu, 23 Feb 2017 01:02:41 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-134.phx2.redhat.com [10.3.116.134]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1N12eMk014082; Wed, 22 Feb 2017 20:02:40 -0500 To: Yonghong Zhu , edk2-devel@ml01.01.org References: <1487639901-43004-1-git-send-email-yonghong.zhu@intel.com> Cc: Liming Gao From: Laszlo Ersek Message-ID: <43a78396-e70c-287e-275e-2891154c0d5c@redhat.com> Date: Thu, 23 Feb 2017 02:02:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1487639901-43004-1-git-send-email-yonghong.zhu@intel.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 23 Feb 2017 01:02:41 +0000 (UTC) Subject: Re: [Patch] BaseTools: add error check for Macro usage in the INF file 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, 23 Feb 2017 01:02:41 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Hi, On 02/21/17 02:18, Yonghong Zhu wrote: > Use of MACRO statements in the EDK II INF files is limited to local > usage only; global or external macros are not permitted. This patch > add the check for not defined macros. > > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Yonghong Zhu > --- > BaseTools/Source/Python/Workspace/MetaFileParser.py | 9 ++++++++- > BaseTools/Source/Python/Workspace/WorkspaceDatabase.py | 4 +++- > 2 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py > index 1a5fdf5..37a7f5d 100644 > --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py > +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py > @@ -1,9 +1,9 @@ > ## @file > # This file is used to parse meta files > # > -# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
> # (C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
> # This program and the accompanying materials > # are licensed and made available under the terms and conditions of the BSD License > # which accompanies this distribution. The full text of the license may be found at > # http://opensource.org/licenses/bsd-license.php > @@ -349,10 +349,17 @@ class MetaFileParser(object): > EdkLogger.error('Parser', FORMAT_INVALID, "No value specified", > ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) > > self._ValueList = [ReplaceMacro(Value, self._Macros) for Value in self._ValueList] > Name, Value = self._ValueList[1], self._ValueList[2] > + MacroUsed = GlobalData.gMacroRefPattern.findall(Value) > + if len(MacroUsed) != 0: > + for Macro in MacroUsed: > + if Macro in GlobalData.gGlobalDefines: > + EdkLogger.error("Parser", FORMAT_INVALID, "Global macro %s is not permitted." % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) > + else: > + EdkLogger.error("Parser", FORMAT_INVALID, "%s not defined" % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) > # Sometimes, we need to make differences between EDK and EDK2 modules > if Name == 'INF_VERSION': > if re.match(r'0[xX][\da-f-A-F]{5,8}', Value): > self._Version = int(Value, 0) > elif re.match(r'\d+\.\d+', Value): > diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py > index e7bc87d..0686721 100644 > --- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py > +++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py > @@ -1,9 +1,9 @@ > ## @file > # This file is used to create a database used by build tool > # > -# Copyright (c) 2008 - 2016, Intel Corporation. All rights reserved.
> +# Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.
> # (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> # This program and the accompanying materials > # are licensed and made available under the terms and conditions of the BSD License > # which accompanies this distribution. The full text of the license may be found at > # http://opensource.org/licenses/bsd-license.php > @@ -1828,10 +1828,12 @@ class InfBuildData(ModuleBuildClassObject): > self.__Macros = {} > # EDK_GLOBAL defined macros can be applied to EDK module > if self.AutoGenVersion < 0x00010005: > self.__Macros.update(GlobalData.gEdkGlobal) > self.__Macros.update(GlobalData.gGlobalDefines) > + else: > + self.__Macros.update(self.Defines) > return self.__Macros > > ## Get architecture > def _GetArch(self): > return self._Arch > I don't understand how, but this patch (commit dc4c770763d0) breaks OVMF for me. I bisected it, I didn't want to believe it, then I built the tree right before it, and that worked. I also built the tree at current master (526f160f311c, "ArmPkg/ArmMmuLib: AARCH64: enable stack alignment checking", 2017-02-22), with this commit reverted on top, and that also works. This is the error I see in the OVMF log: > Loading driver E660EA85-058E-4B55-A54B-F02F83A24707 > InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B 7E8752C0 > Loading driver at 0x0007E4B7000 EntryPoint=0x0007E4B727B DisplayEngine.efi > InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF 7E875518 > ProtectUefiImageCommon - 0x7E8752C0 > - 0x000000007E4B7000 - 0x000000000001BAE0 > ASSERT .../MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c(928): mCDLStringPackHandle != ((void *) 0) I don't have the slightest clue what's going on. Apparently, this change causes BaseTools to mis-build OVMF. Thanks Laszlo