Blob Blame History Raw
From 787b53a66cbbec6b10d47264b9eea9b24bc4e34c Mon Sep 17 00:00:00 2001
From: Nigel Croxon <ncroxon@redhat.com>
Date: Mon, 6 Nov 2017 09:34:14 -0500
Subject: [PATCH 05/25] Add EFI_DRIVER_ENTRY_POINT support for MSVC/ARM64

Similar to what we do for other MSVC architectures.

Signed-off-by: Pete Batard <pete@akeo.ie>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
---
 inc/aarch64/efibind.h | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/inc/aarch64/efibind.h b/inc/aarch64/efibind.h
index 182a2109062..bdaa5238e84 100644
--- a/inc/aarch64/efibind.h
+++ b/inc/aarch64/efibind.h
@@ -115,9 +115,13 @@ typedef uint64_t   UINTN;
 
 //
 // When build similiar to FW, then link everything together as
-// one big module.
+// one big module. For the MSVC toolchain, we simply tell the
+// linker what our driver init function is using /ENTRY.
 //
-
+#if defined(_MSC_EXTENSIONS)
+#define EFI_DRIVER_ENTRY_POINT(InitFunction) \
+    __pragma(comment(linker, "/ENTRY:" # InitFunction))
+#else
 #define EFI_DRIVER_ENTRY_POINT(InitFunction)    \
     UINTN                                       \
     InitializeDriver (                          \
@@ -134,6 +138,7 @@ typedef uint64_t   UINTN;
         EFI_SYSTEM_TABLE *systab                \
         ) __attribute__((weak,                  \
                 alias ("InitializeDriver")));
+#endif
 
 #define LOAD_INTERNAL_DRIVER(_if, type, name, entry)    \
         (_if)->LoadInternal(type, name, entry)
-- 
2.15.0