diff options
author | Mike Gilbert <floppym@gentoo.org> | 2022-05-30 21:37:35 -0400 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2022-05-30 21:42:08 -0400 |
commit | 700a3d7c40c57f7ec7c207a907baced1aebddbf8 (patch) | |
tree | 7cc4852857e57215023b9a3e1f37e2deeeff62aa /sys-boot | |
parent | sys-boot/syslinux: set DATE and HEXDATE (diff) | |
download | gentoo-700a3d7c40c57f7ec7c207a907baced1aebddbf8.tar.gz gentoo-700a3d7c40c57f7ec7c207a907baced1aebddbf8.tar.bz2 gentoo-700a3d7c40c57f7ec7c207a907baced1aebddbf8.zip |
sys-boot/syslinux: backport ebuild changes to 6.04-pre1
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'sys-boot')
5 files changed, 616 insertions, 0 deletions
diff --git a/sys-boot/syslinux/files/6.04_pre1/0001-Strip-the-.note.gnu.property-section-for-the-mbr.patch b/sys-boot/syslinux/files/6.04_pre1/0001-Strip-the-.note.gnu.property-section-for-the-mbr.patch new file mode 100644 index 000000000000..5d823436bec8 --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0001-Strip-the-.note.gnu.property-section-for-the-mbr.patch @@ -0,0 +1,47 @@ +From 60fef313164d1048cf11423656732953776e5e2f Mon Sep 17 00:00:00 2001 +From: Lukas Schwaighofer <lukas@schwaighofer.name> +Date: Sat, 18 Aug 2018 12:48:21 +0200 +Subject: [PATCH 1/5] 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. + +Forwarded: https://www.syslinux.org/archives/2018-August/026168.html +--- + mbr/i386/mbr.ld | 6 +++++- + mbr/x86_64/mbr.ld | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/mbr/i386/mbr.ld b/mbr/i386/mbr.ld +index d14ba802..6d489904 100644 +--- a/mbr/i386/mbr.ld ++++ b/mbr/i386/mbr.ld +@@ -69,5 +69,9 @@ SECTIONS + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +- /DISCARD/ : { *(.note.GNU-stack) } ++ /DISCARD/ : ++ { ++ *(.note.GNU-stack) ++ *(.note.gnu.property) ++ } + } +diff --git a/mbr/x86_64/mbr.ld b/mbr/x86_64/mbr.ld +index ae27d49a..5b46db66 100644 +--- a/mbr/x86_64/mbr.ld ++++ b/mbr/x86_64/mbr.ld +@@ -68,5 +68,9 @@ SECTIONS + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } +- /DISCARD/ : { *(.note.GNU-stack) } ++ /DISCARD/ : ++ { ++ *(.note.GNU-stack) ++ *(.note.gnu.property) ++ } + } +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/6.04_pre1/0002-Force-the-linker-to-put-all-sections-into-a-single-P.patch b/sys-boot/syslinux/files/6.04_pre1/0002-Force-the-linker-to-put-all-sections-into-a-single-P.patch new file mode 100644 index 000000000000..33b6a36c63ea --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0002-Force-the-linker-to-put-all-sections-into-a-single-P.patch @@ -0,0 +1,311 @@ +From 0c646f067a6b766a5ce0434e5e4e7b839b511331 Mon Sep 17 00:00:00 2001 +From: Lukas Schwaighofer <lukas@schwaighofer.name> +Date: Sat, 18 Aug 2018 16:56:35 +0200 +Subject: [PATCH 2/5] Force the linker to put all sections into a single + PT_LOAD segment + +This is required when using binutils >= 2.31 which writes two PT_LOAD segments +by default. This is not supported by the wrapper.c script used to convert the +shared object into an elf binary. + +Forwarded: https://www.syslinux.org/archives/2018-August/026167.html +--- + efi/i386/syslinux.ld | 37 +++++++++++++++++++++---------------- + efi/x86_64/syslinux.ld | 37 +++++++++++++++++++++---------------- + 2 files changed, 42 insertions(+), 32 deletions(-) + +diff --git a/efi/i386/syslinux.ld b/efi/i386/syslinux.ld +index bab3fc74..19c16479 100644 +--- a/efi/i386/syslinux.ld ++++ b/efi/i386/syslinux.ld +@@ -19,6 +19,11 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") + OUTPUT_ARCH(i386) + ENTRY(_start) + ++PHDRS ++{ ++ all PT_LOAD ; ++} ++ + SECTIONS + { + . = 0; +@@ -31,7 +36,7 @@ SECTIONS + *(.text) + *(.text.*) + __text_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -40,7 +45,7 @@ SECTIONS + *(.rodata) + *(.rodata.*) + __rodata_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -49,14 +54,14 @@ SECTIONS + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __ctors_end = .; +- } ++ } :all + + .dtors : { + __dtors_start = .; + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __dtors_end = .; +- } ++ } :all + + . = ALIGN(4096); + .rel : { +@@ -64,7 +69,7 @@ SECTIONS + *(.rel.data) + *(.rel.data.*) + *(.rel.ctors) +- } ++ } :all + + . = ALIGN(4); + +@@ -72,14 +77,14 @@ SECTIONS + __gnu_hash_start = .; + *(.gnu.hash) + __gnu_hash_end = .; +- } ++ } :all + + + .dynsym : { + __dynsym_start = .; + *(.dynsym) + __dynsym_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -87,7 +92,7 @@ SECTIONS + __dynstr_start = .; + *(.dynstr) + __dynstr_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -104,7 +109,7 @@ SECTIONS + KEEP (*(.got.plt)) + KEEP (*(.got)) + __got_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -112,7 +117,7 @@ SECTIONS + __dynamic_start = .; + *(.dynamic) + __dynamic_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -122,19 +127,19 @@ SECTIONS + *(.data.*) + *(.lowmem) + __data_end = .; +- } ++ } :all + + .reloc : { + *(.reloc) +- } ++ } :all + + .symtab : { + *(.symtab) +- } ++ } :all + + .strtab : { + *(.strtab) +- } ++ } :all + + .bss (NOLOAD) : { + /* the EFI loader doesn't seem to like a .bss section, +@@ -148,7 +153,7 @@ SECTIONS + __bss_end = .; + *(.sbss) + *(.scommon) +- } ++ } :all + __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start); + __bss_dwords = (__bss_len + 3) >> 2; + +@@ -161,7 +166,7 @@ SECTIONS + *(.hugebss) + *(.hugebss.*) + __hugebss_end = .; +- } ++ } :all + + _end = .; + +diff --git a/efi/x86_64/syslinux.ld b/efi/x86_64/syslinux.ld +index 450641c6..a2c124fd 100644 +--- a/efi/x86_64/syslinux.ld ++++ b/efi/x86_64/syslinux.ld +@@ -19,6 +19,11 @@ OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") + OUTPUT_ARCH(i386:x86-64) + ENTRY(_start) + ++PHDRS ++{ ++ all PT_LOAD ; ++} ++ + SECTIONS + { + . = 0; +@@ -31,7 +36,7 @@ SECTIONS + *(.text) + *(.text.*) + __text_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -40,7 +45,7 @@ SECTIONS + *(.rodata) + *(.rodata.*) + __rodata_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -49,14 +54,14 @@ SECTIONS + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + __ctors_end = .; +- } ++ } :all + + .dtors : { + __dtors_start = .; + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + __dtors_end = .; +- } ++ } :all + + . = ALIGN(4096); + .rel : { +@@ -64,7 +69,7 @@ SECTIONS + *(.rel.data) + *(.rel.data.*) + *(.rel.ctors) +- } ++ } :all + + . = ALIGN(4); + +@@ -72,14 +77,14 @@ SECTIONS + __gnu_hash_start = .; + *(.gnu.hash) + __gnu_hash_end = .; +- } ++ } :all + + + .dynsym : { + __dynsym_start = .; + *(.dynsym) + __dynsym_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -87,7 +92,7 @@ SECTIONS + __dynstr_start = .; + *(.dynstr) + __dynstr_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -104,7 +109,7 @@ SECTIONS + KEEP (*(.got.plt)) + KEEP (*(.got)) + __got_end = .; +- } ++ } :all + + . = ALIGN(4); + +@@ -112,7 +117,7 @@ SECTIONS + __dynamic_start = .; + *(.dynamic) + __dynamic_end = .; +- } ++ } :all + + . = ALIGN(16); + +@@ -122,19 +127,19 @@ SECTIONS + *(.data.*) + *(.lowmem) + __data_end = .; +- } ++ } :all + + .reloc : { + *(.reloc) +- } ++ } :all + + .symtab : { + *(.symtab) +- } ++ } :all + + .strtab : { + *(.strtab) +- } ++ } :all + + .bss (NOLOAD) : { + /* the EFI loader doesn't seem to like a .bss section, +@@ -148,7 +153,7 @@ SECTIONS + __bss_end = .; + *(.sbss) + *(.scommon) +- } ++ } :all + __bss_len = ABSOLUTE(__bss_end) - ABSOLUTE(__bss_start); + __bss_dwords = (__bss_len + 3) >> 2; + +@@ -161,7 +166,7 @@ SECTIONS + *(.hugebss) + *(.hugebss.*) + __hugebss_end = .; +- } ++ } :all + + _end = .; + +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/6.04_pre1/0003-GCC-10-compatibility-patch.patch b/sys-boot/syslinux/files/6.04_pre1/0003-GCC-10-compatibility-patch.patch new file mode 100644 index 000000000000..6d60eab14bbb --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0003-GCC-10-compatibility-patch.patch @@ -0,0 +1,99 @@ +From b92e6e8f624c96acf2ce80192a893ee25de527a1 Mon Sep 17 00:00:00 2001 +From: Lukas Schwaighofer <lukas@schwaighofer.name> +Date: Sun, 16 Aug 2020 15:23:21 +0200 +Subject: [PATCH 3/5] GCC-10 compatibility patch + +* Add `-fcommon` to most gcc invocations to allow duplicate definitions +* __builtin_strlen is not really a "builtin" an implementation still + needs to be provided (source: + https://bugzilla.suse.com/show_bug.cgi?id=1166605#c5). Work around the + issue by supplying an inline function. The strlen function added to + dos/string.h was copied from com32/lib/strlen.c. +--- + dos/string.h | 11 ++++++++++- + mk/efi.mk | 1 + + mk/elf.mk | 1 + + mk/embedded.mk | 2 +- + mk/lib.mk | 2 +- + 5 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/dos/string.h b/dos/string.h +index f648de2d..c4649f5f 100644 +--- a/dos/string.h ++++ b/dos/string.h +@@ -5,12 +5,21 @@ + #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) ++ ++static inline size_t strlen(const char *s) ++{ ++ const char *ss = s; ++ while (*ss) ++ ss++; ++ return ss - s; ++} + + /* This only returns true or false */ + static inline int memcmp(const void *__m1, const void *__m2, unsigned int __n) +diff --git a/mk/efi.mk b/mk/efi.mk +index f097ad22..407bc077 100644 +--- a/mk/efi.mk ++++ b/mk/efi.mk +@@ -25,6 +25,7 @@ FORMAT=efi-app-$(EFI_SUBARCH) + + CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(EFI_SUBARCH) \ + -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \ ++ -fcommon \ + -Wall -I$(com32)/include -I$(com32)/include/sys \ + -I$(core)/include -I$(core)/ $(ARCHOPT) \ + -I$(com32)/lib/ -I$(com32)/libutil/include -std=gnu99 \ +diff --git a/mk/elf.mk b/mk/elf.mk +index b46dbd06..dc265ce9 100644 +--- a/mk/elf.mk ++++ b/mk/elf.mk +@@ -55,6 +55,7 @@ GPLINCLUDE = + endif + + CFLAGS = $(GCCOPT) $(GCCWARN) -W -Wall \ ++ -fcommon \ + -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ -DDYNAMIC_MODULE \ + -nostdinc -iwithprefix include \ + -I$(com32)/libutil/include -I$(com32)/include \ +diff --git a/mk/embedded.mk b/mk/embedded.mk +index 488dc0fc..fae13e20 100644 +--- a/mk/embedded.mk ++++ b/mk/embedded.mk +@@ -57,7 +57,7 @@ LIBGCC := $(shell $(CC) $(GCCOPT) --print-libgcc) + LD += -m elf_$(ARCH) + + # Note: use += for CFLAGS and SFLAGS in case something is set in MCONFIG.local +-CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare $(OPTFLAGS) $(INCLUDES) ++CFLAGS += $(GCCOPT) -g $(GCCWARN) -Wno-sign-compare -fcommon $(OPTFLAGS) $(INCLUDES) + SFLAGS += $(CFLAGS) -D__ASSEMBLY__ + + .SUFFIXES: .c .o .S .s .i .elf .com .bin .asm .lst .c32 .lss +diff --git a/mk/lib.mk b/mk/lib.mk +index f8591e56..6dd54295 100644 +--- a/mk/lib.mk ++++ b/mk/lib.mk +@@ -49,7 +49,7 @@ OPTFLAGS = -Os -march=$(MARCH) -falign-functions=0 -falign-jumps=0 \ + -falign-labels=0 -ffast-math -fomit-frame-pointer + WARNFLAGS = $(GCCWARN) -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline + +-CFLAGS = $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) $(LIBFLAGS) ++CFLAGS = $(OPTFLAGS) $(REQFLAGS) -fcommon $(WARNFLAGS) $(LIBFLAGS) + + ifeq ($(FWCLASS),EFI) + CFLAGS += -mno-red-zone +-- +2.35.1 + diff --git a/sys-boot/syslinux/files/6.04_pre1/0004-Inherit-toolchain-vars-from-environment.patch b/sys-boot/syslinux/files/6.04_pre1/0004-Inherit-toolchain-vars-from-environment.patch new file mode 100644 index 000000000000..40784f9b2698 --- /dev/null +++ b/sys-boot/syslinux/files/6.04_pre1/0004-Inherit-toolchain-vars-from-environment.patch @@ -0,0 +1,72 @@ +From 46d58e2b03e15a863aed8661b9ee922da4930a3e Mon Sep 17 00:00:00 2001 +From: Mike Gilbert <floppym@gentoo.org> +Date: Mon, 30 May 2022 11:57:07 -0400 +Subject: [PATCH 4/5] Inherit toolchain vars from environment + +--- + mk/syslinux.mk | 36 ++++++++++++++++++------------------ + 1 file changed, 18 insertions(+), 18 deletions(-) + +diff --git a/mk/syslinux.mk b/mk/syslinux.mk +index 593ff75f..91d984e8 100644 +--- a/mk/syslinux.mk ++++ b/mk/syslinux.mk +@@ -37,7 +37,7 @@ ifdef DEBUG + DEBUGOPT = -DDEBUG=$(DEBUG) + endif + +-NASM = nasm ++NASM ?= nasm + NASMOPT = -Ox $(DEBUGOPT) + + PERL = perl +@@ -46,29 +46,29 @@ UPX = upx + + CHMOD = chmod + +-CC = gcc ++CC ?= gcc + gcc_ok = $(shell tmpf=gcc_ok.$$$$.tmp; \ + if $(CC) $(GCCOPT) $(1) -c $(topdir)/dummy.c \ + -o $$tmpf 2>/dev/null ; \ + then echo '$(1)'; else echo '$(2)'; fi; \ + rm -f $$tmpf) + +-LD = ld +-OBJDUMP = objdump +-OBJCOPY = objcopy +-STRIP = strip +-AR = ar +-NM = nm +-RANLIB = ranlib +-STRIP = strip +-GZIPPROG = gzip +-XZ = xz +-PNGTOPNM = pngtopnm +-MCOPY = mcopy +-MFORMAT = mformat +-MKISOFS = mkisofs +-SED = sed +-WGET = wget ++LD ?= ld ++OBJDUMP ?= objdump ++OBJCOPY ?= objcopy ++STRIP ?= strip ++AR ?= ar ++NM ?= nm ++RANLIB ?= ranlib ++STRIP ?= strip ++GZIPPROG ?= gzip ++XZ ?= xz ++PNGTOPNM ?= pngtopnm ++MCOPY ?= mcopy ++MFORMAT ?= mformat ++MKISOFS ?= mkisofs ++SED ?= sed ++WGET ?= wget + + com32 = $(topdir)/com32 + +-- +2.35.1 + diff --git a/sys-boot/syslinux/syslinux-6.04_pre1-r3.ebuild b/sys-boot/syslinux/syslinux-6.04_pre1-r3.ebuild new file mode 100644 index 000000000000..4fba6cac1462 --- /dev/null +++ b/sys-boot/syslinux/syslinux-6.04_pre1-r3.ebuild @@ -0,0 +1,87 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="SYSLINUX, PXELINUX, ISOLINUX, EXTLINUX and MEMDISK bootloaders" +HOMEPAGE="https://www.syslinux.org/" +MY_P=${P/_/-} +SRC_URI="https://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/6.04/${MY_P}.tar.xz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="-* ~amd64 ~x86" +IUSE="abi_x86_32 abi_x86_64 +bios +efi" +REQUIRED_USE="|| ( bios efi ) + efi? ( || ( abi_x86_32 abi_x86_64 ) )" + +BDEPEND=" + dev-lang/perl + bios? ( + app-arch/upx + app-text/asciidoc + dev-lang/nasm + ) +" +RDEPEND=" + sys-apps/util-linux + sys-fs/mtools + dev-perl/Crypt-PasswdMD5 + dev-perl/Digest-SHA1 +" +DEPEND="${RDEPEND} + virtual/os-headers +" + +S=${WORKDIR}/${MY_P} + +QA_EXECSTACK="usr/share/syslinux/*" +QA_WX_LOAD="usr/share/syslinux/*" +QA_PRESTRIPPED="usr/share/syslinux/.*" +QA_FLAGS_IGNORED=".*" + +src_prepare() { + local PATCHES=( + "${FILESDIR}/syslinux-6.03-sysmacros.patch" + "${FILESDIR}/${PV}" + ) + default +} +src_compile() { + local DATE=$(date -u -r NEWS +%Y%m%d) + local HEXDATE=$(printf '0x%08x' "${DATE}") + + tc-export AR CC LD OBJCOPY RANLIB + unset LDFLAGS + + if use bios; then + emake bios DATE="${DATE}" HEXDATE="${HEXDATE}" + fi + if use efi; then + if use abi_x86_32; then + emake efi32 DATE="${DATE}" HEXDATE="${HEXDATE}" + fi + if use abi_x86_64; then + emake efi64 DATE="${DATE}" HEXDATE="${HEXDATE}" + fi + fi +} + +src_install() { + local firmware=( $(usev bios) ) + if use efi; then + use abi_x86_32 && firmware+=( efi32 ) + use abi_x86_64 && firmware+=( efi64 ) + fi + local args=( + INSTALLROOT="${ED}" + MANDIR='$(DATADIR)/man' + "${firmware[@]}" + install + ) + emake -j1 "${args[@]}" + einstalldocs + dostrip -x /usr/share/syslinux +} |