Blame SOURCES/0021-Fix-up-efi_guid_cmp-s-alignment-problem-a-different-.patch

d5c737
From 9985cbbf4073ce9d0beec66bf702db9123758852 Mon Sep 17 00:00:00 2001
d5c737
From: Peter Jones <pjones@redhat.com>
d5c737
Date: Wed, 29 May 2019 10:11:24 -0400
d5c737
Subject: [PATCH 21/63] Fix up efi_guid_cmp()'s alignment problem a different
d5c737
 way
d5c737
d5c737
With the prior fix for efi_guid_cmp()'s alignment issue, abicheck shows:
d5c737
d5c737
1 function with some indirect sub-type change:
d5c737
d5c737
  [C]'function int efi_guid_cmp(void* const, void* const)' at <built-in>:34:1 has some indirect sub-type changes:
d5c737
    parameter 1 of type 'void* const' changed:
d5c737
      entity changed from 'void* const' to 'const efi_guid_t*'
d5c737
      type size hasn't changed
d5c737
    parameter 2 of type 'void* const' changed:
d5c737
      entity changed from 'void* const' to 'const efi_guid_t*'
d5c737
      type size hasn't changed
d5c737
d5c737
While this isn't a meaningful ABI difference in terms of linking, it is
d5c737
definitely worse than having the type actually specified.
d5c737
d5c737
This patch changes the type back to the previous type, but also changes
d5c737
the typedef to require a 1-byte alignment.  This will guarantee that all
d5c737
new builds of efi_guid_cmp() and related code have code generated in a
d5c737
way that's compatible with any alignment, thus alleviating the issue.
d5c737
d5c737
Signed-off-by: Peter Jones <pjones@redhat.com>
d5c737
---
d5c737
 src/guid.c                  | 2 +-
d5c737
 src/include/efivar/efivar.h | 4 ++--
d5c737
 2 files changed, 3 insertions(+), 3 deletions(-)
d5c737
d5c737
diff --git a/src/guid.c b/src/guid.c
d5c737
index 3156b3b7c60..306c9ff8287 100644
d5c737
--- a/src/guid.c
d5c737
+++ b/src/guid.c
d5c737
@@ -31,7 +31,7 @@
d5c737
 extern const efi_guid_t efi_guid_zero;
d5c737
 
d5c737
 int NONNULL(1, 2) PUBLIC
d5c737
-efi_guid_cmp(const void * const a, const void * const b)
d5c737
+efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b)
d5c737
 {
d5c737
 	return memcmp(a, b, sizeof (efi_guid_t));
d5c737
 }
d5c737
diff --git a/src/include/efivar/efivar.h b/src/include/efivar/efivar.h
d5c737
index ff95cb10791..11d9a9d7b78 100644
d5c737
--- a/src/include/efivar/efivar.h
d5c737
+++ b/src/include/efivar/efivar.h
d5c737
@@ -37,7 +37,7 @@ typedef struct {
d5c737
 	uint16_t	c;
d5c737
 	uint16_t	d;
d5c737
 	uint8_t		e[6];
d5c737
-} efi_guid_t;
d5c737
+} efi_guid_t __attribute__((__aligned__(1)));
d5c737
 
d5c737
 typedef struct {
d5c737
 	uint8_t		addr[4];
d5c737
@@ -128,7 +128,7 @@ extern int efi_symbol_to_guid(const char *symbol, efi_guid_t *guid)
d5c737
 
d5c737
 extern int efi_guid_is_zero(const efi_guid_t *guid);
d5c737
 extern int efi_guid_is_empty(const efi_guid_t *guid);
d5c737
-extern int efi_guid_cmp(const void * const a, const void * const b);
d5c737
+extern int efi_guid_cmp(const efi_guid_t *a, const efi_guid_t *b);
d5c737
 
d5c737
 /* import / export functions */
d5c737
 typedef struct efi_variable efi_variable_t;
d5c737
-- 
d5c737
2.26.2
d5c737