commit:     aad4c7d1977e6bf97a8d17c445ff6a7a4f9e806c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 28 18:18:47 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 28 19:09:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aad4c7d1

sys-boot/syslinux: fix build w/ binutils-2.41[hardened]

Closes: https://bugs.gentoo.org/913129
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/syslinux-6.04-binutils-2.41.patch        | 74 ++++++++++++++++++++++
 sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild     |  1 +
 sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild     |  1 +
 3 files changed, 76 insertions(+)

diff --git a/sys-boot/syslinux/files/syslinux-6.04-binutils-2.41.patch 
b/sys-boot/syslinux/files/syslinux-6.04-binutils-2.41.patch
new file mode 100644
index 000000000000..530959fc478b
--- /dev/null
+++ b/sys-boot/syslinux/files/syslinux-6.04-binutils-2.41.patch
@@ -0,0 +1,74 @@
+https://bugs.gentoo.org/913129
+--- a/gnu-efi/gnu-efi-3.0/Make.defaults
++++ b/gnu-efi/gnu-efi-3.0/Make.defaults
+@@ -114,4 +114,4 @@ CFLAGS  += $(ARCH3264) -O2 -fpic -Wall -fshort-wchar 
-fno-strict-aliasing \
+            -fno-merge-constants -ffreestanding -fno-stack-protector       \
+            -fno-stack-check
+ ASFLAGS += $(ARCH3264)
+-LDFLAGS       += -nostdlib --warn-common --no-undefined --fatal-warnings
++LDFLAGS       += -nostdlib --warn-common --no-undefined --fatal-warnings 
--no-warn-rwx-segments -z notext
+--- a/gnu-efi/gnu-efi-3.0/apps/Makefile
++++ b/gnu-efi/gnu-efi-3.0/apps/Makefile
+@@ -52,7 +52,7 @@ ifneq (,$(findstring FreeBSD,$(OS)))
+ LDSCRIPT      = $(TOPDIR)/gnuefi/elf_$(ARCH)_fbsd_efi.lds
+ endif
+ 
+-LDFLAGS               += -shared -Bsymbolic -L../lib -L../gnuefi $(CRTOBJS)
++LDFLAGS               += -shared --no-warn-rwx-segments -z notext -Bsymbolic 
-L../lib -L../gnuefi $(CRTOBJS)
+ 
+ LOADLIBES     += -lefi -lgnuefi
+ LOADLIBES     += $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
+--- a/mk/com32.mk
++++ b/mk/com32.mk
+@@ -80,7 +80,7 @@ SFLAGS     = $(GCCOPT) $(GCCWARN) \
+            -I$(topdir)/core/include
+ 
+ COM32LD          = $(com32)/lib/$(ARCH)/elf.ld
+-LDFLAGS    = -m elf_$(ARCH) -shared --hash-style=gnu -T $(COM32LD)
++LDFLAGS    = -m elf_$(ARCH) -shared --no-warn-rwx-segments -z notext 
--hash-style=gnu -T $(COM32LD)
+ LIBGCC    := $(shell $(CC) $(GCCOPT) --print-libgcc)
+ 
+ LNXCFLAGS  = -I$(com32)/libutil/include $(GCCWARN) -O -g \
+--- a/mk/efi.mk
++++ b/mk/efi.mk
+@@ -38,7 +38,7 @@ CRT0 := $(LIBDIR)/crt0-efi-$(EFI_SUBARCH).o
+ LDSCRIPT := $(LIBDIR)/elf_$(EFI_SUBARCH)_efi.lds
+ 
+ LDFLAGS = -T $(SRC)/$(ARCH)/syslinux.ld -Bsymbolic -pie -nostdlib 
-znocombreloc \
+-              -L$(LIBDIR) --hash-style=gnu -m elf_$(ARCH) $(CRT0) -E
++              -L$(LIBDIR) --no-warn-rwx-segments -z notext --hash-style=gnu 
-m elf_$(ARCH) $(CRT0) -E
+ 
+ SFLAGS     = $(GCCOPT) $(GCCWARN) $(ARCHOPT) \
+            -fomit-frame-pointer -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ \
+--- a/mk/elf.mk
++++ b/mk/elf.mk
+@@ -68,7 +68,7 @@ GCCOPT += -mregparm=3 -DREGPARM=3
+ endif
+ 
+ SFLAGS     = $(GCCOPT) -D__COM32__ -D__FIRMWARE_$(FIRMWARE)__ 
+-LDFLAGS    = -m elf_$(ARCH) -shared --hash-style=gnu -T 
$(com32)/lib/$(ARCH)/elf.ld --as-needed
++LDFLAGS    = -m elf_$(ARCH) -shared --no-warn-rwx-segments -z notext 
--hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld --as-needed
+ LIBGCC    := $(shell $(CC) $(GCCOPT) --print-libgcc)
+ 
+ LNXCFLAGS  = -I$(com32)/libutil/include -W -Wall -O -g -D_GNU_SOURCE
+--- a/mk/lib.mk
++++ b/mk/lib.mk
+@@ -205,7 +205,7 @@ CORELIBOBJS = \
+       $(LIBENTRY_OBJS) \
+       $(LIBMODULE_OBJS)
+ 
+-LDFLAGS       = -m elf_$(ARCH) --hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld
++LDFLAGS       = -m elf_$(ARCH) --no-warn-rwx-segments -z notext 
--hash-style=gnu -T $(com32)/lib/$(ARCH)/elf.ld
+ 
+ .SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss
+ 
+--- a/core/Makefile
++++ b/core/Makefile
+@@ -158,6 +158,7 @@ NASM_ELF = elf
+ %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS)
+       $(LD) $(LDFLAGS) -pie -Bsymbolic \
+               -T $(LDSCRIPT) \
++              --no-warn-rwx-segments -z notext \
+               --unresolved-symbols=report-all \
+               -E --hash-style=gnu -M -o $@ $< \
+               --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) 
--end-group \

diff --git a/sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild 
b/sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild
index 6b5cb5abcf12..7ba486a0a92a 100644
--- a/sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild
+++ b/sys-boot/syslinux/syslinux-6.04_pre1-r5.ebuild
@@ -46,6 +46,7 @@ src_prepare() {
        local PATCHES=(
                "${FILESDIR}/syslinux-6.03-sysmacros.patch"
                "${FILESDIR}/${PV}"
+               "${FILESDIR}/syslinux-6.04-binutils-2.41.patch"
        )
        default
 }

diff --git a/sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild 
b/sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild
index b483d5b273d2..0320264c2fdd 100644
--- a/sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild
+++ b/sys-boot/syslinux/syslinux-6.04_pre3-r1.ebuild
@@ -49,6 +49,7 @@ src_prepare() {
        local PATCHES=(
                "${FILESDIR}/6.04_pre1"
                "${FILESDIR}/6.04_pre3"
+               "${FILESDIR}/syslinux-6.04-binutils-2.41.patch"
        )
        default
 }

Reply via email to