[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH for-4.15] x86/efi: enable MS ABI attribute on clang


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 3 Feb 2021 18:58:05 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KmNkCv8sutdkYan5lMTj0IWcXRQ7sSkRkyHjZ+tlES4=; b=Mg8yzhq7V2l1cmX3wwwaq0Fh0gRN9mku506t/DrJ9beWgMKAkIha8GrW2T0QucjrV/uQYaidcOqMX1ANsZNQpbNH/NnOYw/XfoRuHGVl3SrbDgzU8iBddVgQ+ZVkEjGEFcIQRYxCxZ+HrIPsXuXEKvd4XwB9UNTtCH6Wu1aTZyXFx1dCR6RfmdGevH0rQGIU/RHBbpDqhXuuw8BkEhJpjVxr2kS5yF1dNEbmFDjq5V5MBxQ40HZRCB66OwyCvOCvAm010vEozzE4KLugyLPFsSNWuujJYm0t9zPdvHMpolY3jz2grO0sXfZ232TcnKzFxMFnfnFQz8YeIhVr7YOjjA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y29yYlYHYQ0x01KG4+/4leStVdhwQ48Yk1q/4DdE8q8c5k+LW6/jJGHRRE6hcXUP1FiCdYwNtsL9Yss4eGMxbkzFuYcifxlkfLMH1oIvw0boN94s9zZmT/uVX/U0HZr6/wBlw/8A06vkF12Wr20bmMtYZN7mwViPUxtYke1K8NCrgdr2huZTL8/8ojhFulxnqNkYDoCmqRT6Ikj/KojoTwwx0+6gd2Uq2A/yj7CuqHBNXQXXyIfVlff1F/FnsysJbyL4OPQSaAIdts82669Ms2Rnei7P52MBBhodMKMWN0HWliXfXHyCKewXEhSF6+TJmVgWlINWfUgMHSIbhO7YPg==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Wed, 03 Feb 2021 17:58:42 +0000
  • Ironport-sdr: vQIsZrlU8rjQ4RHzpTnfcjUbuRHoAJj4LFKkYEXTrVSMzpFLtqL34QLRmknlQxGDIz+iOeWqh+ s0hkX6lmFgzw+UwfCdaVZC25ziynybjqyD3C8r1c7sIb5WmHHaTyIwSTl7i4wHtu32nWOBXNui Mrep6DLd7vcQtk6TlJRnRpPnwlm4NA5i4yhg6FgX9g2Qgdmfi3aAI+R1uFZHgN3BofHnipNOui ADt5cAl2Ou3jYJnuj1nhxWzgzzy0ENYZiIUbzd1dlronveRoIw3ghmAlPW490EKBQGvm3ZJJsV 8ik=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Or else the EFI service calls will use the wrong calling convention.

The __ms_abi__ attribute is available on all supported versions of
clang.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>

Without this a Xen built with clang won't be able to correctly use the
EFI services, leading to weird messages from the firmware and crashes.
The impact of this fix for GCC users is exactly 0, and will fix the
build on clang.

The biggest fallout from this could be using the attribute on a
compiler that doesn't support it, which would translate into a build
failure, but the gitlab tests have shown no issues.
---
 xen/include/asm-x86/x86_64/efibind.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/asm-x86/x86_64/efibind.h 
b/xen/include/asm-x86/x86_64/efibind.h
index b013db175d..ddcfae07ec 100644
--- a/xen/include/asm-x86/x86_64/efibind.h
+++ b/xen/include/asm-x86/x86_64/efibind.h
@@ -172,7 +172,7 @@ typedef uint64_t   UINTN;
 #ifndef EFIAPI                  // Forces EFI calling conventions reguardless 
of compiler options
     #ifdef _MSC_EXTENSIONS
         #define EFIAPI __cdecl  // Force C calling convention for Microsoft C 
compiler
-    #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+    #elif __clang__ || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
         #define EFIAPI __attribute__((__ms_abi__))  // Force Microsoft ABI
     #else
         #define EFIAPI          // Substitute expresion to force C calling 
convention
-- 
2.29.2




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.