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

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