From aad209b2dd415d0e7a58d4c7ec6f77de73b1c74b Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:30:23 +0000 Subject: import gnu-efi-3.0.5-9.el7 --- diff --git a/.gitignore b/.gitignore index 8db06b6..986c7e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/gnu-efi-3.0.2.tar.bz2 +SOURCES/gnu-efi-3.0.5.tar.bz2 diff --git a/.gnu-efi.metadata b/.gnu-efi.metadata index 2e6dc61..efbc5cd 100644 --- a/.gnu-efi.metadata +++ b/.gnu-efi.metadata @@ -1 +1 @@ -9ba6583cb045fc5d901856abef2e2bb01da78aa7 SOURCES/gnu-efi-3.0.2.tar.bz2 +183dadda9de78a44bd2343ffbf7869458ff5372a SOURCES/gnu-efi-3.0.5.tar.bz2 diff --git a/SOURCES/0001-Mark-our-explicit-fall-through-so-Wextra-will-work-i.patch b/SOURCES/0001-Mark-our-explicit-fall-through-so-Wextra-will-work-i.patch new file mode 100644 index 0000000..7e18ea7 --- /dev/null +++ b/SOURCES/0001-Mark-our-explicit-fall-through-so-Wextra-will-work-i.patch @@ -0,0 +1,33 @@ +From f3d3ef07eb69072b8bd2b0c5d4e6243ea38ecec9 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 2 Feb 2017 13:51:27 -0500 +Subject: [PATCH 01/10] Mark our explicit fall through so -Wextra will work in + gcc 7 + +gcc 7 introduces detection of fall-through behavior in switch/case +statements, and will warn if -Wimplicit-fallthrough is present and there +is no comment stating that the fall-through is intentional. This is +also triggered by -Wextra, as it enables -Wimplicit-fallthrough=1. + +This patch adds the comment in the one place we use fall-through. + +Signed-off-by: Peter Jones +--- + lib/print.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/print.c b/lib/print.c +index b8a9d38..cb732f0 100644 +--- a/lib/print.c ++++ b/lib/print.c +@@ -1131,6 +1131,7 @@ Returns: + case 'X': + Item.Width = Item.Long ? 16 : 8; + Item.Pad = '0'; ++ /* falls through */ + case 'x': + ValueToHex ( + Item.Scratch, +-- +2.9.3 + diff --git a/SOURCES/0002-Fix-some-types-gcc-doesn-t-like.patch b/SOURCES/0002-Fix-some-types-gcc-doesn-t-like.patch new file mode 100644 index 0000000..bf5d73d --- /dev/null +++ b/SOURCES/0002-Fix-some-types-gcc-doesn-t-like.patch @@ -0,0 +1,72 @@ +From bbd65152010e04275825736f203a4bf929927a7f Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 2 Feb 2017 14:00:59 -0500 +Subject: [PATCH 02/10] Fix some types gcc doesn't like + +Most of these come from building on i386 with -Wextra, but they're still +incorrect everywhere else; they just happen to have identical typedefs +at other places, so the compiler doesn't care. + +Signed-off-by: Peter Jones +--- + apps/AllocPages.c | 2 +- + apps/FreePages.c | 2 +- + apps/route80h.c | 2 +- + inc/efilink.h | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/apps/AllocPages.c b/apps/AllocPages.c +index 77a082e..bb81849 100644 +--- a/apps/AllocPages.c ++++ b/apps/AllocPages.c +@@ -116,7 +116,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) + INTN AllocType = -1; + INTN MemType = -1; + INTN NumPages = -1; +- UINTN Addr = 0; ++ EFI_PHYSICAL_ADDRESS Addr = 0; + + InitializeLib(image, systab); + +diff --git a/apps/FreePages.c b/apps/FreePages.c +index bbf2f52..247c75d 100644 +--- a/apps/FreePages.c ++++ b/apps/FreePages.c +@@ -89,7 +89,7 @@ efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) + INTN err = 0; + + INTN PgCnt = -1; +- UINTN PhysAddr = 0; ++ EFI_PHYSICAL_ADDRESS PhysAddr = 0; + + InitializeLib(image, systab); + +diff --git a/apps/route80h.c b/apps/route80h.c +index b0b142f..723dd85 100644 +--- a/apps/route80h.c ++++ b/apps/route80h.c +@@ -138,7 +138,7 @@ efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) + lpcif.rcba &= ~1UL; + + Print(L"rcba: 0x%8x\n", lpcif.rcba, lpcif.rcba); +- set_bit((uint32_t *)(uint64_t)(lpcif.rcba + GCS_OFFSET_ADDR), ++ set_bit((uint32_t *)(unsigned long)(lpcif.rcba + GCS_OFFSET_ADDR), + GCS_RPR_SHIFT, GCS_RPR_PCI); + + return EFI_SUCCESS; +diff --git a/inc/efilink.h b/inc/efilink.h +index b2ff4fa..cc5aa2d 100644 +--- a/inc/efilink.h ++++ b/inc/efilink.h +@@ -142,7 +142,7 @@ typedef struct _LIST_ENTRY { + // EFI_FIELD_OFFSET - returns the byte offset to a field within a structure + // + +-#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field))) ++#define EFI_FIELD_OFFSET(TYPE,Field) ((UINTN)(&(((TYPE *) 0)->Field))) + + // + // CONTAINING_RECORD - returns a pointer to the structure +-- +2.9.3 + diff --git a/SOURCES/0003-Fix-arm-build-paths-in-the-makefile.patch b/SOURCES/0003-Fix-arm-build-paths-in-the-makefile.patch new file mode 100644 index 0000000..fd147a6 --- /dev/null +++ b/SOURCES/0003-Fix-arm-build-paths-in-the-makefile.patch @@ -0,0 +1,37 @@ +From fa85eb1b6ac4ceff1672c7152b6f842c2f2ff728 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 2 Feb 2017 14:31:25 -0500 +Subject: [PATCH 03/10] Fix arm build paths in the makefile + +Previous work was apparently done with arm-linux-gnueabi-gcc as a +cross-builder, but our armv7 builders have native gcc with the target as +armv7hl-linux-gnueabi, so we need to munge the arch there to get our arm +path. + +Signed-off-by: Peter Jones +--- + Make.defaults | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Make.defaults b/Make.defaults +index 51bd7d8..e4d2ac1 100755 +--- a/Make.defaults ++++ b/Make.defaults +@@ -62,12 +62,12 @@ OBJCOPY := $(prefix)$(CROSS_COMPILE)objcopy + + # Host/target identification + OS := $(shell uname -s) +-HOSTARCH := $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed s,i[3456789]86,ia32,) ++HOSTARCH := $(shell $(HOSTCC) -dumpmachine | cut -f1 -d- | sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' ) + ARCH := $(HOSTARCH) + + # Get ARCH from the compiler if cross compiling + ifneq ($(CROSS_COMPILE),) +- override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d-| sed s,i[3456789]86,ia32,) ++ override ARCH := $(shell $(CC) -dumpmachine | cut -f1 -d-| sed -e s,i[3456789]86,ia32, -e 's,armv7.*,arm,' ) + endif + + # FreeBSD (and possibly others) reports amd64 instead of x86_64 +-- +2.9.3 + diff --git a/SOURCES/0004-Work-around-Werror-maybe-uninitialized-not-being-ver.patch b/SOURCES/0004-Work-around-Werror-maybe-uninitialized-not-being-ver.patch new file mode 100644 index 0000000..a8c8b5f --- /dev/null +++ b/SOURCES/0004-Work-around-Werror-maybe-uninitialized-not-being-ver.patch @@ -0,0 +1,31 @@ +From 6f5781e191cca6c20a75b82cc467c2256cbb5901 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 2 Feb 2017 15:23:55 -0500 +Subject: [PATCH 04/10] Work around -Werror=maybe-uninitialized not being very + bright. + +The compiler doesn't believe the loop always executes at least once, +even though the data in the first array entry doesn't satisfy the exit +condition. So just initialize the thing to shut it up. + +Signed-off-by: Peter Jones +--- + apps/route80h.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/apps/route80h.c b/apps/route80h.c +index 723dd85..bf550a1 100644 +--- a/apps/route80h.c ++++ b/apps/route80h.c +@@ -102,7 +102,7 @@ efi_main (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab) + InitializeLib(image_handle, systab); + EFI_PCI_IO *pciio = NULL; + lpcif_t lpcif; +- EFI_STATUS rc; ++ EFI_STATUS rc = EFI_SUCCESS; + struct { + uint16_t vendor; + uint16_t device; +-- +2.9.3 + diff --git a/SOURCES/0005-Fix-a-sign-error-in-the-debughook-example-app.patch b/SOURCES/0005-Fix-a-sign-error-in-the-debughook-example-app.patch new file mode 100644 index 0000000..63dfabb --- /dev/null +++ b/SOURCES/0005-Fix-a-sign-error-in-the-debughook-example-app.patch @@ -0,0 +1,39 @@ +From 397b06ff74f7fd8fc71f5991bdfbfa6ef6da98fd Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 2 Feb 2017 15:25:48 -0500 +Subject: [PATCH 05/10] Fix a sign error in the debughook example app + +On ISO C90 on i386 4294967294 is a signed integer, and so x can't be +greater (or equal) to that. Make it an unsigned and choose a better type +for the variable. + +Signed-off-by: Peter Jones +--- + apps/debughook.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/apps/debughook.c b/apps/debughook.c +index fb6cdad..e1d1c50 100644 +--- a/apps/debughook.c ++++ b/apps/debughook.c +@@ -45,7 +45,7 @@ DebugHook(void) + UINT8 *data = NULL; + UINTN dataSize = 0; + EFI_STATUS efi_status; +- register volatile UINTN x = 0; ++ register volatile unsigned long long x = 0; + extern char _text, _data; + + if (x) +@@ -66,7 +66,7 @@ DebugHook(void) + while (x++) { + /* Make this so it can't /totally/ DoS us. */ + #if defined(__x86_64__) || defined(__i386__) || defined(__i686__) +- if (x > 4294967294) ++ if (x > 4294967294ULL) + break; + __asm__ __volatile__("pause"); + #elif defined(__aarch64__) +-- +2.9.3 + diff --git a/SOURCES/0006-Fix-typedef-of-EFI_PXE_BASE_CODE.patch b/SOURCES/0006-Fix-typedef-of-EFI_PXE_BASE_CODE.patch new file mode 100644 index 0000000..0c40957 --- /dev/null +++ b/SOURCES/0006-Fix-typedef-of-EFI_PXE_BASE_CODE.patch @@ -0,0 +1,49 @@ +From e4ca94374c7ece8ec0100075710af8638e42c203 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 8 Feb 2017 15:28:18 -0500 +Subject: [PATCH 06/10] Fix typedef of EFI_PXE_BASE_CODE + +Commit 751cbce3 fixed up a bunch of types to better match the edk2 +definitions and the names in the UEFI Spec, but while doing so +inadvertantly defined things thusly: + + INTERFACE_DECL(_EFI_PXE_BASE_CODE_PROTOCOL); + ... + typedef struct _EFI_PXE_BASE_CODE_PROTOCOL { + ... + } EFI_PXE_BASE_CODE_PROTOCOL; + ... + typedef struct _EFI_PXE_BASE_CODE_PROTOCOL _EFI_PXE_BASE_CODE; + typedef struct EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE; + +Because EFI_BASE_CODE_PROTOCOL is declared with a typedef, and is +therefore in the type namespace rather than the struct namespace, this +results in EFI_PXE_BASE_CODE being a forward declaration of an +incomplete type. The net result is that code which dereferences any +field in the struct, even with the correct names, will not correctly +build. + +This patch changes both _EFI_PXE_BASE_CODE and EFI_PXE_BASE_CODE +typedefs to inherit from struct _EFI_PXE_BASE_CODE_PROTOCOL. + +Signed-off-by: Peter Jones +--- + inc/efipxebc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/inc/efipxebc.h b/inc/efipxebc.h +index 580a6ef..3760c7c 100644 +--- a/inc/efipxebc.h ++++ b/inc/efipxebc.h +@@ -419,7 +419,7 @@ typedef struct _EFI_PXE_BASE_CODE_PROTOCOL { + // Use 'EFI_PXE_BASE_CODE_PROTOCOL_GUID' instead. + + typedef struct _EFI_PXE_BASE_CODE_PROTOCOL _EFI_PXE_BASE_CODE; +-typedef struct EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE; ++typedef struct _EFI_PXE_BASE_CODE_PROTOCOL EFI_PXE_BASE_CODE; + + // + // Call Back Definitions +-- +2.9.3 + diff --git a/SOURCES/0007-make-clang-not-complain-about-fno-merge-constants.patch b/SOURCES/0007-make-clang-not-complain-about-fno-merge-constants.patch new file mode 100644 index 0000000..311fe7b --- /dev/null +++ b/SOURCES/0007-make-clang-not-complain-about-fno-merge-constants.patch @@ -0,0 +1,28 @@ +From a01463c5035d2bacefc1ef7673b6ba2cc9815920 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 10 Feb 2017 15:16:42 -0500 +Subject: [PATCH 07/10] make clang not complain about -fno-merge-constants + +--- + Make.defaults | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/Make.defaults b/Make.defaults +index e4d2ac1..cc52195 100755 +--- a/Make.defaults ++++ b/Make.defaults +@@ -159,8 +159,9 @@ CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ + else + CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ + -fshort-wchar -fno-strict-aliasing \ +- -fno-merge-constants -ffreestanding -fno-stack-protector \ +- -fno-stack-check ++ -ffreestanding -fno-stack-protector \ ++ -fno-stack-check \ ++ $(if $(findstring gcc,$(CC)),-fno-merge-constants,) + endif + + ARFLAGS += -U +-- +2.9.3 + diff --git a/SOURCES/0008-Fix-another-place-clang-complains-about.patch b/SOURCES/0008-Fix-another-place-clang-complains-about.patch new file mode 100644 index 0000000..c1d85a4 --- /dev/null +++ b/SOURCES/0008-Fix-another-place-clang-complains-about.patch @@ -0,0 +1,26 @@ +From 0281df3c77fc4d8c67c0d23c656b4debed862989 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 10 Feb 2017 16:14:12 -0500 +Subject: [PATCH 08/10] Fix another place clang complains about + +Signed-off-by: Peter Jones +--- + lib/guid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/guid.c b/lib/guid.c +index bd1f1a5..6498e90 100644 +--- a/lib/guid.c ++++ b/lib/guid.c +@@ -97,7 +97,7 @@ static struct { + { &SMapId, L"ShellDevPathMap" }, + { &SAliasId, L"ShellAlias" }, + +- { NULL } ++ { NULL, L"" } + }; + + // +-- +2.9.3 + diff --git a/SOURCES/0009-route80h-remove-some-dead-code.patch b/SOURCES/0009-route80h-remove-some-dead-code.patch new file mode 100644 index 0000000..f5c723e --- /dev/null +++ b/SOURCES/0009-route80h-remove-some-dead-code.patch @@ -0,0 +1,33 @@ +From ba05cb606c6c3a4ec9f60c588abef52e355e5c1a Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 10 Feb 2017 16:14:55 -0500 +Subject: [PATCH 09/10] route80h: remove some dead code + +Signed-off-by: Peter Jones +--- + apps/route80h.c | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/apps/route80h.c b/apps/route80h.c +index bf550a1..5272dd3 100644 +--- a/apps/route80h.c ++++ b/apps/route80h.c +@@ -40,15 +40,6 @@ static inline void set_bit(volatile uint32_t *flag, int bit, int value) + Print(L"new value is 0x%2x\n", val); + } + +-static inline int configspace_matches_ids(void *config, uint32_t vendor_id, +- uint32_t device_id) +-{ +- uint32_t *cfg = config; +- if (cfg[0] == vendor_id && cfg[1] == device_id) +- return 1; +- return 0; +-} +- + static int is_device(EFI_PCI_IO *pciio, uint16_t vendor_id, uint16_t device_id) + { + lpcif_t lpcif; +-- +2.9.3 + diff --git a/SOURCES/0010-Make-clang-not-complain-about-the-debughook-s-optimi.patch b/SOURCES/0010-Make-clang-not-complain-about-the-debughook-s-optimi.patch new file mode 100644 index 0000000..312443f --- /dev/null +++ b/SOURCES/0010-Make-clang-not-complain-about-the-debughook-s-optimi.patch @@ -0,0 +1,57 @@ +From a94906bd487c1a2e6d7827f31d7eb46bc09f3b43 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Fri, 10 Feb 2017 16:18:14 -0500 +Subject: [PATCH 10/10] Make clang not complain about the debughook's + optimization settings + +... still won't work, of course, because nobody at clang takes compiler +compatibility seriously while they keep implying that you can pretend +it's gcc. + +Signed-off-by: Peter Jones +--- + Make.defaults | 3 ++- + apps/debughook.c | 5 +++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/Make.defaults b/Make.defaults +index cc52195..a7778a7 100755 +--- a/Make.defaults ++++ b/Make.defaults +@@ -161,7 +161,8 @@ CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ + -fshort-wchar -fno-strict-aliasing \ + -ffreestanding -fno-stack-protector \ + -fno-stack-check \ +- $(if $(findstring gcc,$(CC)),-fno-merge-constants,) ++ $(if $(findstring gcc,$(CC)),-fno-merge-constants,) \ ++ $(if $(findstring clang,$(CC)),-Wno-unknown-pragmas,) + endif + + ARFLAGS += -U +diff --git a/apps/debughook.c b/apps/debughook.c +index e1d1c50..fa36f62 100644 +--- a/apps/debughook.c ++++ b/apps/debughook.c +@@ -37,8 +37,9 @@ GetVariable(CHAR16 *var, UINT8 **data, UINTN *len, EFI_GUID owner) + EFI_GUID DUMMY_GUID = + {0x55aad538, 0x8f82, 0x4e2a, {0xa4,0xf0,0xbe, 0x59, 0x13, 0xb6, 0x5f, 0x1e}}; + ++#pragma GCC push_options ++#pragma GCC optimize ("0") + static void +-__attribute__((__optimize__("0"))) + DebugHook(void) + { + EFI_GUID guid = DUMMY_GUID; +@@ -81,7 +82,7 @@ DebugHook(void) + } + x = 1; + } +- ++#pragma GCC pop_options + + EFI_STATUS + efi_main (EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) +-- +2.9.3 + diff --git a/SOURCES/0011-Nerf-Werror-pragma-away.patch b/SOURCES/0011-Nerf-Werror-pragma-away.patch new file mode 100644 index 0000000..e976b57 --- /dev/null +++ b/SOURCES/0011-Nerf-Werror-pragma-away.patch @@ -0,0 +1,25 @@ +From 6671a712db5c4dfecd4e7026057a99d9b1c4fe5e Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 7 Mar 2017 10:11:19 -0500 +Subject: [PATCH] Nerf -Werror=pragma away + +--- + Make.defaults | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/Make.defaults b/Make.defaults +index a7778a7..8882701 100755 +--- a/Make.defaults ++++ b/Make.defaults +@@ -87,6 +87,8 @@ OBJDIR := $(TOPDIR)/$(ARCH) + # Arch-specific compilation flags + CPPFLAGS += -DCONFIG_$(ARCH) + ++CFLAGS += -Wno-error=pragmas ++ + ifeq ($(ARCH),ia64) + CFLAGS += -mfixed-range=f32-f127 + endif +-- +2.9.3 + diff --git a/SOURCES/0012-Make-ia32-use-our-own-div-asm-on-gnu-C-as-well.patch b/SOURCES/0012-Make-ia32-use-our-own-div-asm-on-gnu-C-as-well.patch new file mode 100644 index 0000000..beac84c --- /dev/null +++ b/SOURCES/0012-Make-ia32-use-our-own-div-asm-on-gnu-C-as-well.patch @@ -0,0 +1,34 @@ +From bbd1ee0379327a58e042d288e371f314b7df2d55 Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 15 Mar 2017 17:33:39 -0400 +Subject: [PATCH] Make ia32 use our own div asm on gnu C as well. + +--- + lib/ia32/math.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/ia32/math.c b/lib/ia32/math.c +index 81f51bf..fce7a8d 100644 +--- a/lib/ia32/math.c ++++ b/lib/ia32/math.c +@@ -140,7 +140,7 @@ DivU64x32 ( + // divide 64bit by 32bit and get a 64bit result + // N.B. only works for 31bit divisors!! + { +-#if defined(__GNUC__) && !defined(__MINGW32__) ++#if 0 && defined(__GNUC__) && !defined(__MINGW32__) + if (Remainder) + *Remainder = Dividend % Divisor; + return Dividend / Divisor; +@@ -157,7 +157,7 @@ DivU64x32 ( + + Rem = 0; + for (bit=0; bit < 64; bit++) { +-#ifdef __MINGW32__ ++#if defined(__GNUC__) || defined(__MINGW32__) + asm ( + "shll $1, %0\n\t" + "rcll $1, 4%0\n\t" +-- +2.12.0 + diff --git a/SOURCES/0013-Call-ar-in-deterministic-mode.patch b/SOURCES/0013-Call-ar-in-deterministic-mode.patch new file mode 100644 index 0000000..5aadbd4 --- /dev/null +++ b/SOURCES/0013-Call-ar-in-deterministic-mode.patch @@ -0,0 +1,71 @@ +From 0e95c51225b01f0ca79dafd607ae6a3e404db6be Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Tue, 28 Mar 2017 17:59:55 -0400 +Subject: [PATCH 13/13] Call ar in deterministic mode. + +We need the x86_64 and i686 builds of .a's to be the same, and that +means we need to not have timestamps. Also force the timestamps on disk +just in case that doesn't work, because RHEL's ar /silently ignores -D/. + +v2: use "ar rvD" not "ar rv -D". + +It's a wonder anybody ever gets these command line options right, if +"ar rv -D libfoo.a foo.o" doesn't use deterministic mode (or +complain), but "ar rvD libfoo.a foo.o" does. + +v3: Add a bunch of junk to try to set timestamps to 0 manually + +For some reason I'm still getting timestamps in the .a even though ar seems to +be invoked correctly. When I do "mock -r rhel-7-build --shell" and run make +manually, they're fine. Very strange. + +v4: go back to v2, the problem isn't in the make process. + +"ar rDv" works just fine, but /usr/lib/rpm/redhat/brp-strip-static-archive is +calling "%{__strip} -g $for_each.a", and it's rewriting our binary from +ts/uid/gid of 0/0/0 to $epoch/$UID/$GID. Awesomely /usr/bin/strip it seems to +have 3 modes of operation: +-U: the default, which adds $epoch/$UID/$GID to your binary archive + instead of just removing stuff. Clearly the Principle of Least + Surprise is strong here. +-p: preserve the timestamp from the original .a, but add UID and GID, + because this is 1980 and people use ar(1) for archiving stuff they + might want that out of. +-D: Condescend at you in a command line error and explain that -D both + is and is not a valid option: + /usr/bin/strip: invalid option -- 'D' + Usage: /usr/bin/strip in-file(s) + Removes symbols and sections from files + The options are: + ... + -D --enable-deterministic-archives + Produce deterministic output when stripping archives + So I agree that it's invalid, but I think we may be pronouncing that + second vowel differently. They say in-VAL-id, I say IN-vuh-lid. + +Nobody should ever have to run "strace -ttt -v -f -o make.strace make all", +just to discover the problem isn't even in there. + +Related: rhbz#1310782 + +Signed-off-by: Peter Jones +--- + Make.defaults | 2 +- + 1 files changed, 1 insertions(+), 1 deletion(-) + +diff --git a/Make.defaults b/Make.defaults +index aa15c73..8f36365 100755 +--- a/Make.defaults ++++ b/Make.defaults +@@ -167,7 +167,7 @@ CFLAGS += $(ARCH3264) -g -O2 -Wall -Wextra -Werror \ + $(if $(findstring clang,$(CC)),-Wno-unknown-pragmas,) + endif + +-ARFLAGS += -U ++ARFLAGS := rDv + ASFLAGS += $(ARCH3264) + LDFLAGS += -nostdlib --warn-common --no-undefined --fatal-warnings \ + --build-id=sha1 +-- +2.9.3 + diff --git a/SPECS/gnu-efi.spec b/SPECS/gnu-efi.spec index 5d3f87a..5da7f9b 100644 --- a/SPECS/gnu-efi.spec +++ b/SPECS/gnu-efi.spec @@ -1,7 +1,7 @@ Summary: Development Libraries and headers for EFI Name: gnu-efi -Version: 3.0.2 -Release: 2%{?dist} +Version: 3.0.5 +Release: 9%{?dist}%{?buildid} Epoch: 1 Group: Development/System License: BSD @@ -9,10 +9,41 @@ URL: ftp://ftp.hpl.hp.com/pub/linux-ia64 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExclusiveArch: x86_64 aarch64 BuildRequires: git +%ifarch x86_64 +BuildRequires: glibc32 +#BuildRequires: glibc-devel(x86-32) +%endif Source: http://superb-dca2.dl.sourceforge.net/project/gnu-efi/gnu-efi-%{version}.tar.bz2 +Patch0001: 0001-Mark-our-explicit-fall-through-so-Wextra-will-work-i.patch +Patch0002: 0002-Fix-some-types-gcc-doesn-t-like.patch +Patch0003: 0003-Fix-arm-build-paths-in-the-makefile.patch +Patch0004: 0004-Work-around-Werror-maybe-uninitialized-not-being-ver.patch +Patch0005: 0005-Fix-a-sign-error-in-the-debughook-example-app.patch +Patch0006: 0006-Fix-typedef-of-EFI_PXE_BASE_CODE.patch +Patch0007: 0007-make-clang-not-complain-about-fno-merge-constants.patch +Patch0008: 0008-Fix-another-place-clang-complains-about.patch +Patch0009: 0009-route80h-remove-some-dead-code.patch +Patch0010: 0010-Make-clang-not-complain-about-the-debughook-s-optimi.patch +Patch0011: 0011-Nerf-Werror-pragma-away.patch +Patch0012: 0012-Make-ia32-use-our-own-div-asm-on-gnu-C-as-well.patch +Patch0013: 0013-Call-ar-in-deterministic-mode.patch + %define debug_package %{nil} +# brp-strip-static-archive will senselessly /add/ timestamps and uid/gid +# data to our .a and make them not multilib clean if we don't have this. +# Note that if we don't have the shell quotes there, -p becomes $2 on its +# invocation, and so it completely ignores it. +# +# Also note that if we try to use -D as we should (so it doesn't add +# uid/gid), strip(1) from binutils-2.25.1-22.base.el7.x86_64 throws a +# syntax error. +# +# True story. +# +%global __strip "%{__strip} -p" + # Figure out the right file path to use %global efidir %(eval echo $(grep ^ID= /etc/os-release | sed -e 's/^ID=//' -e 's/rhel/redhat/')) @@ -22,6 +53,9 @@ Source: http://superb-dca2.dl.sourceforge.net/project/gnu-efi/gnu-efi-%{version} %ifarch aarch64 %global efiarch aarch64 %endif +%ifarch %{ix86} +%global efiarch ia32 +%endif %description This package contains development headers and libraries for developing @@ -60,25 +94,34 @@ git config --unset user.name # Package cannot build with %{?_smp_mflags}. make make apps +%ifarch x86_64 +setarch linux32 -B make ARCH=ia32 PREFIX=%{_prefix} LIBDIR=%{_prefix}/lib +setarch linux32 -B make ARCH=ia32 PREFIX=%{_prefix} LIBDIR=%{_prefix}/lib apps +%endif %install rm -rf %{buildroot} -mkdir -p %{buildroot}/%{_libdir} - -make PREFIX=%{_prefix} LIBDIR=%{_libdir} INSTALLROOT=%{buildroot} install - mkdir -p %{buildroot}/%{_libdir}/gnuefi +mkdir -p %{buildroot}/boot/efi/EFI/%{efidir}/%{efiarch} +make PREFIX=%{_prefix} LIBDIR=%{_libdir} INSTALLROOT=%{buildroot} install mv %{buildroot}/%{_libdir}/*.lds %{buildroot}/%{_libdir}/*.o %{buildroot}/%{_libdir}/gnuefi +mv %{efiarch}/apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/%{efiarch}/ -mkdir -p %{buildroot}/boot/efi/EFI/%{efidir}/ -mv %{efiarch}/apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/ +%ifarch x86_64 +mkdir -p %{buildroot}/%{_prefix}/lib/gnuefi +mkdir -p %{buildroot}/boot/efi/EFI/%{efidir}/ia32 + +setarch linux32 -B make PREFIX=%{_prefix} LIBDIR=%{_prefix}/lib INSTALLROOT=%{buildroot} ARCH=ia32 install +mv %{buildroot}/%{_prefix}/lib/*.{lds,o} %{buildroot}/%{_prefix}/lib/gnuefi/ +mv ia32/apps/{route80h.efi,modelist.efi} %{buildroot}/boot/efi/EFI/%{efidir}/ia32/ +%endif %clean rm -rf %{buildroot} %files -%{_libdir}/* +%{_prefix}/lib*/* %files devel %defattr(-,root,root,-) @@ -87,9 +130,87 @@ rm -rf %{buildroot} %files utils %dir /boot/efi/EFI/%{efidir}/ -%attr(0644,root,root) /boot/efi/EFI/%{efidir}/*.efi +%attr(0644,root,root) /boot/efi/EFI/%{efidir}/*/*.efi %changelog +* Thu Mar 30 2017 Peter Jones - 3.0.5-9 +- Just don't build the .i686 package at all. After a scratch build, it's + clear that "strip -p" is not good enough, because our different builders + have non-matching UIDs for the build process, and -p adds uid/gid to the + archive. So there's no way to fix the multiarch conflict here without + either fixing that or fixing strip(1) with: + https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=patch;h=7a093a78 + We don't strictly need the .i686 package anyway, since we've moved to + making the dependent binaries all build the ia32 bits on x86_64 for + other reasons. Related: rhbz#1310782 + +* Thu Mar 30 2017 Peter Jones - 3.0.5-9 +- One more attempt at nerfing timestamps. It's surprising how broken this + can be. + + "ar rDv" works just fine, but + /usr/lib/rpm/redhat/brp-strip-static-archive is calling "%{__strip} -g + $for_each.a", and it's rewriting our binary from ts/uid/gid of 0/0/0 to + $epoch/$UID/$GID. Awesomely /usr/bin/strip it seems to have 3 modes of + operation: + -U: the default, which adds $epoch/$UID/$GID to your binary archive + instead of just removing stuff. Clearly the Principle of Least + Surprise is strong here. + -p: preserve the timestamp from the original .a, but add UID and GID, + because this is 1980 and people use ar(1) for archiving stuff they + might want that out of. + -D: Condescend at you in a command line error and explain that -D both + is and is not a valid option: + /usr/bin/strip: invalid option -- 'D' + Usage: /usr/bin/strip in-file(s) + Removes symbols and sections from files + The options are: + ... + -D --enable-deterministic-archives + Produce deterministic output when stripping archives + So I agree that it's invalid, but I think we may be pronouncing that + second vowel differently. They say in-VAL-id, I say IN-vuh-lid. + + Nobody should ever have to run "strace -ttt -v -f -o make.strace make + all", just to discover the problem isn't even in there. + Related: rhbz#1310782 + +* Tue Mar 28 2017 Peter Jones - 3.0.5-8 +- Nerf the timestamps on our .o files while building, because RHEL's ar(1) is + horrible and silently ignores the 'D' option. It's fine, I probably didn't + put it there for any reason. + Related: rhbz#1310782 + +* Tue Mar 28 2017 Peter Jones - 3.0.5-7 +- Call ar(1) in deterministic mode so our .a's are multipath clean. + Related: rhbz#1310782 + +* Mon Mar 20 2017 Peter Jones - 3.0.5-6 +- Also build the ia32 bits in a separate 32-bit package for other consumers. + Related: rhbz#1310782 + +* Wed Mar 15 2017 Peter Jones - 3.0.5-5 +- Fix a codegin bug that makes it want libgcc_s (but not know it) on ia32. + Related: rhbz#1310782 + +* Mon Mar 13 2017 Peter Jones - 3.0.5-4 +- Package the ia32 bits somewhat better. + Related: rhbz#1310782 + +* Mon Mar 13 2017 Peter Jones - 3.0.5-3 +- Include ia32 bits in the x86_64 packages instead of making a separate + 32-bit package + Resolves: rhbz#1310782 + +* Mon Mar 06 2017 Peter Jones - 3.0.5-2 +- Fix some bugs in the 3.0.5 release. + Related: rhbz#1310782 + +* Thu Feb 02 2017 Peter Jones - 3.0.5-1 +- Update to 3.0.5 +- Re-enable ia32 builds for the most hilarious changelog series... + Resolves: rhbz#1310782 + * Mon Jun 15 2015 Peter Jones - 3.0.2-2 - Fix .spec mismerge from upstream that causes ia32 to build. Related: rhbz#1190191