From: "Liming Gao" <liming.gao@intel.com>
To: Alex James <theracermaster@gmail.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
"Gao, Liming" <liming.gao@intel.com>
Subject: Re: [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain
Date: Fri, 29 Nov 2019 00:23:59 +0000 [thread overview]
Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E54A604@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20191128055645.53053-1-theracermaster@gmail.com>
Alex:
Do you find the real issue without this fix? Or is this change just an enhancement?
As you know, now we are in hard code freeze phase. Only functional bug is allowed.
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 <michael.d.kinney@intel.com>; Gao, Liming
><liming.gao@intel.com>
>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 <michael.d.kinney@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>Signed-off-by: Alex James <theracermaster@gmail.com>
>---
> 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__ >= 4
>
>+#if (defined(__GNUC__) && __GNUC__ >= 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
next prev parent reply other threads:[~2019-11-29 0:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-28 5:56 [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Alex James
2019-11-28 13:16 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-11-29 0:23 ` Liming Gao [this message]
2019-11-29 6:11 ` Liming Gao
[not found] ` <15DB8D5B995A93E2.20368@groups.io>
2019-12-10 0:50 ` [edk2-devel] " Liming Gao
[not found] ` <15DEDC2D7232490F.29160@groups.io>
2019-12-18 2:06 ` Liming Gao
[not found] ` <15E15503EA811A55.14752@groups.io>
2019-12-20 6:10 ` Liming Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4A89E2EF3DFEDB4C8BFDE51014F606A14E54A604@SHSMSX104.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox