summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/syslinux/syslinux/0010-Workaround-multiple-definition-of-symbol-errors.patch
blob: 3665af9c497f0d3427be1fe0801a8207b2e9ecac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
From f2a5b64785958226c022cac9931b059b98f4e896 Mon Sep 17 00:00:00 2001
From: Merlin Mathesius <mmathesi@redhat.com>
Date: Wed, 13 May 2020 08:02:27 -0500
Subject: [PATCH] Workaround multiple definition of symbol errors

Lifted from Fedora https://src.fedoraproject.org/rpms/syslinux/blob/master/f/0005-Workaround-multiple-definition-of-symbol-errors.patch

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 com32/cmenu/Makefile           | 2 +-
 com32/elflink/ldlinux/Makefile | 2 +-
 com32/gpllib/Makefile          | 2 +-
 com32/hdt/Makefile             | 2 +-
 core/Makefile                  | 2 +-
 dos/Makefile                   | 2 +-
 efi/Makefile                   | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/com32/cmenu/Makefile b/com32/cmenu/Makefile
index b81b68e..2ae989c 100644
--- a/com32/cmenu/Makefile
+++ b/com32/cmenu/Makefile
@@ -49,7 +49,7 @@ makeoutputdirs:
 	@mkdir -p $(OBJ)/libmenu
 
 libmenu/libmenu.elf: $(LIBMENU)
-	$(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) \
+	$(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) \
 		-o $@ $^
 
 tidy dist:
diff --git a/com32/elflink/ldlinux/Makefile b/com32/elflink/ldlinux/Makefile
index 87c0d36..2be2a01 100644
--- a/com32/elflink/ldlinux/Makefile
+++ b/com32/elflink/ldlinux/Makefile
@@ -33,7 +33,7 @@ endif
 all: $(BTARGET) ldlinux_lnx.a
 
 ldlinux.elf : $(OBJS)
-	$(LD) $(LDFLAGS) -soname $(SONAME) -o $@ $^ $(LIBS)
+	$(LD) $(LDFLAGS) -z muldefs -soname $(SONAME) -o $@ $^ $(LIBS)
 
 LNXCFLAGS += -D__export='__attribute__((visibility("default")))'
 LNXLIBOBJS = get_key.lo
diff --git a/com32/gpllib/Makefile b/com32/gpllib/Makefile
index 1fec914..2d764d0 100644
--- a/com32/gpllib/Makefile
+++ b/com32/gpllib/Makefile
@@ -24,7 +24,7 @@ makeoutputdirs:
 		$(addprefix $(OBJ),$(sort $(dir $(LIBOBJS)))),$(b))
 
 libgpl.elf : $(LIBOBJS)
-	$(LD) -shared $(LDFLAGS) -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^
+	$(LD) -shared $(LDFLAGS) -z muldefs -soname $(patsubst %.elf,%.c32,$(@F)) -o $@ $^
 
 tidy dist clean:
 	find . \( -name \*.o -o -name .\*.d -o -name \*.tmp \) -print0 | \
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index 61736d0..1d94785 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -52,7 +52,7 @@ QEMU			?= qemu-kvm
 all: $(MODULES) $(TESTFILES)
 
 hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
-	$(LD) $(LDFLAGS) -o $@ $^
+	$(LD) $(LDFLAGS) -z muldefs -o $@ $^
 
 memtest:
 	-[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST)
diff --git a/core/Makefile b/core/Makefile
index 50ff35a..f0a5562 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -156,7 +156,7 @@ LDSCRIPT = $(SRC)/$(ARCH)/syslinux.ld
 NASM_ELF = elf
 
 %.elf: %.o $(LIBDEP) $(LDSCRIPT) $(AUXLIBS)
-	$(LD) $(LDFLAGS) -pie -Bsymbolic \
+	$(LD) $(LDFLAGS) -z muldefs -pie -Bsymbolic \
 		-T $(LDSCRIPT) \
 		--unresolved-symbols=report-all \
 		-E --hash-style=gnu -M -o $@ $< \
diff --git a/dos/Makefile b/dos/Makefile
index 4c930d1..5d1c72c 100644
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -19,7 +19,7 @@ include $(MAKEDIR)/embedded.mk
 CFLAGS	+= -D__MSDOS__ -mregparm=3 -DREGPARM=3
 # CFLAGS  += -DDEBUG
 
-LDFLAGS	 = -T $(SRC)/dosexe.ld
+LDFLAGS	 = -T $(SRC)/dosexe.ld -z muldefs
 OPTFLAGS = -g
 INCLUDES = -include code16.h -nostdinc -iwithprefix include \
 	   -I$(SRC) -I$(SRC)/.. -I$(SRC)/../libfat \
diff --git a/efi/Makefile b/efi/Makefile
index f4501e7..72e081e 100644
--- a/efi/Makefile
+++ b/efi/Makefile
@@ -71,7 +71,7 @@ $(OBJS): | $(OBJ)/$(ARCH)
 BTARGET  = syslinux.efi
 
 syslinux.so: $(OBJS) $(CORE_OBJS) $(LIB_OBJS)
-	$(LD) $(LDFLAGS) --strip-debug -o $@ $^ -lgnuefi -lefi
+	$(LD) $(LDFLAGS) -z muldefs --strip-debug -o $@ $^ -lgnuefi -lefi
 
 # We need to rename the .hash section because the EFI firmware
 # linker really doesn't like it.