From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.5560.1576634819525386875 for ; Tue, 17 Dec 2019 18:06:59 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Dec 2019 18:06:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,327,1571727600"; d="scan'208";a="365607628" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga004.jf.intel.com with ESMTP; 17 Dec 2019 18:06:58 -0800 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 17 Dec 2019 18:06:58 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 17 Dec 2019 18:06:58 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.164]) with mapi id 14.03.0439.000; Wed, 18 Dec 2019 10:06:56 +0800 From: "Liming Gao" To: "devel@edk2.groups.io" , "Gao, Liming" , Alex James CC: "Kinney, Michael D" , "Liu, Zhiguang" Subject: Re: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Thread-Topic: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Thread-Index: AQHVpbCmSzy9A8DL+kyRFm9+9yIZa6ehq3qAgBDwd2CADKf8oA== Date: Wed, 18 Dec 2019 02:06:55 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E5673DE@SHSMSX104.ccr.corp.intel.com> References: <20191128055645.53053-1-theracermaster@gmail.com> <15DB8D5B995A93E2.20368@groups.io> <15DEDC2D7232490F.29160@groups.io> In-Reply-To: <15DEDC2D7232490F.29160@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Alex has verified this change on OVMF boot to shell. I have no other commen= t for it. Reviewed-by: Liming Gao Thanks Liming >-----Original Message----- >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >Liming Gao >Sent: Tuesday, December 10, 2019 8:50 AM >To: devel@edk2.groups.io; Gao, Liming ; Alex James > >Cc: Kinney, Michael D ; Liu, Zhiguang > >Subject: Re: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with >CLANGPDB toolchain > >Alex: > The change is good. Can you show what test has been done? > >Thanks >Liming >>-----Original Message----- >>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >>Liming Gao >>Sent: Friday, November 29, 2019 2:12 PM >>To: Alex James ; devel@edk2.groups.io >>Cc: Kinney, Michael D >>Subject: Re: [edk2-devel] [PATCH v1] MdePkg: Use __builtin_offset with >>CLANGPDB toolchain >> >>BZ https://bugzilla.tianocore.org/show_bug.cgi?id=3D2393 is submitted to >>record this issue. >> >>This is the corner issue when STATIC_ASSERT and OFFSET_OF are used >>together. So, I think we can fix it after stable tag 201911. >> >>Thanks >>Liming >>>-----Original Message----- >>>From: Alex James [mailto:theracermaster@gmail.com] >>>Sent: Thursday, November 28, 2019 1:57 PM >>>To: devel@edk2.groups.io >>>Cc: Kinney, Michael D ; Gao, Liming >>> >>>Subject: [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB >toolchain >>> >>>CLANGPDB does not define __GNUC__, but it does define __clang__. >Check >>>for the __clang__ preprocessor definition to use __builtin_offsetof to >>>implement the OFFSET_OF macro. >>> >>>Cc: Michael D Kinney >>>Cc: Liming Gao >>>Signed-off-by: Alex James >>>--- >>> MdePkg/Include/Base.h | 4 +--- >>> 1 file changed, 1 insertion(+), 3 deletions(-) >>> >>>diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h >>>index 4680e64136..e0bcd0ae67 100644 >>>--- a/MdePkg/Include/Base.h >>>+++ b/MdePkg/Include/Base.h >>>@@ -781,11 +781,9 @@ typedef UINTN *BASE_LIST; >>> @return Offset, in bytes, of field. >>> >>> >>> >>> **/ >>> >>>-#ifdef __GNUC__ >>> >>>-#if __GNUC__ >=3D 4 >>> >>>+#if (defined(__GNUC__) && __GNUC__ >=3D 4) || defined(__clang__) >>> >>> #define OFFSET_OF(TYPE, Field) ((UINTN) __builtin_offsetof(TYPE, Field= )) >>> >>> #endif >>> >>>-#endif >>> >>> >>> >>> #ifndef OFFSET_OF >>> >>> #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field)) >>> >>>-- >>>2.24.0 >> >> >> > > >