From e466b42fc76e86e232f5e8ba5162af527a8cee30 Mon Sep 17 00:00:00 2001 From: naddy Date: Tue, 30 May 2017 22:32:10 +0000 Subject: [PATCH] Allow building the bootstrap with clang: * skip the integrated assembler for assym.h * use as(1) to build biosboot.S and the various versions of srt0.S ok deraadt@ --- sys/arch/amd64/stand/Makefile.inc | 9 +++++++-- sys/arch/amd64/stand/biosboot/Makefile | 3 ++- sys/arch/amd64/stand/boot/Makefile | 3 ++- sys/arch/amd64/stand/cdboot/Makefile | 3 ++- sys/arch/amd64/stand/pxeboot/Makefile | 3 ++- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/arch/amd64/stand/Makefile.inc b/sys/arch/amd64/stand/Makefile.inc index d4f0fc183a9..1418ea740c7 100644 --- a/sys/arch/amd64/stand/Makefile.inc +++ b/sys/arch/amd64/stand/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.16 2017/05/30 15:02:22 naddy Exp $ +# $OpenBSD: Makefile.inc,v 1.17 2017/05/30 22:32:10 naddy Exp $ CFLAGS=${DEBUG} ${COPTS} -Os -Wall -Werror CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM @@ -23,13 +23,18 @@ CLEANFILES+= assym.h machine SACFLAGS+=-nostdinc -fno-builtin -fpack-struct +.include +.if ${COMPILER_VERSION:Mclang} +NO_INTEGR_AS= -no-integrated-as +.endif + .if !make(clean) && !make(cleandir) && !make(includes) && !make(libdep) && \ !make(sadep) && !make(salibdir) && !make(obj) .BEGIN: @([ X$(S) = X -o -h machine ] || ln -s $(S)/arch/amd64/include machine) assym.h: ${S}/kern/genassym.sh ${SADIR}/etc/genassym.cf - sh ${S}/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} \ + sh ${S}/kern/genassym.sh ${CC} ${NO_INTEGR_AS} ${CFLAGS} ${CPPFLAGS} \ ${PARAM} < ${SADIR}/etc/genassym.cf > assym.h.tmp && \ mv -f assym.h.tmp assym.h .endif diff --git a/sys/arch/amd64/stand/biosboot/Makefile b/sys/arch/amd64/stand/biosboot/Makefile index 70beaa86877..0d3464635f9 100644 --- a/sys/arch/amd64/stand/biosboot/Makefile +++ b/sys/arch/amd64/stand/biosboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.11 2016/07/30 03:25:48 guenther Exp $ +# $OpenBSD: Makefile,v 1.12 2017/05/30 22:32:10 naddy Exp $ MAN= biosboot.8 @@ -23,6 +23,7 @@ ${PROG}: $(OBJS) CPPFLAGS+=-DLOADADDR=$(LOADADDR) -DLINKADDR=$(LINKADDR) -DBOOTMAGIC=$(BOOTMAGIC) CPPFLAGS+=${DEBUGFLAGS} CFLAGS+=-fno-pie +AFLAGS+=${NO_INTEGR_AS} AFLAGS+=-m32 # -Wa,-a AFLAGS+=-fno-pie .else diff --git a/sys/arch/amd64/stand/boot/Makefile b/sys/arch/amd64/stand/boot/Makefile index 3a2b9d47188..ebb431ad01e 100644 --- a/sys/arch/amd64/stand/boot/Makefile +++ b/sys/arch/amd64/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.36 2016/09/18 16:34:59 jsing Exp $ +# $OpenBSD: Makefile,v 1.37 2017/05/30 22:32:10 naddy Exp $ COPTS?= MAN?= boot.8 @@ -77,6 +77,7 @@ CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEBUGFLAGS} -DLINKADDR=${LINKADDR} CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -DDYNAMIC_CRC_TABLE CPPFLAGS+=-DHEAP_LIMIT=${HEAP_LIMIT} -I${S}/stand/boot #-DCOMPAT_UFS CFLAGS+=-m32 $(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie +AFLAGS+=${NO_INTEGR_AS} AFLAGS+=-m32 # -Wa,-R # AFLAGS+=-Wa,-a AFLAGS+=-fno-pie diff --git a/sys/arch/amd64/stand/cdboot/Makefile b/sys/arch/amd64/stand/cdboot/Makefile index 251f5486838..e9eaa025483 100644 --- a/sys/arch/amd64/stand/cdboot/Makefile +++ b/sys/arch/amd64/stand/cdboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.32 2016/09/18 16:34:59 jsing Exp $ +# $OpenBSD: Makefile,v 1.33 2017/05/30 22:32:10 naddy Exp $ MAN= cdboot.8 @@ -68,5 +68,6 @@ CFLAGS+=${SACFLAGS} -D__INTERNAL_LIBSA_CREAD CFLAGS+=-DOSREV=\"${OSREV}\" -DMACHINE=\"${MACHINE}\" CFLAGS+=-DKERNEL=\"/${OSREV}/${MACHINE}/bsd.rd\" CFLAGS+=-fno-pie +AFLAGS+=${NO_INTEGR_AS} AFLAGS+=-m32 AFLAGS+=-fno-pie diff --git a/sys/arch/amd64/stand/pxeboot/Makefile b/sys/arch/amd64/stand/pxeboot/Makefile index 3dee14b71c5..35f0211400e 100644 --- a/sys/arch/amd64/stand/pxeboot/Makefile +++ b/sys/arch/amd64/stand/pxeboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.30 2016/09/18 16:34:59 jsing Exp $ +# $OpenBSD: Makefile,v 1.31 2017/05/30 22:32:10 naddy Exp $ MAN= pxeboot.8 @@ -70,6 +70,7 @@ CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO_GZIP -DDYNAMIC_CRC_TABLE CPPFLAGS+=-DHEAP_LIMIT=${HEAP_LIMIT} -I${S}/stand/boot #-DCOMPAT_UFS CFLAGS+=-m32 CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie +AFLAGS+=${NO_INTEGR_AS} # AFLAGS+=-Wa,-a AFLAGS+=-m32 # -Wa,-R AFLAGS+=-fno-pie -- 2.20.1