]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ipfire-netboot: Fix compiling and linking with new GCC & binutils
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Apr 2019 00:40:43 +0000 (01:40 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 28 Apr 2019 08:43:24 +0000 (09:43 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/ipfire-netboot
src/patches/ipxe-fix-stringop-truncation-warning-with-gcc-8-x.patch [new file with mode: 0644]
src/patches/ipxe-handle-R_X86_64_PLT32.patch [new file with mode: 0644]

index b316c9bbd8c4aa4ff134ca0b5457c702f7cac08b..23f5d43755fa0d8712d76ae9cb624ea0b8435aa8 100644 (file)
@@ -77,6 +77,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
 
        # Extract iPXE source
        cd $(DIR_APP) && tar axf $(DIR_DL)/ipxe-$(PXE_VER).tar.gz
+       cd $(DIR_APP)/ipxe-$(PXE_VER) && patch -Np1 < $(DIR_SRC)/src/patches/ipxe-fix-stringop-truncation-warning-with-gcc-8-x.patch
+       cd $(DIR_APP)/ipxe-$(PXE_VER) && patch -Np1 < $(DIR_SRC)/src/patches/ipxe-handle-R_X86_64_PLT32.patch
        cd $(DIR_APP) && rm -rfv ipxe && ln -s ipxe-$(PXE_VER) ipxe
        cd $(DIR_APP) && make $(MAKETUNING) bin/ipxe.lkrn
 ifeq "$(BUILD_ARCH)" "x86_64"
diff --git a/src/patches/ipxe-fix-stringop-truncation-warning-with-gcc-8-x.patch b/src/patches/ipxe-fix-stringop-truncation-warning-with-gcc-8-x.patch
new file mode 100644 (file)
index 0000000..af4bd59
--- /dev/null
@@ -0,0 +1,32 @@
+From ddfb60813c74e988ba7c16dbbe1b163593c9da4e Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail@eworm.de>
+Date: Tue, 15 May 2018 23:25:01 +0200
+Subject: [PATCH] [build] fix stringop truncation warning with GCC 8.x
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+GCC 8.x gives a warning about stringop truncation:
+
+util/elf2efi.c:497:2: error: ‘strncpy’ specified bound 8 equals destination
+size [-Werror=stringop-truncation]
+
+It assumes that strncpy() is intended to copy strings, which are NULL
+terminated. We do copy fixed size memory regions, so use memcpy() instead.
+---
+ src/util/elf2efi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
+index 6718df777..de3c92463 100644
+--- a/src/util/elf2efi.c
++++ b/src/util/elf2efi.c
+@@ -494,7 +494,7 @@ static struct pe_section * process_section ( struct elf_file *elf,
+       memset ( new, 0, sizeof ( *new ) + section_filesz );
+       /* Fill in section header details */
+-      strncpy ( ( char * ) new->hdr.Name, name, sizeof ( new->hdr.Name ) );
++      memcpy ( ( char * ) new->hdr.Name, name, sizeof ( new->hdr.Name ) );
+       new->hdr.Misc.VirtualSize = section_memsz;
+       new->hdr.VirtualAddress = shdr->sh_addr;
+       new->hdr.SizeOfRawData = section_filesz;
diff --git a/src/patches/ipxe-handle-R_X86_64_PLT32.patch b/src/patches/ipxe-handle-R_X86_64_PLT32.patch
new file mode 100644 (file)
index 0000000..ef2d434
--- /dev/null
@@ -0,0 +1,23 @@
+From 5dce2d454b2829431e0484ac0f993b7a2759e0df Mon Sep 17 00:00:00 2001
+From: Christian Hesse <mail@eworm.de>
+Date: Sat, 25 Aug 2018 13:53:08 +0200
+Subject: [PATCH] [build] handle R_X86_64_PLT32 from binutils 2.31
+
+Starting from binutils 2.31.0 (commit bd7ab16b) x86-64 assembler
+generates R_X86_64_PLT32 instead of R_X86_64_PC32.
+---
+ src/util/elf2efi.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/util/elf2efi.c b/src/util/elf2efi.c
+index 6718df777..2c5b9df8a 100644
+--- a/src/util/elf2efi.c
++++ b/src/util/elf2efi.c
+@@ -636,6 +636,7 @@ static void process_reloc ( struct elf_file *elf, const Elf_Shdr *shdr,
+               case ELF_MREL ( EM_ARM, R_ARM_THM_JUMP24 ) :
+               case ELF_MREL ( EM_ARM, R_ARM_V4BX ):
+               case ELF_MREL ( EM_X86_64, R_X86_64_PC32 ) :
++              case ELF_MREL ( EM_X86_64, R_X86_64_PLT32 ) :
+               case ELF_MREL ( EM_AARCH64, R_AARCH64_CALL26 ) :
+               case ELF_MREL ( EM_AARCH64, R_AARCH64_JUMP26 ) :
+               case ELF_MREL ( EM_AARCH64, R_AARCH64_ADR_PREL_LO21 ) :