From owner-svn-src-head@freebsd.org Tue Dec 5 21:38:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C25D8E834CF; Tue, 5 Dec 2017 21:38:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E81A72AA2; Tue, 5 Dec 2017 21:38:20 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vB5LcJiI024289; Tue, 5 Dec 2017 21:38:19 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vB5LcJEH024287; Tue, 5 Dec 2017 21:38:19 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201712052138.vB5LcJEH024287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 5 Dec 2017 21:38:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326593 - in head/stand: . libsa X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: . libsa X-SVN-Commit-Revision: 326593 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2017 21:38:22 -0000 Author: imp Date: Tue Dec 5 21:38:19 2017 New Revision: 326593 URL: https://svnweb.freebsd.org/changeset/base/326593 Log: Stop building with the standard system headers. Building with the standard system headers isn't a perfect match to the stand environment. Instead, copy over the files we know are safe to use and constrain what else is used. We use -nostdinc to achieve this. This also fixes issues with building 32-bit libraries on amd64 sometimes pulling in the wrong cpufunc.h giving an error now that we stop on errors. It will also enable an easier transition to lua boot. Sponsored by: Netflix Modified: head/stand/defs.mk head/stand/libsa/Makefile Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Tue Dec 5 21:38:14 2017 (r326592) +++ head/stand/defs.mk Tue Dec 5 21:38:19 2017 (r326593) @@ -41,6 +41,12 @@ LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a .endif # Standard options: +CFLAGS+= -nostdinc +.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1 +CFLAGS+= -I${BOOTOBJ}/libsa32 +.else +CFLAGS+= -I${BOOTOBJ}/libsa +.endif CFLAGS+= -I${SASRC} -D_STANDALONE CFLAGS+= -I${SYSDIR} Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Tue Dec 5 21:38:14 2017 (r326592) +++ head/stand/libsa/Makefile Tue Dec 5 21:38:19 2017 (r326593) @@ -91,6 +91,7 @@ SRCS+= libsa_bzlib_private.h .for file in bzlib.c crctable.c decompress.c huffman.c randtable.c SRCS+= _${file} CLEANFILES+= _${file} +CFLAGS._${file}+=-I${SRCTOP}/contrib/bzip2 _${file}: ${file} sed "s|bzlib_private\.h|libsa_bzlib_private.h|" \ @@ -129,6 +130,26 @@ libsa_${file}: ${file} ${.ALLSRC} > ${.TARGET} .endfor +# Create a subset of includes that are safe, as well as adjusting those that aren't +# The lists may drive people nuts, but they are explicitly opt-in +beforedepend: + echo beforedepend; \ + mkdir -p xlocale arpa; \ + for i in a.out.h assert.h elf.h limits.h nlist.h setjmp.h stddef.h stdbool.h string.h strings.h time.h unistd.h uuid.h; do \ + ln -sf ${SRCTOP}/include/$$i $$i; \ + done; \ + ln -sf ${SYSDIR}/${MACHINE}/include/stdarg.h stdarg.h; \ + ln -sf ${SYSDIR}/sys/errno.h errno.h; \ + ln -sf ${SYSDIR}/sys/stdint.h stdint.h; \ + ln -sf ${SRCTOP}/include/arpa/inet.h arpa/inet.h; \ + ln -sf ${SRCTOP}/include/arpa/tftp.h arpa/tftp.h; \ + for i in _time.h _strings.h _string.h; do \ + [ -f xlocale/$$i ] || cp /dev/null xlocale/$$i; \ + done; \ + for i in ctype.h stdio.h stdlib.h; do \ + ln -sf ${SASRC}/stand.h $$i; \ + done + # io routines SRCS+= closeall.c dev.c ioctl.c nullfs.c stat.c \ fstat.c close.c lseek.c open.c read.c write.c readdir.c @@ -147,6 +168,8 @@ SRCS+= pkgfs.c .if ${MK_NAND} != "no" SRCS+= nandfs.c .endif + +CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2 # explicit_bzero .PATH: ${SYSDIR}/libkern