From: Michael Tremer Date: Wed, 14 Apr 2021 09:54:42 +0000 (+0000) Subject: syslinux: Fix build with GOLD X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fce4e0fcfe7d4f2d3b3dd73df6849a6df1b8d15f;p=people%2Fms%2Fipfire-2.x.git syslinux: Fix build with GOLD This patch reverts building syslinux with the classic BFD linker Signed-off-by: Michael Tremer --- diff --git a/lfs/syslinux b/lfs/syslinux index b2eec0d5be..48ccececa0 100644 --- a/lfs/syslinux +++ b/lfs/syslinux @@ -79,11 +79,13 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.03-sysmacros.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.04_replace-builtin-strlen-that-appears-to-get-optimized.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.04_pre1-fcommon.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.04-pre1-Workaround-multiple-definition-of-symbol-errors.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/syslinux-6.04-pre1-Add-RPMOPTFLAGS-to-CFLAGS-for-some-stuff.patch # Build - cd $(DIR_APP) && make bios $(MAKETUNING) + cd $(DIR_APP) && make bios LD="ld.bfd -m elf_i386" RPMLDFLAGS="-fuse-ld=bfd" #$(MAKETUNING) ifeq "$(BUILD_ARCH)" "x86_64" - cd $(DIR_APP) && make efi64 $(MAKETUNING) + cd $(DIR_APP) && make efi64 LD=ld.bfd RPMLDFLAGS="-fuse-ld=bfd" #$(MAKETUNING) endif # Install diff --git a/src/patches/syslinux-6.04-pre1-Add-RPMOPTFLAGS-to-CFLAGS-for-some-stuff.patch b/src/patches/syslinux-6.04-pre1-Add-RPMOPTFLAGS-to-CFLAGS-for-some-stuff.patch new file mode 100644 index 0000000000..e55c490dab --- /dev/null +++ b/src/patches/syslinux-6.04-pre1-Add-RPMOPTFLAGS-to-CFLAGS-for-some-stuff.patch @@ -0,0 +1,76 @@ +From 5c24d725d5a5f50f0544fbcc544f08a3f9e90e5d Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Thu, 8 Aug 2019 05:41:36 -0400 +Subject: [PATCH] Add 'RPMOPTFLAGS' to CFLAGS for some stuff. + +--- + extlinux/Makefile | 4 ++-- + linux/Makefile | 4 ++-- + mtools/Makefile | 4 ++-- + utils/Makefile | 4 ++-- + 4 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/extlinux/Makefile b/extlinux/Makefile +index 1721ee54aff..d504e23133e 100644 +--- a/extlinux/Makefile ++++ b/extlinux/Makefile +@@ -18,9 +18,9 @@ include $(MAKEDIR)/syslinux.mk + + OPTFLAGS = -g -Os + INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libinstaller +-CFLAGS = $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \ ++CFLAGS = $(RPMCFLAGS) $(GCCWARN) -Wno-sign-compare -D_FILE_OFFSET_BITS=64 \ + $(OPTFLAGS) $(INCLUDES) +-LDFLAGS = ++LDFLAGS = $(RPMLDFLAGS) + + SRCS = main.c \ + mountinfo.c \ +diff --git a/linux/Makefile b/linux/Makefile +index 5a49d813de1..9fed68d02c6 100644 +--- a/linux/Makefile ++++ b/linux/Makefile +@@ -18,8 +18,8 @@ include $(MAKEDIR)/syslinux.mk + + OPTFLAGS = -g -Os + INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libinstaller +-CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) +-LDFLAGS = ++CFLAGS = $(RPMCFLAGS) $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) ++LDFLAGS = $(RPMLDFLAGS) + + SRCS = syslinux.c \ + ../libinstaller/syslxopt.c \ +diff --git a/mtools/Makefile b/mtools/Makefile +index 632b185ba2f..b6e5ebdba6b 100755 +--- a/mtools/Makefile ++++ b/mtools/Makefile +@@ -2,8 +2,8 @@ include $(MAKEDIR)/syslinux.mk + + OPTFLAGS = -g -Os + INCLUDES = -I$(SRC) -I$(objdir) -I$(SRC)/../libfat -I$(SRC)/../libinstaller +-CFLAGS = $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) +-LDFLAGS = ++CFLAGS = $(RPMCFLAGS) $(GCCWARN) -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(INCLUDES) ++LDFLAGS = $(RPMLDFLAGS) + + SRCS = syslinux.c \ + ../libinstaller/fs.c \ +diff --git a/utils/Makefile b/utils/Makefile +index dfe625902ce..b4962353f20 100644 +--- a/utils/Makefile ++++ b/utils/Makefile +@@ -17,8 +17,8 @@ + VPATH = $(SRC) + include $(MAKEDIR)/syslinux.mk + +-CFLAGS = $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) +-LDFLAGS = -O2 ++CFLAGS = $(RPMCFLAGS) $(GCCWARN) -Os -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 -I$(SRC) ++LDFLAGS = $(RPMLDFLAGS) -O2 + + C_TARGETS = isohybrid gethostip memdiskfind + SCRIPT_TARGETS = mkdiskimage +-- +2.21.0 + diff --git a/src/patches/syslinux-6.04-pre1-Workaround-multiple-definition-of-symbol-errors.patch b/src/patches/syslinux-6.04-pre1-Workaround-multiple-definition-of-symbol-errors.patch new file mode 100644 index 0000000000..b5bbad0ac0 --- /dev/null +++ b/src/patches/syslinux-6.04-pre1-Workaround-multiple-definition-of-symbol-errors.patch @@ -0,0 +1,109 @@ +From 951928f2cad5682c2844e6bd0f7201236c5d9b66 Mon Sep 17 00:00:00 2001 +From: Merlin Mathesius +Date: Wed, 13 May 2020 08:02:27 -0500 +Subject: [PATCH] Workaround multiple definition of symbol errors + +--- + 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 b81b68ed..2ae989c4 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 87c0d362..2be2a01a 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 1fec9145..2d764d0b 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 61736d05..1d947857 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 46cb037c..f0cfcbe9 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 4c930d19..5d1c72ca 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 bbf23f24..3dd922d5 100644 +--- a/efi/Makefile ++++ b/efi/Makefile +@@ -69,7 +69,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. +-- +2.25.1 +