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

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