summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-09-28 12:26:00 +0000
committerMathieu Othacehe <othacehe@gnu.org>2021-09-28 12:39:30 +0000
commit26cb0c396041379b9f441ae9646695d14a15b899 (patch)
tree01a165a6742236b6dc9d0d28bb519baedbc31647
parent81a34a90d72d3df39437a595958e25aca320640b (diff)
gnu: syslinux: Fix build.
* gnu/packages/patches/syslinux-gcc10.patch: New file. * gnu/packages/patches/syslinux-strip-gnu-property.patch: New file. * gnu/local.mk (DIST_PATCH_DATA): Add them. * gnu/packages/bootloaders.scm (syslinux)[source]: Use them. [arguments]: Only strip debug symbols.
-rw-r--r--gnu/local.mk2
-rw-r--r--gnu/packages/bootloaders.scm6
-rw-r--r--gnu/packages/patches/syslinux-gcc10.patch87
-rw-r--r--gnu/packages/patches/syslinux-strip-gnu-property.patch31
4 files changed, 125 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index aa5690b198..ca666c707f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1744,6 +1744,8 @@ dist_patch_DATA = \
%D%/packages/patches/slim-reset.patch \
%D%/packages/patches/slim-login.patch \
%D%/packages/patches/slim-display.patch \
+ %D%/packages/patches/syslinux-gcc10.patch \
+ %D%/packages/patches/syslinux-strip-gnu-property.patch \
%D%/packages/patches/snappy-add-O2-flag-in-CmakeLists.txt.patch \
%D%/packages/patches/snappy-add-inline-for-GCC.patch \
%D%/packages/patches/sphinxbase-fix-doxygen.patch \
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index cc23d77cf8..91c5830c6e 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -380,7 +380,10 @@ menu to select one of the installed operating systems.")
(file-name (git-file-name name version))
(sha256
(base32
- "0k8dvafd6410kqxf3kyr4y8jzmpmrih6wbjqg6gklak7945yflrc"))))
+ "0k8dvafd6410kqxf3kyr4y8jzmpmrih6wbjqg6gklak7945yflrc"))
+ (patches
+ (search-patches "syslinux-gcc10.patch"
+ "syslinux-strip-gnu-property.patch"))))
(build-system gnu-build-system)
(native-inputs
`(("nasm" ,nasm)
@@ -400,6 +403,7 @@ menu to select one of the installed operating systems.")
(string-append "MANDIR=" %output "/share/man")
"PERL=perl"
"bios")
+ #:strip-flags '("--strip-debug" "--enable-deterministic-archives")
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-files
diff --git a/gnu/packages/patches/syslinux-gcc10.patch b/gnu/packages/patches/syslinux-gcc10.patch
new file mode 100644
index 0000000000..8d3750b36e
--- /dev/null
+++ b/gnu/packages/patches/syslinux-gcc10.patch
@@ -0,0 +1,87 @@
+Taken from Gentoo and adapted to fix the build using GCC 10. See:
+https://bugs.gentoo.org/705730.
+
+--- a/mk/com32.mk
++++ b/mk/com32.mk
+@@ -47,6 +47,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ ifeq ($(FWCLASS),EFI)
+ GCCOPT += -mno-red-zone
+--- a/mk/elf.mk
++++ b/mk/elf.mk
+@@ -42,6 +42,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ com32 = $(topdir)/com32
+ core = $(topdir)/core
+--- a/mk/embedded.mk
++++ b/mk/embedded.mk
+@@ -51,6 +51,7 @@ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
+ GCCOPT += $(call gcc_ok,-fvisibility=hidden)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc)
+
+--- a/mk/lib.mk
++++ b/mk/lib.mk
+@@ -28,6 +28,7 @@ GCCOPT += $(call gcc_ok,-falign-functions=0,-malign-functions=0)
+ GCCOPT += $(call gcc_ok,-falign-jumps=0,-malign-jumps=0)
+ GCCOPT += $(call gcc_ok,-falign-labels=0,-malign-labels=0)
+ GCCOPT += $(call gcc_ok,-falign-loops=0,-malign-loops=0)
++GCCOPT += $(call gcc_ok,-fcommon)
+
+ INCLUDE = -I$(SRC)
+ STRIP = strip --strip-all -R .comment -R .note
+--- a/mk/efi.mk
++++ b/mk/efi.mk
+@@ -7,7 +7,7 @@ core = $(topdir)/core
+ # Set up architecture specifics; for cross compilation, set ARCH as apt
+ # gnuefi sets up architecture specifics in ia32 or x86_64 sub directories
+ # set up the LIBDIR and EFIINC for building for the appropriate architecture
+-GCCOPT := $(call gcc_ok,-fno-stack-protector,)
++GCCOPT := $(call gcc_ok,-fno-stack-protector,) $(call gcc_ok,-fcommon)
+ EFIINC = $(objdir)/include/efi
+ LIBDIR = $(objdir)/lib
+
+diff --git a/dos/string.h b/dos/string.h
+index f648de2..a502132 100644
+--- a/dos/string.h
++++ b/dos/string.h
+@@ -5,12 +5,13 @@
+ #ifndef _STRING_H
+ #define _STRING_H
+
++#include <stddef.h>
++
+ /* Standard routines */
+ #define memcpy(a,b,c) __builtin_memcpy(a,b,c)
+ #define memmove(a,b,c) __builtin_memmove(a,b,c)
+ #define memset(a,b,c) __builtin_memset(a,b,c)
+ #define strcpy(a,b) __builtin_strcpy(a,b)
+-#define strlen(a) __builtin_strlen(a)
+
+ /* This only returns true or false */
+ static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
+@@ -21,6 +22,13 @@ static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n)
+ return rv;
+ }
+
++static inline size_t strlen(const char *s)
++{
++ size_t len = 0;
++ while (*s++) len++;
++ return len;
++}
++
+ extern char *strchr(const char *s, int c);
+
+ #endif /* _STRING_H */ \ No newline at end of file
diff --git a/gnu/packages/patches/syslinux-strip-gnu-property.patch b/gnu/packages/patches/syslinux-strip-gnu-property.patch
new file mode 100644
index 0000000000..c656bbeedd
--- /dev/null
+++ b/gnu/packages/patches/syslinux-strip-gnu-property.patch
@@ -0,0 +1,31 @@
+Taken from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414.
+
+Author: Lukas Schwaighofer <lukas@schwaighofer.name>
+Description: Strip the .note.gnu.property section for the mbr. This section is
+ added since binutils Debian version 2.31.1-2 and causes mbr.bin to grow in
+ size beyond what can fit into the master boot record.
+---
+ mbr/i386/mbr.ld | 1 +
+ mbr/x86_64/mbr.ld | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/mbr/i386/mbr.ld b/mbr/i386/mbr.ld
+index d14ba80..5368346 100644
+--- a/mbr/i386/mbr.ld
++++ b/mbr/i386/mbr.ld
+@@ -70,4 +70,5 @@ SECTIONS
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ /DISCARD/ : { *(.note.GNU-stack) }
++ /DISCARD/ : { *(.note.gnu.property) }
+ }
+diff --git a/mbr/x86_64/mbr.ld b/mbr/x86_64/mbr.ld
+index ae27d49..b8c0d89 100644
+--- a/mbr/x86_64/mbr.ld
++++ b/mbr/x86_64/mbr.ld
+@@ -69,4 +69,5 @@ SECTIONS
+ .debug_typenames 0 : { *(.debug_typenames) }
+ .debug_varnames 0 : { *(.debug_varnames) }
+ /DISCARD/ : { *(.note.GNU-stack) }
++ /DISCARD/ : { *(.note.gnu.property) }
+ }