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 D50DAAC180F for ; Tue, 9 Apr 2024 19:36:58 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=av4KvAgo+u7FDdls/4yIV5GyA+LbZF5MmVbmt8N2jCw=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1712691417; v=1; b=BE1prVG9vKjzNgPXkRBUma3oGVUPKADz5oU1KBlyVLgCCSY0hW9ExADrjkPCLyZFq4cs156I RTnM2K+uWtBlWkiVztBZK4li+qYhkAYTTSz/DTzwpPM1sNHGBlCwGbIH7MKhqeQTqXOleRQQEKn hWMPXhFXZr9/6XxoU+i4Ms1TU01R6Q6UoRpnOloGevFOVDcHH4bwp7oku14WJ2NeUQS9eq+VIgB h9ft3vSnH8u9DeeiNnijEeT/f71V6/HJyiRm3CN/iLp8F4Xz9jWfzc8dQpbJ60Doc3CNFpv6DlT CtY+GVVg6GmwkQhLUGtBpgskL4A0b6uoS3cGCr18Ia7ig== X-Received: by 127.0.0.2 with SMTP id gAz3YY7687511xEUHiQghq9I; Tue, 09 Apr 2024 12:36:57 -0700 X-Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mx.groups.io with SMTP id smtpd.web11.148166.1712691416835988026 for ; Tue, 09 Apr 2024 12:36:56 -0700 X-Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6ed2dc03df6so2270862b3a.1 for ; Tue, 09 Apr 2024 12:36:56 -0700 (PDT) X-Gm-Message-State: sWJW0ypKsGVUPsmtH4IgWnWpx7686176AA= X-Google-Smtp-Source: AGHT+IEaiHIPDKjzWwSYvc0kUUOI7EsYjF5QCKgS7hILqFFaY9p3bSXZmbP2BbsNLvnxmOgWSBACMg== X-Received: by 2002:a05:6a21:6801:b0:1a8:ae85:17a1 with SMTP id wr1-20020a056a21680100b001a8ae8517a1mr933238pzb.36.1712691415949; Tue, 09 Apr 2024 12:36:55 -0700 (PDT) X-Received: from localhost.localdomain ([4.155.48.125]) by smtp.gmail.com with ESMTPSA id i26-20020aa787da000000b006ecbcbd2293sm9062104pfo.173.2024.04.09.12.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 12:36:55 -0700 (PDT) From: "Taylor Beebe" To: devel@edk2.groups.io Cc: Rebecca Cran , Liming Gao , Bob Feng , Yuwei Chen Subject: [edk2-devel] [PATCH v3 1/2] BaseTools: Don't Recurse NULL Includes Not Linked to Module Date: Tue, 9 Apr 2024 12:36:41 -0700 Message-Id: <20240409193642.484-2-taylor.d.beebe@gmail.com> In-Reply-To: <20240409193642.484-1-taylor.d.beebe@gmail.com> References: <20240409193642.484-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 Resent-Date: Tue, 09 Apr 2024 12:36:56 -0700 Resent-From: taylor.d.beebe@gmail.com 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=20240206 header.b=BE1prVG9; 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. Cc: Rebecca Cran Cc: Liming Gao Cc: Bob Feng Cc: Yuwei Chen Signed-off-by: Taylor Beebe Reviewed-by: Liming Gao --- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py index 9e506fc646..8bb6553c6f 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -123,6 +123,8 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha while len(LibraryConsumerList) > 0: M = LibraryConsumerList.pop() for LibraryClassName in M.LibraryClasses: + if LibraryClassName.startswith("NULL") and bool(M.LibraryClass): + 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.40.1.vfs.0.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117556): https://edk2.groups.io/g/devel/message/117556 Mute This Topic: https://groups.io/mt/105428855/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-