All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 8/8] x86/efi: Generate uefi_call_wrapper() when compiling with clang
Date: Wed, 10 Feb 2016 19:11:18 +0000	[thread overview]
Message-ID: <56BB8B56.4060703@citrix.com> (raw)
In-Reply-To: <56BB3DEF.9040801@citrix.com>

On 10/02/16 13:41, Andrew Cooper wrote:
> On 10/02/16 13:31, Jan Beulich wrote:
>>>>> On 09.02.16 at 21:01, <andrew.cooper3@citrix.com> wrote:
>>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>>> ---
>>> CC: Jan Beulich <JBeulich@suse.com>
>>>
>>> What is the GCC version check supposed to be achieving here?  GCC has
>>> supported this syntax since 3.0
>> This is best answered by looking at where we've got these headers
>> from - the gnu-efi package. It has ...
>>
>>> --- a/xen/include/asm-x86/x86_64/efibind.h
>>> +++ b/xen/include/asm-x86/x86_64/efibind.h
>>> @@ -274,7 +274,7 @@ typedef uint64_t   UINTN;
>>>  #endif
>>>  #endif
>>>  
>>> -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
>>> +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) || __clang__
>>>  #define uefi_call_wrapper(func, va_num, ...)	func(__VA_ARGS__)
>>>  #else
>>>  /* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
>> /* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
>> #if defined(HAVE_USE_MS_ABI)
>> #define uefi_call_wrapper(func, va_num, ...) func(__VA_ARGS__)
>> #else
>> UINTN uefi_call_wrapper(void *func, unsigned long va_num, ...);
>> #endif
>> #define EFI_FUNCTION __attribute__((ms_abi))
>>
>> I think this makes clear that the needed feature here is the
>> attribute, which certainly wasn't available in older gcc.
>>
>> With that the question is whether the Clang case won't also need
>> a version check, since I can't imagine them having supported this
>> prior to gcc introducing it.
> Clang has an substantially more sane way than GCC of checking for
> individual features.  I will introduce and use the
> __has_{attribute,feature}() infrastructure to tests like this.
>
> Experimentally, Clang 3.5 does have ms_abi support

Looking at it further, this entire block is unsed.  Nothing in tree
refers to uefi_call_wrapper() or EFI_FUNCTION_WRAPPER other than this
small bit; all declarations use EFIABI directly.

i.e. this:

diff --git a/xen/include/asm-x86/x86_64/efibind.h
b/xen/include/asm-x86/x86_64/efibind.h
index af5f424..b013db1 100644
--- a/xen/include/asm-x86/x86_64/efibind.h
+++ b/xen/include/asm-x86/x86_64/efibind.h
@@ -274,17 +274,6 @@ typedef uint64_t   UINTN;
 #endif
 #endif
 
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-#define uefi_call_wrapper(func, va_num, ...)   func(__VA_ARGS__)
-#else
-/* for x86_64, EFI_FUNCTION_WRAPPER must be defined */
-#ifdef  EFI_FUNCTION_WRAPPER
-UINTN uefi_call_wrapper(void *func, unsigned long va_num, ...);
-#else
-#error "EFI_FUNCTION_WRAPPER must be defined for x86_64 architecture"
-#endif
-#endif
-
 #ifdef _MSC_EXTENSIONS
 #pragma warning ( disable : 4731 )  // Suppress warnings about
modification of EBP
 #endif

works correctly for GCC and clang.  Would dropping this completely be
acceptable?

~Andrew

  reply	other threads:[~2016-02-10 19:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 20:01 [PATCH 0/8] xen/x86: Fix build with Clang 3.5 Andrew Cooper
2016-02-09 20:01 ` [PATCH 1/8] xen/lib: Fix ASSERT() to build with clang Andrew Cooper
2016-02-09 20:01 ` [PATCH 2/8] xen/misc: Remove or annotate possibly-unused functions Andrew Cooper
2016-02-10 10:42   ` Tim Deegan
2016-02-10 13:06   ` Jan Beulich
2016-02-10 13:15     ` Andrew Cooper
2016-02-09 20:01 ` [PATCH 3/8] xen/x86: Remove %z modifier from inline assembly Andrew Cooper
2016-02-10 13:10   ` Jan Beulich
2016-02-09 20:01 ` [PATCH 4/8] xen/x86: Fix section type mismatch in mm.c Andrew Cooper
2016-02-10 10:01   ` George Dunlap
2016-02-09 20:01 ` [PATCH 5/8] xen/x86: Improve annotation of autogen_entrypoints[] Andrew Cooper
2016-02-09 20:01 ` [PATCH 6/8] xen/x86: Avoid overriding initialisers in arrays Andrew Cooper
2016-02-10 10:11   ` George Dunlap
2016-02-10 13:22   ` Jan Beulich
2016-02-10 13:50     ` Andrew Cooper
2016-02-10 14:03       ` Jan Beulich
2016-02-10 14:13         ` George Dunlap
2016-02-16  7:06   ` Tian, Kevin
2016-02-09 20:01 ` [PATCH 7/8] xen/x86: Fix get_cpu_info() when built with clang Andrew Cooper
2016-02-09 20:01 ` [PATCH 8/8] x86/efi: Generate uefi_call_wrapper() when compiling " Andrew Cooper
2016-02-10 13:31   ` Jan Beulich
2016-02-10 13:41     ` Andrew Cooper
2016-02-10 19:11       ` Andrew Cooper [this message]
2016-02-11 10:45         ` Jan Beulich
2016-02-09 21:09 ` [PATCH 0/8] xen/x86: Fix build with Clang 3.5 Doug Goldstein
2016-02-10  9:28 ` Ian Campbell

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-all 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=56BB8B56.4060703@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.