1From f2a5b64785958226c022cac9931b059b98f4e896 Mon Sep 17 00:00:00 2001 2From: Merlin Mathesius <mmathesi@redhat.com> 3Date: Wed, 13 May 2020 08:02:27 -0500 4Subject: [PATCH] Workaround multiple definition of symbol errors 5 6Lifted from Fedora https://src.fedoraproject.org/rpms/syslinux/blob/master/f/0005-Workaround-multiple-definition-of-symbol-errors.patch 7 8Upstream-Status: Inactive-Upstream 9Signed-off-by: Khem Raj <raj.khem@gmail.com> 10--- 11 com32/cmenu/Makefile | 2 +- 12 com32/elflink/ldlinux/Makefile | 2 +- 13 com32/gpllib/Makefile | 2 +- 14 com32/hdt/Makefile | 2 +- 15 core/Makefile | 2 +- 16 dos/Makefile | 2 +- 17 efi/Makefile | 2 +- 18 7 files changed, 7 insertions(+), 7 deletions(-) 19 20diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile 21index b81b68e..2ae989c 100644 22--- a/com32/cmenu/Makefile 23+++ b/com32/cmenu/Makefile 24@@ -49,7 +49,7 @@ makeoutputdirs: 25 @mkdir -p $(OBJ)/libmenu 26 27 libmenu/libmenu.elf: $(LIBMENU) 28- $(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) \ 29+ $(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) \ 30 -o $@ $^ 31 32 tidy dist: 33diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile 34index 87c0d36..2be2a01 100644 35--- a/com32/elflink/ldlinux/Makefile 36+++ b/com32/elflink/ldlinux/Makefile 37@@ -33,7 +33,7 @@ endif 38 all: $(BTARGET) ldlinux_lnx.a 39 40 ldlinux.elf : $(OBJS) 41- $(LD) $(LDFLAGS) -soname $(SONAME) -o $@ $^ $(LIBS) 42+ $(LD) $(LDFLAGS) -z muldefs -soname $(SONAME) -o $@ $^ $(LIBS) 43 44 LNXCFLAGS += -D__export='__attribute__((visibility("default")))' 45 LNXLIBOBJS = get_key.lo 46diff --git a/com32/gpllib/Makefile b/com32/gpllib/Makefile 47index 1fec914..2d764d0 100644 48--- a/com32/gpllib/Makefile 49+++ b/com32/gpllib/Makefile 50@@ -24,7 +24,7 @@ makeoutputdirs: 51 $(addprefix $(OBJ),$(sort $(dir $(LIBOBJS)))),$(b)) 52 53 libgpl.elf : $(LIBOBJS) 54- $(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^ 55+ $(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^ 56 57 tidy dist clean: 58 find . \( -name \*.o -o -name .\*.d -o -name \*.tmp \) -print0 | \ 59diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile 60index 61736d0..1d94785 100644 61--- a/com32/hdt/Makefile 62+++ b/com32/hdt/Makefile 63@@ -52,7 +52,7 @@ QEMU ?= qemu-kvm 64 all: $(MODULES) $(TESTFILES) 65 66 hdt.elf : $(OBJS) $(LIBS) $(C_LIBS) 67- $(LD) $(LDFLAGS) -o $@ $^ 68+ $(LD) $(LDFLAGS) -z muldefs -o $@ $^ 69 70 memtest: 71 -[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST) 72diff --git a/core/Makefile b/core/Makefile 73index 50ff35a..f0a5562 100644 74--- a/core/Makefile 75+++ b/core/Makefile 76@@ -156,7 +156,7 @@ LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld 77 NASM_ELF = elf 78 79 %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS) 80- $(LD) $(LDFLAGS) -pie -Bsymbolic \ 81+ $(LD) $(LDFLAGS) -z muldefs -pie -Bsymbolic \ 82 -T $(LDSCRIPT) \ 83 --unresolved-symbols=report-all \ 84 -E --hash-style=gnu -M -o $@ $< \ 85diff --git a/dos/Makefile b/dos/Makefile 86index 4c930d1..5d1c72c 100644 87--- a/dos/Makefile 88+++ b/dos/Makefile 89@@ -19,7 +19,7 @@ include $(MAKEDIR)/embedded.mk 90 CFLAGS += -D__MSDOS__ -mregparm=3 -DREGPARM=3 91 # CFLAGS += -DDEBUG 92 93-LDFLAGS = -T $(SRC)/dosexe.ld 94+LDFLAGS = -T $(SRC)/dosexe.ld -z muldefs 95 OPTFLAGS = -g 96 INCLUDES = -include code16.h -nostdinc -iwithprefix include \ 97 -I$(SRC) -I$(SRC)/.. -I$(SRC)/../libfat \ 98diff --git a/efi/Makefile b/efi/Makefile 99index f4501e7..72e081e 100644 100--- a/efi/Makefile 101+++ b/efi/Makefile 102@@ -71,7 +71,7 @@ $(OBJS): | $(OBJ)/$(ARCH) 103 BTARGET = syslinux.efi 104 105 syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS) 106- $(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi 107+ $(LD) $(LDFLAGS) -z muldefs --strip-debug -o $@ $^ -lgnuefi -lefi 108 109 # We need to rename the .hash section because the EFI firmware 110 # linker really doesn't like it. 111