On amd64 we can now build the bootstrap with clang if we * skip the integrated assembler for assym.h; * use as(1) to build biosboot.S and the various versions of srt0.S.
I successfully tested a clang-built pxeboot(8) and boot(8). Index: Makefile.inc =================================================================== RCS file: /cvs/src/sys/arch/amd64/stand/Makefile.inc,v retrieving revision 1.16 diff -u -p -r1.16 Makefile.inc --- Makefile.inc 30 May 2017 15:02:22 -0000 1.16 +++ Makefile.inc 30 May 2017 15:28:46 -0000 @@ -23,13 +23,18 @@ CLEANFILES+= assym.h machine SACFLAGS+=-nostdinc -fno-builtin -fpack-struct +.include <bsd.own.mk> +.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 Index: biosboot/Makefile =================================================================== RCS file: /cvs/src/sys/arch/amd64/stand/biosboot/Makefile,v retrieving revision 1.11 diff -u -p -r1.11 Makefile --- biosboot/Makefile 30 Jul 2016 03:25:48 -0000 1.11 +++ biosboot/Makefile 30 May 2017 15:12:20 -0000 @@ -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 Index: boot/Makefile =================================================================== RCS file: /cvs/src/sys/arch/amd64/stand/boot/Makefile,v retrieving revision 1.36 diff -u -p -r1.36 Makefile --- boot/Makefile 18 Sep 2016 16:34:59 -0000 1.36 +++ boot/Makefile 30 May 2017 15:12:44 -0000 @@ -77,6 +77,7 @@ CPPFLAGS+=-DBOOTMAGIC=$(BOOTMAGIC) ${DEB 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 Index: cdboot/Makefile =================================================================== RCS file: /cvs/src/sys/arch/amd64/stand/cdboot/Makefile,v retrieving revision 1.32 diff -u -p -r1.32 Makefile --- cdboot/Makefile 18 Sep 2016 16:34:59 -0000 1.32 +++ cdboot/Makefile 30 May 2017 15:12:55 -0000 @@ -68,5 +68,6 @@ CFLAGS+=${SACFLAGS} -D__INTERNAL_LIBSA_C CFLAGS+=-DOSREV=\"${OSREV}\" -DMACHINE=\"${MACHINE}\" CFLAGS+=-DKERNEL=\"/${OSREV}/${MACHINE}/bsd.rd\" CFLAGS+=-fno-pie +AFLAGS+=${NO_INTEGR_AS} AFLAGS+=-m32 AFLAGS+=-fno-pie Index: pxeboot/Makefile =================================================================== RCS file: /cvs/src/sys/arch/amd64/stand/pxeboot/Makefile,v retrieving revision 1.30 diff -u -p -r1.30 Makefile --- pxeboot/Makefile 18 Sep 2016 16:34:59 -0000 1.30 +++ pxeboot/Makefile 30 May 2017 15:13:00 -0000 @@ -70,6 +70,7 @@ CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO 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 -- Christian "naddy" Weisgerber na...@mips.inka.de