From nobody Fri May 17 10:34:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+86747+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+86747+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1645151477010891.3169101966523; Thu, 17 Feb 2022 18:31:17 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id N01mYY1788612xq1Ux1iIz4F; Thu, 17 Feb 2022 18:31:18 -0800 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.6112.1645151475685665381 for ; Thu, 17 Feb 2022 18:31:17 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10261"; a="250789692" X-IronPort-AV: E=Sophos;i="5.88,377,1635231600"; d="scan'208";a="250789692" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 18:31:16 -0800 X-IronPort-AV: E=Sophos;i="5.88,377,1635231600"; d="scan'208";a="590004697" X-Received: from guominji-mobl1.ccr.corp.intel.com ([10.238.15.53]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 18:31:15 -0800 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen Subject: [edk2-devel] [PATCH 1/2] BaseTools/Conf: Reduce the ASSERT patch to save the binary size Date: Fri, 18 Feb 2022 10:30:07 +0800 Message-Id: <20220218023008.1347-2-guomin.jiang@intel.com> In-Reply-To: <20220218023008.1347-1-guomin.jiang@intel.com> References: <20220218023008.1347-1-guomin.jiang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,guomin.jiang@intel.com X-Gm-Message-State: qISwAXUpS5iYvhP7pPLuhGyWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1645151478; bh=nBRbAha8YGCvxlBN7MfciIAdU3V3yriRrvRrUhFMWaQ=; h=Cc:Date:From:Reply-To:Subject:To; b=AUbTR0KZ9aRtKcN918BatLYCH5yRo1zB6t9VbBZuRI/UdIY6SZBviEGHZinG2apP/B0 7GefJrKFqD77+OXow3gkO7W+E4P5a09jmZ5g2iOMhbFM49I60XsV4z0gWEKnE6La1Iq1z I9IVdAJkAFdbTE6FKWp4qUpY/ayfSSq9kiw= X-ZohoMail-DKIM: fail (Signature date is -1 seconds in the future.) X-ZM-MESSAGEID: 1645151486780100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3840 Use DEBUG_FILE to control ASSERT path Motivation and Goal: 1. The path will occupy many size in DEBUG build when file path is long 2. We hope can reduce the size but not impact the debug capability 3. If only use filename, we can search the filename to locate file. It can save many size meanwhile. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Guomin Jiang --- BaseTools/Conf/build_rule.template | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule= .template index f40118234471..ad0bae42be62 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -1,5 +1,5 @@ # -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
# Copyright (c) 2020, ARM Ltd. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent @@ -126,14 +126,14 @@ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj =20 - "$(CC)" /Fo${dst} $(DEPS_FLAGS) $(CC_FLAGS) $(INC) ${src} + "$(CC)" /Fo${dst} $(DEPS_FLAGS) /D DEBUG_FILE=3D"\"${s_base}.c\"" = $(CC_FLAGS) $(INC) ${src} =20 # For RVCTCYGWIN CC_FLAGS must be first to work around pathing iss= ues - "$(CC)" $(DEPS_FLAGS) $(CC_FLAGS) -c -o ${dst} $(INC) ${src} + "$(CC)" $(DEPS_FLAGS) -D DEBUG_FILE=3D"\"${s_base}.c\"" $(CC_FLAGS= ) -c -o ${dst} $(INC) ${src} =20 - "$(CC)" $(DEPS_FLAGS) $(CC_FLAGS) -o ${dst} $(INC) ${src} + "$(CC)" $(DEPS_FLAGS) -D DEBUG_FILE=3D"\"${s_base}.c\"" $(CC_FLAGS= ) -o ${dst} $(INC) ${src} =20 [C-Code-File.BASE.AARCH64,C-Code-File.SEC.AARCH64,C-Code-File.PEI_CORE.AAR= CH64,C-Code-File.PEIM.AARCH64,C-Code-File.BASE.ARM,C-Code-File.SEC.ARM,C-Co= de-File.PEI_CORE.ARM,C-Code-File.PEIM.ARM] @@ -146,7 +146,7 @@ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj =20 - "$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -c -o ${dst} $(INC) ${src} + "$(CC)" -D DEBUG_FILE=3D"\"${s_base}.c\"" $(CC_FLAGS) $(CC_XIPFLAG= S) -c -o ${dst} $(INC) ${src} =20 [C-Header-File] --=20 2.35.1.windows.2 -=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 (#86747): https://edk2.groups.io/g/devel/message/86747 Mute This Topic: https://groups.io/mt/89225321/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- From nobody Fri May 17 10:34:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+86748+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+86748+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1645151478345978.2705576164814; Thu, 17 Feb 2022 18:31:18 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id WeVuYY1788612xpKf0TarZ6j; Thu, 17 Feb 2022 18:31:19 -0800 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web10.6112.1645151475685665381 for ; Thu, 17 Feb 2022 18:31:18 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10261"; a="250789704" X-IronPort-AV: E=Sophos;i="5.88,377,1635231600"; d="scan'208";a="250789704" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 18:31:18 -0800 X-IronPort-AV: E=Sophos;i="5.88,377,1635231600"; d="scan'208";a="590004718" X-Received: from guominji-mobl1.ccr.corp.intel.com ([10.238.15.53]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 18:31:16 -0800 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [edk2-devel] [PATCH 2/2] MdePkg/Include: Define new DEBUG_FILE to specify path. Date: Fri, 18 Feb 2022 10:30:08 +0800 Message-Id: <20220218023008.1347-3-guomin.jiang@intel.com> In-Reply-To: <20220218023008.1347-1-guomin.jiang@intel.com> References: <20220218023008.1347-1-guomin.jiang@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,guomin.jiang@intel.com X-Gm-Message-State: G3puG6j5gmFQG7pVQL2lTNGex1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1645151479; bh=l7OJrlLUqmnsY6B3NMn0UuQ6bqOpNdoxjN7D+WNipBs=; h=Cc:Date:From:Reply-To:Subject:To; b=OV9wlZDO8o5wAjS62t2YoYAfLX0iPO5yuLt3qNp6RrBf9Cgbw3nn+yUgft/ZZTAHz1c NSv7IDKbO7icavdmLubcA2PvVztzHOa9zGdwm9a07vQIZY3SggUHWYA5djvlu2Zk5L55a 9KfWN83EZK5Ei29DzFMxCuge/tgPHXj2IuU= X-ZohoMail-DKIM: fail (Signature date is -1 seconds in the future.) X-ZM-MESSAGEID: 1645152387826100001 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3840 Use DEBUG_FILE to control ASSERT path Motivation and Goal: 1. The path will occupy many size in DEBUG build when file path is long 2. We hope can reduce the size but not impact the debug capability 3. If only use filename, we can search the filename to locate file. It can save many size meanwhile. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Guomin Jiang --- MdePkg/Include/Library/DebugLib.h | 39 ++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/MdePkg/Include/Library/DebugLib.h b/MdePkg/Include/Library/Deb= ugLib.h index 8d3d08638d73..5469c6308422 100644 --- a/MdePkg/Include/Library/DebugLib.h +++ b/MdePkg/Include/Library/DebugLib.h @@ -8,7 +8,7 @@ of size reduction when compiler optimization is disabled. If MDEPKG_NDEB= UG is defined, then debug and assert related macros wrapped by it are the NULL= implementations. =20 -Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -85,6 +85,31 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define DEBUG_LINE_NUMBER __LINE__ #endif =20 +// +// Source file. +// Default is use the to compiler provided __FILE__ macro value. The __FIL= E__ +// mapping can be overriden by predefining DEBUG_FILE +// +// Defining DEBUG_FILE to a fixed value is useful when comparing builds +// across machine or configuration with different slash or path +// file. +// +// Another benefit is we can customize the ASSERT path without depending on +// compiler ability +// +// It's for all no matter VS, GCC, CLANG +// +#ifdef DEBUG_FILE +#else +#define DEBUG_FILE __FILE__ +#endif + +// Blow override for keep clang behavior +#if defined (__clang__) && defined (__FILE_NAME__) +#undef DEBUG_FILE +#define DEBUG_FILE __FILE_NAME__ +#endif + /** Macro that converts a Boolean expression to a Null-terminated ASCII stri= ng. =20 @@ -337,17 +362,9 @@ UnitTestDebugAssert ( IN CONST CHAR8 *Description ); =20 - #if defined (__clang__) && defined (__FILE_NAME__) -#define _ASSERT(Expression) UnitTestDebugAssert (__FILE_NAME__, DEBUG_LIN= E_NUMBER, DEBUG_EXPRESSION_STRING (Expression)) - #else -#define _ASSERT(Expression) UnitTestDebugAssert (__FILE__, DEBUG_LINE_NUM= BER, DEBUG_EXPRESSION_STRING (Expression)) - #endif +#define _ASSERT(Expression) UnitTestDebugAssert (DEBUG_FILE, DEBUG_LINE_N= UMBER, DEBUG_EXPRESSION_STRING (Expression)) #else - #if defined (__clang__) && defined (__FILE_NAME__) -#define _ASSERT(Expression) DebugAssert (__FILE_NAME__, DEBUG_LINE_NUMBER= , DEBUG_EXPRESSION_STRING (Expression)) - #else -#define _ASSERT(Expression) DebugAssert (__FILE__, DEBUG_LINE_NUMBER, DEB= UG_EXPRESSION_STRING (Expression)) - #endif +#define _ASSERT(Expression) DebugAssert (DEBUG_FILE, DEBUG_LINE_NUMBER, D= EBUG_EXPRESSION_STRING (Expression)) #endif =20 /** --=20 2.35.1.windows.2 -=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 (#86748): https://edk2.groups.io/g/devel/message/86748 Mute This Topic: https://groups.io/mt/89225322/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-