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.5771.1576822225334480098 for ; Thu, 19 Dec 2019 22:10:25 -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 fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2019 22:10:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,334,1571727600"; d="scan'208";a="248589484" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 19 Dec 2019 22:10:24 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 19 Dec 2019 22:10:23 -0800 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 19 Dec 2019 22:10:23 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.90]) by shsmsx102.ccr.corp.intel.com ([169.254.2.109]) with mapi id 14.03.0439.000; Fri, 20 Dec 2019 14:10:21 +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+9yIZa6ehq3qAgBDwd2CADKf8oIADaPdg Date: Fri, 20 Dec 2019 06:10:20 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E568B57@SHSMSX104.ccr.corp.intel.com> References: <20191128055645.53053-1-theracermaster@gmail.com> <15DB8D5B995A93E2.20368@groups.io> <15DEDC2D7232490F.29160@groups.io> <15E15503EA811A55.14752@groups.io> In-Reply-To: <15E15503EA811A55.14752@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 merge@796b380ca7d263ca504b82fe5317a78d3546d537 >-----Original Message----- >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >Liming Gao >Sent: Wednesday, December 18, 2019 10:07 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 has verified this change on OVMF boot to shell. I have no other comm= ent >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 t= o >>>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, Fiel= d)) >>>> >>>> #endif >>>> >>>>-#endif >>>> >>>> >>>> >>>> #ifndef OFFSET_OF >>>> >>>> #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field)) >>>> >>>>-- >>>>2.24.0 >>> >>> >>> >> >> >> > > >