From 8124814956605482b4beb664ecbd29d2ed999f72 Mon Sep 17 00:00:00 2001 From: mpi Date: Thu, 25 Jan 2018 14:09:52 +0000 Subject: [PATCH] Use a new LDFLAGS variable to pass "-melf_i386_obsd" on amd64. Makes the linker generate a correct i386 gap.o file. ok kettenis@, deraadt@ --- sys/arch/i386/conf/Makefile.i386 | 7 ++++--- sys/conf/makegap.sh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/arch/i386/conf/Makefile.i386 b/sys/arch/i386/conf/Makefile.i386 index 4920bc69844..6ef8882523a 100644 --- a/sys/arch/i386/conf/Makefile.i386 +++ b/sys/arch/i386/conf/Makefile.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.i386,v 1.120 2017/11/04 16:04:16 florian Exp $ +# $OpenBSD: Makefile.i386,v 1.121 2018/01/25 14:09:52 mpi Exp $ # For instructions on building kernels consult the config(8) and options(4) # manual pages. @@ -50,7 +50,8 @@ LINKFLAGS= -T ld.script -X --warn-common -nopie .if ${MACHINE} == "amd64" CFLAGS+= -m32 AFLAGS+= -m32 -LINKFLAGS+= -melf_i386_obsd +LDFLAGS= -melf_i386_obsd +LINKFLAGS+= ${LDFLAGS} .endif HOSTCC?= ${CC} @@ -126,7 +127,7 @@ ld.script: ${_machdir}/conf/ld.script makegap.sh: cp $S/conf/makegap.sh $@ -MAKE_GAP = LD="${LD}" sh makegap.sh 0xcccccccc +MAKE_GAP = LD="${LD}" LDFLAGS="${LDFLAGS}" sh makegap.sh 0xcccccccc gap.o: Makefile makegap.sh vers.o ${MAKE_GAP} diff --git a/sys/conf/makegap.sh b/sys/conf/makegap.sh index 9c3775938ed..603d9ee2906 100644 --- a/sys/conf/makegap.sh +++ b/sys/conf/makegap.sh @@ -68,4 +68,4 @@ SECTIONS { } __EOF__ -$LD -r gap.link $GAPDUMMY -o gap.o +$LD $LDFLAGS -r gap.link $GAPDUMMY -o gap.o -- 2.20.1