3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00

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.
This commit is contained in:
Mathieu Othacehe 2021-09-28 12:26:00 +00:00
parent 81a34a90d7
commit 26cb0c3960
No known key found for this signature in database
GPG key ID: 8354763531769CA6
4 changed files with 125 additions and 1 deletions

View file

@ -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 \

View file

@ -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

View file

@ -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 */

View file

@ -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) }
}