1From 16f293d67eace501c98494976030f4319778ebf5 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 6[From https://src.fedoraproject.org/rpms/syslinux/raw/rawhide/f/0005-Workaround-multiple-definition-of-symbol-errors.patch 7 plus adding '-z muldefs' for gpxe] 8Signed-off-by: Peter Seiderer <ps.report@gmx.net> 9--- 10 com32/cmenu/Makefile | 2 +- 11 com32/elflink/ldlinux/Makefile | 2 +- 12 com32/gpllib/Makefile | 2 +- 13 com32/hdt/Makefile | 2 +- 14 core/Makefile | 2 +- 15 dos/Makefile | 2 +- 16 efi/Makefile | 2 +- 17 gpxe/src/arch/i386/Makefile | 2 +- 18 8 files changed, 8 insertions(+), 8 deletions(-) 19 20diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile 21index 6bb52316..66cdd649 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 d948da43..67434a1f 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 e3e30d76..17520a1e 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 80f2d0a0..8509cd96 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 ad0acb5a..3bee4dc9 100644 74--- a/core/Makefile 75+++ b/core/Makefile 76@@ -164,7 +164,7 @@ AUXLIBS = libisolinux.a libisolinux-debug.a libldlinux.a \ 77 LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld 78 79 %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS) 80- $(LD) $(LDFLAGS) -Bsymbolic $(LD_PIE) -E --hash-style=gnu -T $(LDSCRIPT) -M -o $@ $< \ 81+ $(LD) $(LDFLAGS) -z muldefs -Bsymbolic $(LD_PIE) -E --hash-style=gnu -T $(LDSCRIPT) -M -o $@ $< \ 82 --start-group $(LIBS) $(subst $(*F).elf,lib$(*F).a,$@) --end-group \ 83 > $(@:.elf=.map) 84 $(OBJDUMP) -h $@ > $(@:.elf=.sec) 85diff --git a/dos/Makefile b/dos/Makefile 86index b9c337d5..2af87346 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 d24d16db..7c714ebf 100644 100--- a/efi/Makefile 101+++ b/efi/Makefile 102@@ -70,7 +70,7 @@ $(OBJS): subdirs 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. 111diff --git a/gpxe/src/arch/i386/Makefile b/gpxe/src/arch/i386/Makefile 112index dd8da802..be1d00ff 100644 113--- a/gpxe/src/arch/i386/Makefile 114+++ b/gpxe/src/arch/i386/Makefile 115@@ -55,7 +55,7 @@ ASFLAGS += --32 116 ifeq ($(HOST_OS),FreeBSD) 117 LDFLAGS += -m elf_i386_fbsd 118 else 119-LDFLAGS += -m elf_i386 120+LDFLAGS += -z muldefs -m elf_i386 121 endif 122 123 # EFI requires -fshort-wchar, and nothing else currently uses wchar_t 124-- 1252.30.1 126 127