diff --git a/tools/firmware/etherboot/patches/build-Fix-%s-directive-argument-is-null-error.patch b/tools/firmware/etherboot/patches/build-Fix-%s-directive-argument-is-null-error.patch new file mode 100644 index 0000000..03a0bd4 --- /dev/null +++ b/tools/firmware/etherboot/patches/build-Fix-%s-directive-argument-is-null-error.patch @@ -0,0 +1,32 @@ +From 412acd7854de10e7194f362a6b1a3257a17974f7 Mon Sep 17 00:00:00 2001 +From: Valentine Barshak +Date: Sun, 9 Jun 2019 13:30:11 +0300 +Subject: [PATCH] [build] Fix "'%s' directive argument is null" error + +Use '%p' directive, and print handle's address if the address is null +and the handle doesn't have a name. This fixes the following +compilation error: + + interface/efi/efi_debug.c:334:3: error: '%s' directive + argument is null [-Werror=format-overflow=] + +Signed-off-by: Valentine Barshak +Signed-off-by: Michael Brown +--- + src/interface/efi/efi_debug.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c +index 8ea0a822d..de9b1af55 100644 +--- a/src/interface/efi/efi_debug.c ++++ b/src/interface/efi/efi_debug.c +@@ -331,8 +331,7 @@ void dbg_efi_protocols ( EFI_HANDLE handle ) { + + /* Sanity check */ + if ( ! handle ) { +- printf ( "HANDLE %s could not retrieve protocols\n", +- efi_handle_name ( handle ) ); ++ printf ( "HANDLE %p could not retrieve protocols\n", handle ); + return; + } + diff --git a/tools/firmware/etherboot/patches/build-Workaround-compilation-error-with-gcc-9.1.patch b/tools/firmware/etherboot/patches/build-Workaround-compilation-error-with-gcc-9.1.patch new file mode 100644 index 0000000..8ce1620 --- /dev/null +++ b/tools/firmware/etherboot/patches/build-Workaround-compilation-error-with-gcc-9.1.patch @@ -0,0 +1,51 @@ +From 1dd56dbd11082fb622c2ed21cfaced4f47d798a6 Mon Sep 17 00:00:00 2001 +From: Valentine Barshak +Date: Mon, 22 Jul 2019 10:47:50 +0100 +Subject: [PATCH] [build] Workaround compilation error with gcc 9.1 + +Compiling with gcc 9.1 generates lots of "taking address of packed +member of ... may result in an unaligned pointer value" warnings. + +Some of these warnings are genuine, and indicate correctly that parts +of iPXE currently require the CPU (or runtime environment) to support +unaligned accesses. For example: the TCP/IP receive data path will +attempt to access 32-bit fields that may not be aligned to a 32-bit +boundary. + +Other warnings are either spurious (such as when the pointer is to a +variable-length byte array, which can have no alignment requirement +anyway) or unhelpful (such as when the pointer is used solely to +provide a debug colour value for the DBGC() macro). + +There appears to be no easy way to silence the spurious warnings. +Since the ability to perform unaligned accesses is already a +requirement for iPXE, work around the problem by silencing this class +of warnings. + +Signed-off-by: Valentine Barshak +Modified-by: Michael Brown +Signed-off-by: Michael Brown +--- + src/Makefile.housekeeping | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping +index f8334921b..4b09e81f0 100644 +--- a/src/Makefile.housekeeping ++++ b/src/Makefile.housekeeping +@@ -185,6 +185,15 @@ WNST_TEST = $(CC) -Wstringop-truncation -x c -c /dev/null -o /dev/null \ + >/dev/null 2>&1 + WNST_FLAGS := $(shell $(WNST_TEST) && $(ECHO) '-Wno-stringop-truncation') + WORKAROUND_CFLAGS += $(WNST_FLAGS) ++ ++# gcc 9.1 generates warnings for taking address of packed member which ++# may result in an unaligned pointer value. Inhibit the warnings. ++# ++WNAPM_TEST = $(CC) -Wno-address-of-packed-member -x c -c /dev/null \ ++ -o /dev/null >/dev/null 2>&1 ++WNAPM_FLAGS := $(shell $(WNAPM_TEST) && \ ++ $(ECHO) '-Wno-address-of-packed-member') ++WORKAROUND_CFLAGS += $(WNAPM_FLAGS) + endif + + # Some versions of gas choke on division operators, treating them as diff --git a/tools/firmware/etherboot/patches/series b/tools/firmware/etherboot/patches/series index 86cb300..07c2c4b 100644 --- a/tools/firmware/etherboot/patches/series +++ b/tools/firmware/etherboot/patches/series @@ -1 +1,4 @@ boot_prompt_option.patch +zbin-Fix-compiler-warning-with-gcc-9.patch +build-Workaround-compilation-error-with-gcc-9.1.patch +build-Fix-%s-directive-argument-is-null-error.patch diff --git a/tools/firmware/etherboot/patches/zbin-Fix-compiler-warning-with-gcc-9.patch b/tools/firmware/etherboot/patches/zbin-Fix-compiler-warning-with-gcc-9.patch new file mode 100644 index 0000000..e48307f --- /dev/null +++ b/tools/firmware/etherboot/patches/zbin-Fix-compiler-warning-with-gcc-9.patch @@ -0,0 +1,54 @@ +From 956f6a7227b62ce98d7840439af17bbca04f0c86 Mon Sep 17 00:00:00 2001 +From: Michael Brown +Date: Mon, 21 Jan 2019 11:17:04 +0000 +Subject: [PATCH] [zbin] Fix compiler warning with GCC 9 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +GCC 9 warns that abs() may truncate its signed long argument. Fix by +using labs() instead. + +Reported-by: Martin Liška +Signed-off-by: Michael Brown +--- + src/util/zbin.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/src/util/zbin.c b/src/util/zbin.c +index 75fba583f..3a4670b88 100644 +--- a/src/util/zbin.c ++++ b/src/util/zbin.c +@@ -386,16 +386,16 @@ static int process_zinfo_add ( struct input_file *input + ( ( 1UL << ( 8 * datasize ) ) - 1 ) : ~0UL ); + + if ( val < 0 ) { +- fprintf ( stderr, "Add %s%#x+%#lx at %#zx %sflows field\n", +- ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size, ++ fprintf ( stderr, "Add %s%#lx+%#lx at %#zx %sflows field\n", ++ ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size, + offset, ( ( addend < 0 ) ? "under" : "over" ) ); + return -1; + } + + if ( val & ~mask ) { +- fprintf ( stderr, "Add %s%#x+%#lx at %#zx overflows %zd-byte " ++ fprintf ( stderr, "Add %s%#lx+%#lx at %#zx overflows %zd-byte " + "field (%d bytes too big)\n", +- ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), size, ++ ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), size, + offset, datasize, + ( int )( ( val - mask - 1 ) * add->divisor ) ); + return -1; +@@ -414,9 +414,9 @@ static int process_zinfo_add ( struct input_file *input + } + + if ( DEBUG ) { +- fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#x+(%#zx/%#x)) = " ++ fprintf ( stderr, "ADDx [%#zx,%#zx) (%s%#lx+(%#zx/%#x)) = " + "%#lx\n", offset, ( offset + datasize ), +- ( ( addend < 0 ) ? "-" : "" ), abs ( addend ), ++ ( ( addend < 0 ) ? "-" : "" ), labs ( addend ), + len, add->divisor, val ); + } +