ba2c15
From fbba8c5118b4ad6595e5d6e4fa85100db66cbe89 Mon Sep 17 00:00:00 2001
ba2c15
From: Peter Jones <pjones@redhat.com>
ba2c15
Date: Fri, 8 Jun 2018 16:46:37 -0400
ba2c15
Subject: [PATCH] Work around some intptr_t weirdnesses
ba2c15
ba2c15
Signed-off-by: Peter Jones <pjones@redhat.com>
ba2c15
---
ba2c15
 apps/route80h.c | 2 ++
ba2c15
 inc/efilink.h   | 2 +-
ba2c15
 2 files changed, 3 insertions(+), 1 deletion(-)
ba2c15
ba2c15
diff --git a/apps/route80h.c b/apps/route80h.c
ba2c15
index 5272dd3cd44..462fead906c 100644
ba2c15
--- a/apps/route80h.c
ba2c15
+++ b/apps/route80h.c
ba2c15
@@ -1,6 +1,8 @@
ba2c15
 #include <efi.h>
ba2c15
 #include <efilib.h>
ba2c15
 
ba2c15
+#include <stdint.h>
ba2c15
+
ba2c15
 /* this example program changes the Reserved Page Route (RPR) bit on ICH10's General
ba2c15
  * Control And Status Register (GCS) from LPC to PCI.  In practical terms, it routes
ba2c15
  * outb to port 80h to the PCI bus. */
ba2c15
diff --git a/inc/efilink.h b/inc/efilink.h
ba2c15
index cc5aa2dc57b..40a81581540 100644
ba2c15
--- a/inc/efilink.h
ba2c15
+++ b/inc/efilink.h
ba2c15
@@ -142,7 +142,7 @@ typedef struct _LIST_ENTRY {
ba2c15
 //  EFI_FIELD_OFFSET - returns the byte offset to a field within a structure
ba2c15
 //
ba2c15
 
ba2c15
-#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(intptr_t)(&(((TYPE *) 0)->Field)))
ba2c15
+#define EFI_FIELD_OFFSET(TYPE,Field) __builtin_offsetof(TYPE, Field)
ba2c15
 
ba2c15
 //
ba2c15
 //  CONTAINING_RECORD - returns a pointer to the structure
ba2c15
-- 
ba2c15
2.17.1
ba2c15