File 0005-gnu-efi-version-compatibility.patch of Package syslinux

From: Lukas Schwaighofer <lukas@schwaighofer.name>
Date: Mon, 6 May 2019 00:43:10 +0200
Subject: Strip memtest and memcpy from libefi

Repack libefi.a to not contain the memset and memcpy symbols to make sure the
implementation from syslinux is used and no multiple symbol definitions are
present.
---
 efi/Makefile | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Index: b/efi/Makefile
===================================================================
--- a/efi/Makefile
+++ b/efi/Makefile
@@ -30,8 +30,10 @@ FILTERED_OBJS := $(OBJ)/../core/bios/% \
 
 CORE_OBJS = $(filter-out $(FILTERED_OBJS),$(CORE_COBJ))
 
+LIBEFI_STRIPPED = $(objdir)/libefi_stripped.a
+
 LIB_OBJS = $(addprefix $(objdir)/com32/lib/,$(CORELIBOBJS)) \
-	$(LIBEFI)
+	$(LIBEFI_STRIPPED)
 
 CSRC = $(sort $(wildcard $(SRC)/*.c))
 OBJS = $(subst $(SRC)/,,$(filter-out %wrapper.o, $(patsubst %.c,%.o,$(CSRC))))
@@ -60,6 +62,13 @@ BTARGET  = syslinux.efi
 syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
 	$(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
 
+$(LIBEFI_STRIPPED): $(LIBEFI)
+	cp $(LIBEFI) $(LIBEFI_STRIPPED)
+	ar x $(LIBEFI_STRIPPED) init.o
+	strip -N memset -N memcpy init.o
+	ar r $(LIBEFI_STRIPPED) init.o
+	rm init.o
+
 # We need to rename the .hash section because the EFI firmware
 # linker really doesn't like it.
 # $(OBJCOPY) --rename-section .gnu.hash=.sdata,load,data,alloc $^ $@
openSUSE Build Service is sponsored by