From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BD607AC1824 for ; Sat, 10 Feb 2024 20:19:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=cNMp40LwBgDd7l5RErEhCh0oD0QiCiMiwTNLjdep0s4=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1707596345; v=1; b=kQu5NaMNHoR00vFtwy6F3N94U4BUpsNw3mQMfrf1i/Lc1fMfasWIODJV3LvZSl2/88XqVBSc 3c+IQrMDqME8PEfHlKlE5ZuKYgivgMNPp53X8t2JJmc6N6qCmKyuItE+FyKToieHOlAnomUfiAc 6wo3xDVKg47uqsyR7rLrad1k= X-Received: by 127.0.0.2 with SMTP id fChXYY7687511xlOHjsk4PFG; Sat, 10 Feb 2024 12:19:05 -0800 X-Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by mx.groups.io with SMTP id smtpd.web10.23192.1707596344742028692 for ; Sat, 10 Feb 2024 12:19:04 -0800 X-Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-53fa455cd94so1421831a12.2 for ; Sat, 10 Feb 2024 12:19:04 -0800 (PST) X-Gm-Message-State: pX1VgDzvk2BfmPxBjwiPztJIx7686176AA= X-Google-Smtp-Source: AGHT+IHDi8xohc+vjL8b+8VzhKfGEj45gCfzY8U/EVc7LZrJruDO1n1XygoVHaQ5Y5deyfS18pRcYw== X-Received: by 2002:a17:902:7594:b0:1d9:f495:cfa0 with SMTP id j20-20020a170902759400b001d9f495cfa0mr2953537pll.17.1707596343949; Sat, 10 Feb 2024 12:19:03 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVbfgASvMwJ+E9yL0NW5EvtOqtWtav4SqFM+lg90t+167bdhubPGoeQN9Ivq9w0A9n8SdCVrhXexjTj9BSgIRiIqzkaBBnoPSft6T6LPfwhZuuH67uDU8lyMqujhwPg6XAz7uMf1NHasgciAikYswbbTwCrvQ== X-Received: from localhost.localdomain ([50.46.253.1]) by smtp.gmail.com with ESMTPSA id v13-20020a170903238d00b001d916995423sm3403889plh.99.2024.02.10.12.19.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 12:19:03 -0800 (PST) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH v1 1/1] BaseTools: Don't Recurse NULL Includes Not Linked to Module Date: Sat, 10 Feb 2024 12:18:53 -0800 Message-ID: <20240210201853.1647-1-taylor.d.beebe@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,taylor.d.beebe@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=kQu5NaMN; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io When collecting the required library instances for modules and libraries, included libraries will be recursed to ensure the module is built with all the libraries directly linked to it and indirectly linked to it via included libraries. Using the following scenario as an example: [LibraryClasses.common.DXE_CORE] NULL|Path/To/Library1.inf // Includes DebugLib [LibraryClasses.common.DXE_DRIVER] NULL|Path/To/Library2.inf // Includes DebugLib [LibraryClasses.common.DXE_CORE, LibraryClasses.common.DXE_DRIVER] DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf [Components] MdeModulePkg/Core/Dxe/DxeMain.inf // Includes DebugLib The DXE_CORE NULL library will be assigned a fake library class like NULL1 and the DXE_DRIVER will be assigned NULL2. The recursion logic will see NULL1 as a directly linked and will add an instance of it to the list of libraries which need to be included in the module. When DebugLib is evaluated, the recursion logic will add the libraries DebugLib depends on to the queue which includes both NULL1 and NULL2. When NULL2 is unqueued, an instance of it will also be added to the list of libraries needed to build DxeMain which now means that both NULL1 and NULL2 have been linked. NULL includes outside of module overrides are not supported according to the spec, but we do it anyways so this seems like a case which should be fixed. This change updates the recursion logic to skip evaluating NULL libraries unless they are linked directly to the module/library being evaluated. Signed-off-by: Taylor Beebe Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen --- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py index 9e506fc646b1..ff6ff7360a76 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -122,7 +122,10 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha while len(LibraryConsumerList) > 0: M = LibraryConsumerList.pop() + ModuleIsLibrary = True if len(M.LibraryClass) > 0 else False for LibraryClassName in M.LibraryClasses: + if LibraryClassName.startswith("NULL") and ModuleIsLibrary: + continue if LibraryClassName not in LibraryInstance: # override library instance for this module LibraryPath = Platform.Modules[str(Module)].LibraryClasses.get(LibraryClassName,Platform.LibraryClasses[LibraryClassName, ModuleType]) -- 2.43.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115344): https://edk2.groups.io/g/devel/message/115344 Mute This Topic: https://groups.io/mt/104284056/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-