The same changes as committed yesterday for amd64.
This allows building the i386 bootstrap with clang:
* build with -ffreestanding
* skip the integrated assembler for assym.h
* use as(1) to build biosboot.S and the various versions of srt0.S
Successfully tested for { pxeboot, disk boot } x { gcc, clang }.
ok?
Index: Makefile.inc
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/Makefile.inc,v
retrieving revision 1.49
diff -u -p -r1.49 Makefile.inc
--- Makefile.inc 6 Nov 2016 16:04:20 -0000 1.49
+++ Makefile.inc 31 May 2017 19:50:35 -0000
@@ -1,7 +1,7 @@
# $OpenBSD: Makefile.inc,v 1.49 2016/11/06 16:04:20 tb Exp $
CFLAGS=${DEBUG} ${COPTS} -Os -Wall -Werror
-CFLAGS+= -fno-stack-protector -DMDRANDOM
+CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM
CPPFLAGS+=-I${S} -I${SADIR}/libsa -I. -I${.CURDIR}
SACFLAGS=-D_STANDALONE
DEBUGFLAGS=
@@ -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/i386/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/i386/stand/biosboot/Makefile,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile
--- biosboot/Makefile 30 Jul 2016 03:25:48 -0000 1.27
+++ biosboot/Makefile 31 May 2017 19:52:09 -0000
@@ -22,6 +22,7 @@ ${PROG}: $(OBJS)
CPPFLAGS+=-DLOADADDR=$(LOADADDR) -DLINKADDR=$(LINKADDR)
-DBOOTMAGIC=$(BOOTMAGIC)
CPPFLAGS+=${DEBUGFLAGS}
CFLAGS+=-fno-pie
+AFLAGS+=${NO_INTEGR_AS}
#AFLAGS+=-Wa,-a
AFLAGS+=-fno-pie
.else
Index: boot/Makefile
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/boot/Makefile,v
retrieving revision 1.64
diff -u -p -r1.64 Makefile
--- boot/Makefile 18 Sep 2016 16:34:59 -0000 1.64
+++ boot/Makefile 31 May 2017 19:52:47 -0000
@@ -81,6 +81,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/i386/stand/cdboot/Makefile,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile
--- cdboot/Makefile 18 Sep 2016 16:34:59 -0000 1.29
+++ cdboot/Makefile 31 May 2017 19:54:15 -0000
@@ -73,6 +73,7 @@ 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+=-Wa,-R
# AFLAGS+=-Wa,-a
AFLAGS+=-fno-pie
Index: pxeboot/Makefile
===================================================================
RCS file: /cvs/src/sys/arch/i386/stand/pxeboot/Makefile,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile
--- pxeboot/Makefile 18 Sep 2016 16:34:59 -0000 1.26
+++ pxeboot/Makefile 31 May 2017 19:55:58 -0000
@@ -72,6 +72,7 @@ CPPFLAGS+=-DSLOW -DSMALL -DNOBYFOUR -DNO
CPPFLAGS+=-DHEAP_LIMIT=${HEAP_LIMIT}
CPPFLAGS+=-I${S}/stand/boot
CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD -fno-pie
+AFLAGS+=${NO_INTEGR_AS}
#AFLAGS+=-Wa,-R
# AFLAGS+=-Wa,-a
AFLAGS+=-fno-pie
--
Christian "naddy" Weisgerber [email protected]