svn commit: r326342 - head/lib/libc/mips/gen
Author: arichardson Date: Tue Nov 28 20:37:27 2017 New Revision: 326342 URL: https://svnweb.freebsd.org/changeset/base/326342 Log: Fix fabs() for MIPS when used on -0.0 It would previously return negative zero for -0.0 since -0.0 does not compare less than 0. The issue was discovered when running the libc++ test suite on softfloat MIPS64. I have verified that both clang and GCC generate sensible code for the builtin. For soft float they clear the sign bit using integer operations and in hard float mode they use abs.d. Reviewed by: #mips, jhb, brooks, imp, emaste Approved by: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D13135 Modified: head/lib/libc/mips/gen/fabs.c Modified: head/lib/libc/mips/gen/fabs.c == --- head/lib/libc/mips/gen/fabs.c Tue Nov 28 19:57:16 2017 (r326341) +++ head/lib/libc/mips/gen/fabs.c Tue Nov 28 20:37:27 2017 (r326342) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); double fabs(double x) { - if (x < 0) - x = -x; - return(x); + + return (__builtin_fabs(x)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r326375 - head/share/mk
Author: arichardson Date: Wed Nov 29 21:16:14 2017 New Revision: 326375 URL: https://svnweb.freebsd.org/changeset/base/326375 Log: Don't fail the build due to clang integer constant range warnings This warning checks whether a constant is out of range of the integer type. An example is `comparison of 'u_int' > 4294967295 is always false` and in this case the warning makes sense. However, when the type is a typedef that can be either 64 or 32 bits the if condition is only tautological in some configurations so this should not be a warning that fails the build. Reviewed by: dim Approved by: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D12912 Modified: head/share/mk/bsd.sys.mk Modified: head/share/mk/bsd.sys.mk == --- head/share/mk/bsd.sys.mkWed Nov 29 20:44:40 2017(r326374) +++ head/share/mk/bsd.sys.mkWed Nov 29 21:16:14 2017(r326375) @@ -81,6 +81,9 @@ CWARNFLAGS.clang+=-Wno-unused-local-typedef .if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 4 CWARNFLAGS.clang+= -Wno-address-of-packed-member .endif +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 6 +CWARNFLAGS.clang+= -Wno-error=tautological-constant-compare +.endif .endif # WARNS <= 3 .if ${WARNS} <= 2 CWARNFLAGS.clang+= -Wno-switch -Wno-switch-enum -Wno-knr-promoted-parameter ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328062 - head/lib/libnetbsd
Author: arichardson Date: Tue Jan 16 21:43:21 2018 New Revision: 328062 URL: https://svnweb.freebsd.org/changeset/base/328062 Log: libnetbsd: Make the function declaration of efopen() match the definition In order to crossbuild FreeBSD on Mac/Linux I also need to build libnetbsd and FILE* is not equal to struct __sFILE on those platforms. Reviewed By: brooks, emaste Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D13305 Modified: head/lib/libnetbsd/util.h Modified: head/lib/libnetbsd/util.h == --- head/lib/libnetbsd/util.h Tue Jan 16 20:35:54 2018(r328061) +++ head/lib/libnetbsd/util.h Tue Jan 16 21:43:21 2018(r328062) @@ -37,6 +37,7 @@ #include #include +#include void (*esetfunc(void (*)(int, const char *, ...)))(int, const char *, ...); size_t estrlcpy(char *, const char *, size_t); @@ -46,7 +47,7 @@ char *estrndup(const char *, size_t); void *emalloc(size_t); void *ecalloc(size_t, size_t); void *erealloc(void *, size_t); -struct __sFILE *efopen(const char *, const char *); +FILE *efopen(const char *, const char *); int easprintf(char ** __restrict, const char * __restrict, ...) __printflike(2, 3); int evasprintf(char ** __restrict, const char * __restrict, __va_list) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328064 - in head: usr.bin/xinstall usr.sbin/makefs
Author: arichardson Date: Tue Jan 16 21:43:46 2018 New Revision: 328064 URL: https://svnweb.freebsd.org/changeset/base/328064 Log: Allow xinstall and makefs to be crossbuilt on Linux and Mac I need these tools in order to install the crossbuilt FreeBSD and create a disk image. Linux does not have a st_flags in struct stat so unfortunately I need a bunch of ugly ifdefs. The resulting binaries allow me to sucessfully install a MIPS64 world and create a disk-image that boots. Reviewed By: brooks, bdrewery, emaste Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D13307 Modified: head/usr.bin/xinstall/Makefile head/usr.bin/xinstall/xinstall.c head/usr.sbin/makefs/ffs.c head/usr.sbin/makefs/mtree.c Modified: head/usr.bin/xinstall/Makefile == --- head/usr.bin/xinstall/Makefile Tue Jan 16 21:43:36 2018 (r328063) +++ head/usr.bin/xinstall/Makefile Tue Jan 16 21:43:46 2018 (r328064) @@ -11,6 +11,7 @@ MAN= install.1 .PATH: ${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/lib/libnetbsd +CFLAGS+= -DHAVE_STRUCT_STAT_ST_FLAGS=1 LIBADD=md Modified: head/usr.bin/xinstall/xinstall.c == --- head/usr.bin/xinstall/xinstall.cTue Jan 16 21:43:36 2018 (r328063) +++ head/usr.bin/xinstall/xinstall.cTue Jan 16 21:43:46 2018 (r328064) @@ -533,9 +533,11 @@ do_link(const char *from_name, const char *to_name, unlink(tmpl); err(EX_OSERR, "%s", to_name); } +#if HAVE_STRUCT_STAT_ST_FLAGS if (target_sb->st_flags & NOCHANGEBITS) (void)chflags(to_name, target_sb->st_flags & ~NOCHANGEBITS); +#endif if (verbose) printf("install: link %s -> %s\n", from_name, to_name); @@ -579,9 +581,11 @@ do_symlink(const char *from_name, const char *to_name, (void)unlink(tmpl); err(EX_OSERR, "%s", to_name); } +#if HAVE_STRUCT_STAT_ST_FLAGS if (target_sb->st_flags & NOCHANGEBITS) (void)chflags(to_name, target_sb->st_flags & ~NOCHANGEBITS); +#endif if (verbose) printf("install: symlink %s -> %s\n", from_name, to_name); @@ -779,9 +783,11 @@ install(const char *from_name, const char *to_name, u_ if (target && !safecopy) { if (to_sb.st_mode & S_IFDIR && rmdir(to_name) == -1) err(EX_OSERR, "%s", to_name); +#if HAVE_STRUCT_STAT_ST_FLAGS if (to_sb.st_flags & NOCHANGEBITS) (void)chflags(to_name, to_sb.st_flags & ~NOCHANGEBITS); +#endif unlink(to_name); } makelink(from_name, to_name, target ? &to_sb : NULL); @@ -893,9 +899,11 @@ install(const char *from_name, const char *to_name, u_ * and the files are different (or just not compared). */ if (tempcopy && !files_match) { +#if HAVE_STRUCT_STAT_ST_FLAGS /* Try to turn off the immutable bits. */ if (to_sb.st_flags & NOCHANGEBITS) (void)chflags(to_name, to_sb.st_flags & ~NOCHANGEBITS); +#endif if (dobackup) { if ((size_t)snprintf(backup, MAXPATHLEN, "%s%s", to_name, suffix) != strlen(to_name) + strlen(suffix)) { @@ -907,8 +915,10 @@ install(const char *from_name, const char *to_name, u_ (void)printf("install: %s -> %s\n", to_name, backup); if (unlink(backup) < 0 && errno != ENOENT) { serrno = errno; +#if HAVE_STRUCT_STAT_ST_FLAGS if (to_sb.st_flags & NOCHANGEBITS) (void)chflags(to_name, to_sb.st_flags); +#endif unlink(tempfile); errno = serrno; err(EX_OSERR, "unlink: %s", backup); @@ -916,8 +926,10 @@ install(const char *from_name, const char *to_name, u_ if (link(to_name, backup) < 0) { serrno = errno; unlink(tempfile); +#if HAVE_STRUCT_STAT_ST_FLAGS if (to_sb.st_flags & NOCHANGEBITS) (void)chflags(to_name, to_sb.st_flags); +#endif
svn commit: r328065 - head/sys/conf
Author: arichardson Date: Tue Jan 16 21:43:57 2018 New Revision: 328065 URL: https://svnweb.freebsd.org/changeset/base/328065 Log: Use ln -n instead of -h to allow building the kernel on Linux Both flags do the same thing but -n is more widely supported. Reviewed By: jhb, emaste Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D13936 Modified: head/sys/conf/kern.post.mk head/sys/conf/kmod.mk Modified: head/sys/conf/kern.post.mk == --- head/sys/conf/kern.post.mk Tue Jan 16 21:43:46 2018(r328064) +++ head/sys/conf/kern.post.mk Tue Jan 16 21:43:57 2018(r328065) @@ -300,7 +300,7 @@ ${_ILINKS}: path=${S}/${.TARGET}/include ;; \ esac ; \ ${ECHO} ${.TARGET} "->" $$path ; \ - ln -fhs $$path ${.TARGET} + ln -fns $$path ${.TARGET} # .depend needs include links so we remove them only together. kernel-cleandepend: .PHONY Modified: head/sys/conf/kmod.mk == --- head/sys/conf/kmod.mk Tue Jan 16 21:43:46 2018(r328064) +++ head/sys/conf/kmod.mk Tue Jan 16 21:43:57 2018(r328065) @@ -292,7 +292,7 @@ ${_ILINKS}: esac ; \ path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET:T} "->" $$path ; \ - ln -fhs $$path ${.TARGET:T} + ln -fns $$path ${.TARGET:T} CLEANFILES+= ${PROG} ${KMOD}.kld ${OBJS} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r328063 - head
Author: arichardson Date: Tue Jan 16 21:43:36 2018 New Revision: 328063 URL: https://svnweb.freebsd.org/changeset/base/328063 Log: Don't build share/syscons in build-tools stage if MK_SYSCONS == "no" Reviewed By: emaste, jhb Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D12926 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Jan 16 21:43:21 2018(r328062) +++ head/Makefile.inc1 Tue Jan 16 21:43:36 2018(r328063) @@ -1976,7 +1976,7 @@ bootstrap-tools: ${_bt}-${_tool} # # build-tools: Build special purpose build tools # -.if !defined(NO_SHARE) +.if !defined(NO_SHARE) && ${MK_SYSCONS} != "no" _share=share/syscons/scrnmaps .endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354736 - head/share/mk
Author: arichardson Date: Fri Nov 15 16:43:36 2019 New Revision: 354736 URL: https://svnweb.freebsd.org/changeset/base/354736 Log: Use __ as the separator for the exported vars in bsd.compiler/linker.mk By using '__' instead of '.' as the separator we can also support systems that use dash as /bin/sh (it's the default shell on Ubuntu/Debian). Dash will unset any environment variables that use a non alphanumeric+undedscore character and therefore submakes will fail to import the COMPILER_* variables if we use '.' as the separator. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D22381 Modified: head/share/mk/bsd.compiler.mk head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.compiler.mk == --- head/share/mk/bsd.compiler.mk Fri Nov 15 16:40:55 2019 (r354735) +++ head/share/mk/bsd.compiler.mk Fri Nov 15 16:43:36 2019 (r354736) @@ -155,8 +155,8 @@ _can_export=no .endfor .if ${_can_export} == yes .for var in ${_exported_vars} -.if defined(${var}.${${X_}_cc_hash}) -${var}=${${var}.${${X_}_cc_hash}} +.if defined(${var}__${${X_}_cc_hash}) +${var}=${${var}__${${X_}_cc_hash}} .endif .endfor .endif @@ -229,9 +229,9 @@ X_COMPILER_FEATURES=${COMPILER_FEATURES} # Export the values so sub-makes don't have to look them up again, using the # hash key computed above. .for var in ${_exported_vars} -${var}.${${X_}_cc_hash}:= ${${var}} -.export-env ${var}.${${X_}_cc_hash} -.undef ${var}.${${X_}_cc_hash} +${var}__${${X_}_cc_hash}:= ${${var}} +.export-env ${var}__${${X_}_cc_hash} +.undef ${var}__${${X_}_cc_hash} .endfor .endif # ${cc} == "CC" || !empty(XCC) Modified: head/share/mk/bsd.linker.mk == --- head/share/mk/bsd.linker.mk Fri Nov 15 16:40:55 2019(r354735) +++ head/share/mk/bsd.linker.mk Fri Nov 15 16:43:36 2019(r354736) @@ -50,8 +50,8 @@ _can_export= no .endfor .if ${_can_export} == yes .for var in ${_exported_vars} -.if defined(${var}.${${X_}_ld_hash}) -${var}=${${var}.${${X_}_ld_hash}} +.if defined(${var}__${${X_}_ld_hash}) +${var}=${${var}__${${X_}_ld_hash}} .endif .endfor .endif @@ -101,9 +101,9 @@ X_LINKER_FREEBSD_VERSION= ${LINKER_FREEBSD_VERSION} # Export the values so sub-makes don't have to look them up again, using the # hash key computed above. .for var in ${_exported_vars} -${var}.${${X_}_ld_hash}:= ${${var}} -.export-env ${var}.${${X_}_ld_hash} -.undef ${var}.${${X_}_ld_hash} +${var}__${${X_}_ld_hash}:= ${${var}} +.export-env ${var}__${${X_}_ld_hash} +.undef ${var}__${${X_}_ld_hash} .endfor .endif # ${ld} == "LD" || !empty(XLD) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354739 - head/usr.sbin/makefs
Author: arichardson Date: Fri Nov 15 18:34:30 2019 New Revision: 354739 URL: https://svnweb.freebsd.org/changeset/base/354739 Log: makefs: Also set UFS di_birthtime when building on Linux Since st_birthtime doesn't exists on Linux (unless you use statx(2)), we instead populate it with the st_ctime value. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D22386 Modified: head/usr.sbin/makefs/ffs.c Modified: head/usr.sbin/makefs/ffs.c == --- head/usr.sbin/makefs/ffs.c Fri Nov 15 18:34:23 2019(r354738) +++ head/usr.sbin/makefs/ffs.c Fri Nov 15 18:34:30 2019(r354739) @@ -728,15 +728,22 @@ ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t * dinp->di_atime = st->st_atime; dinp->di_mtime = st->st_mtime; dinp->di_ctime = st->st_ctime; +#if HAVE_STRUCT_STAT_BIRTHTIME + dinp->di_birthtime = st->st_birthtime; +#else + dinp->di_birthtime = st->st_ctime; +#endif #if HAVE_STRUCT_STAT_ST_MTIMENSEC dinp->di_atimensec = st->st_atimensec; dinp->di_mtimensec = st->st_mtimensec; dinp->di_ctimensec = st->st_ctimensec; -#endif #if HAVE_STRUCT_STAT_BIRTHTIME - dinp->di_birthtime = st->st_birthtime; dinp->di_birthnsec = st->st_birthtimensec; +#else + dinp->di_birthnsec = st->st_ctimensec; #endif +#endif + /* not set: di_db, di_ib, di_blocks, di_spare */ membuf = NULL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354740 - head/share/mk
Author: arichardson Date: Fri Nov 15 18:34:36 2019 New Revision: 354740 URL: https://svnweb.freebsd.org/changeset/base/354740 Log: Fix build race in bsd.files.mk We need to ensure that installdirs-FOO runs before installfiles-FOO since otherwise the directory may not exist when we attempt to install the target. This was randomly causing failures in our Jenkins instance when installing drti.o in cddl/lib/drti. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D22382 Modified: head/share/mk/bsd.files.mk Modified: head/share/mk/bsd.files.mk == --- head/share/mk/bsd.files.mk Fri Nov 15 18:34:30 2019(r354739) +++ head/share/mk/bsd.files.mk Fri Nov 15 18:34:36 2019(r354740) @@ -112,12 +112,11 @@ STAGE_AS_SETS+= ${${_${group}DIR_${file}}:C,[/*],_,g} STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}} stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file} -installfiles-${group}: _${group}INS1_${file} -_${group}INS1_${file}: installdirs-${_${group}DIR_${file}} _${group}INS_${file} -_${group}INS_${file}: ${file} +installfiles-${group}: _${group}INS_${file} +_${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}} ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \ -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \ - ${.ALLSRC} ${${group}PREFIX_${file}}/${${group}NAME_${file}} + ${.ALLSRC:[1]} ${${group}PREFIX_${file}}/${${group}NAME_${file}} .endfor # file in ${${group}} .endif # defined(${group}) && !empty(${group}) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354738 - head/usr.sbin/makefs
Author: arichardson Date: Fri Nov 15 18:34:23 2019 New Revision: 354738 URL: https://svnweb.freebsd.org/changeset/base/354738 Log: Fix contents= being ignored in msdosfs makefs mtree I noticed this while trying to build an EFI boot image Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D22387 Modified: head/usr.sbin/makefs/msdos.c Modified: head/usr.sbin/makefs/msdos.c == --- head/usr.sbin/makefs/msdos.cFri Nov 15 18:02:37 2019 (r354737) +++ head/usr.sbin/makefs/msdos.cFri Nov 15 18:34:23 2019 (r354738) @@ -262,7 +262,8 @@ msdos_populate_dir(const char *path, struct denode *di cur->name); continue; } - if (msdosfs_mkfile(pbuf, dir, cur) == NULL) { + if (msdosfs_mkfile(cur->contents ? cur->contents : pbuf, dir, + cur) == NULL) { warn("msdosfs_mkfile %s", pbuf); return -1; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354796 - head/usr.sbin/i2c
Author: arichardson Date: Sun Nov 17 19:04:02 2019 New Revision: 354796 URL: https://svnweb.freebsd.org/changeset/base/354796 Log: Fix error found by new clang operator precendence warning error: operator '?:' has lower precedence than '|'; '|' will be evaluated first I discovered this in CheriBSD after updating our fork of clang to the latest upstream master. Reviewed By: ian Differential Revision: https://reviews.freebsd.org/D22433 Modified: head/usr.sbin/i2c/i2c.c Modified: head/usr.sbin/i2c/i2c.c == --- head/usr.sbin/i2c/i2c.c Sun Nov 17 18:38:37 2019(r354795) +++ head/usr.sbin/i2c/i2c.c Sun Nov 17 19:04:02 2019(r354796) @@ -590,7 +590,7 @@ i2c_rdwr_transfer(char *dev, struct options i2c_opt, c * because of the NOSTOP flag used above. */ if (i2c_opt.dir == 'w') - msgs[i].flags = IIC_M_WR | (i > 0) ? IIC_M_NOSTART : 0; + msgs[i].flags = IIC_M_WR | ((i > 0) ? IIC_M_NOSTART : 0); else msgs[i].flags = IIC_M_RD; msgs[i].slave = i2c_opt.addr; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r354901 - head/usr.bin/xinstall
Author: arichardson Date: Wed Nov 20 17:24:49 2019 New Revision: 354901 URL: https://svnweb.freebsd.org/changeset/base/354901 Log: Allow boostrapping xinstall on Linux Linux does not have st_flags so we have to avoid using it there. Reviewed By: emaste, imp Differential Revision: https://reviews.freebsd.org/D22446 Modified: head/usr.bin/xinstall/Makefile head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/Makefile == --- head/usr.bin/xinstall/Makefile Wed Nov 20 16:54:21 2019 (r354900) +++ head/usr.bin/xinstall/Makefile Wed Nov 20 17:24:49 2019 (r354901) @@ -11,7 +11,6 @@ MAN= install.1 .PATH: ${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/contrib/mtree CFLAGS+= -I${SRCTOP}/lib/libnetbsd -CFLAGS+= -DHAVE_STRUCT_STAT_ST_FLAGS=1 LIBADD=md Modified: head/usr.bin/xinstall/xinstall.c == --- head/usr.bin/xinstall/xinstall.cWed Nov 20 16:54:21 2019 (r354900) +++ head/usr.bin/xinstall/xinstall.cWed Nov 20 17:24:49 2019 (r354901) @@ -75,6 +75,17 @@ __FBSDID("$FreeBSD$"); #include "mtree.h" +/* + * We need to build xinstall during the bootstrap stage when building on a + * non-FreeBSD system. Linux does not have the st_flags and st_birthtime + * members in struct stat so we need to omit support for changing those fields. + */ +#ifdef UF_SETTABLE +#define HAVE_STRUCT_STAT_ST_FLAGS 1 +#else +#define HAVE_STRUCT_STAT_ST_FLAGS 0 +#endif + #define MAX_CMP_SIZE (16 * 1024 * 1024) #defineLN_ABSOLUTE 0x01 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r348777 - head
Author: arichardson Date: Fri Jun 7 15:23:52 2019 New Revision: 348777 URL: https://svnweb.freebsd.org/changeset/base/348777 Log: Add a basic clang-format configuration file This gets reasonably close to the existing format in sys/kern but will probably require some changes to upstream clang-format before it can be used as the default formatting tool. I tried formatting a few files in sys/kern and the result is pretty close to the existing code. However, this configuration file is not ready to be used without manually checking the output. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D20533 Added: head/.clang-format (contents, props changed) Modified: head/.gitattributes Added: head/.clang-format == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/.clang-format Fri Jun 7 15:23:52 2019(r348777) @@ -0,0 +1,77 @@ +# $FreeBSD$ +# Basic .clang-format +--- +BasedOnStyle: WebKit +AlignAfterOpenBracket: DontAlign +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: false +AlignTrailingComments: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: InlineOnly +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: TopLevelDefinitions +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: MultiLine +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: WebKit +BreakBeforeTernaryOperators: false +# TODO: BreakStringLiterals can cause very strange formatting so turn it off? +BreakStringLiterals: false +PenaltyBreakBeforeFirstCallParameter: 1000 +CompactNamespaces: true +DerivePointerAlignment: false +DisableFormat: false +ForEachMacros: + - SLIST_FOREACH + - SLIST_FOREACH_SAFE + - LIST_FOREACH + - LIST_FOREACH_SAFE + - STAILQ_FOREACH + - STAILQ_FOREACH_SAFE + - TAILQ_FOREACH + - TAILQ_FOREACH_SAFE + - TAILQ_FOREACH_REVERSE + - TAILQ_FOREACH_REVERSE_SAFE + - RB_FOREACH + - RB_FOREACH_SAFE + - RB_FOREACH_FROM + - RB_FOREACH_REVERSE + - RB_FOREACH_REVERSE_FROM + - RB_FOREACH_REVERSE_SAFE + - FOREACH_THREAD_IN_PROC + - FOREACH_PROC_IN_SYSTEM + - FOREACH_PRISON_CHILD + - FOREACH_PRISON_DESCENDANT + - FOREACH_PRISON_DESCENDANT_LOCKED + - FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL + - MNT_VNODE_FOREACH_ALL + - MNT_VNODE_FOREACH_ACTIVE +IndentCaseLabels: false +IndentPPDirectives: None +Language: Cpp +NamespaceIndentation: None +PointerAlignment: Right +ContinuationIndentWidth: 4 +IndentWidth: 8 +TabWidth: 8 +ColumnLimit: 80 +UseTab: Always +SpaceAfterCStyleCast: false +SortIncludes: false +KeepEmptyLinesAtTheStartOfBlocks: true +# The options below will only be supported starting with clang 9.0: +# TODO-CLANG-9: TypenameMacros: +# TODO-CLANG-9: - SLIST_HEAD +# TODO-CLANG-9: - SLIST_ENTRY +# TODO-CLANG-9: - TAILQ_ENTRY +# TODO-CLANG-9: - TAILQ_HEAD +# TODO-CLANG-9: - STAILQ_ENTRY +# TODO-CLANG-9: - STAILQ_HEAD +... Modified: head/.gitattributes == --- head/.gitattributes Fri Jun 7 14:51:55 2019(r348776) +++ head/.gitattributes Fri Jun 7 15:23:52 2019(r348777) @@ -4,3 +4,4 @@ *.hpp diff=cpp *.py diff=python . svn-properties=svn:keywords=tools/build/options/WITHOUT_LOADER_ZFS +.clang-format svn-properties=svn:keywords=FreeBSD=%H ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349298 - head/lib/libc/gen
Author: arichardson Date: Sun Jun 23 10:47:07 2019 New Revision: 349298 URL: https://svnweb.freebsd.org/changeset/base/349298 Log: Fix two WARNS=6 warnings in opendir.c and telldir.c This is in preparation for compiling these files as part of rtld (which is built with WARNS=6). See https://reviews.freebsd.org/D20663 for more details. Modified: head/lib/libc/gen/opendir.c head/lib/libc/gen/telldir.c Modified: head/lib/libc/gen/opendir.c == --- head/lib/libc/gen/opendir.c Sun Jun 23 10:45:50 2019(r349297) +++ head/lib/libc/gen/opendir.c Sun Jun 23 10:47:07 2019(r349298) @@ -99,8 +99,8 @@ static int opendir_compar(const void *p1, const void *p2) { - return (strcmp((*(const struct dirent **)p1)->d_name, - (*(const struct dirent **)p2)->d_name)); + return (strcmp((*(const struct dirent * const *)p1)->d_name, + (*(const struct dirent * const *)p2)->d_name)); } /* Modified: head/lib/libc/gen/telldir.c == --- head/lib/libc/gen/telldir.c Sun Jun 23 10:45:50 2019(r349297) +++ head/lib/libc/gen/telldir.c Sun Jun 23 10:47:07 2019(r349298) @@ -63,8 +63,8 @@ telldir(DIR *dirp) * 2) Otherwise, see if it's already been recorded in the linked list * 3) Otherwise, malloc a new one */ - if (dirp->dd_seek < (1ul << DD_SEEK_BITS) && - dirp->dd_loc < (1ul << DD_LOC_BITS)) { + if (dirp->dd_seek < (off_t)(1l << DD_SEEK_BITS) && + dirp->dd_loc < (1l << DD_LOC_BITS)) { ddloc.s.is_packed = 1; ddloc.s.loc = dirp->dd_loc; ddloc.s.seek = dirp->dd_seek; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349416 - head/lib/libc/stdlib
Author: arichardson Date: Wed Jun 26 15:43:20 2019 New Revision: 349416 URL: https://svnweb.freebsd.org/changeset/base/349416 Log: Fix -Wsign-compare warnings in realpath.c This is needed in order to build realpath.c as part of rtld. Modified: head/lib/libc/stdlib/realpath.c Modified: head/lib/libc/stdlib/realpath.c == --- head/lib/libc/stdlib/realpath.c Wed Jun 26 15:34:35 2019 (r349415) +++ head/lib/libc/stdlib/realpath.c Wed Jun 26 15:43:20 2019 (r349416) @@ -91,7 +91,7 @@ realpath1(const char *path, char *resolved) */ p = strchr(left, '/'); - next_token_len = p != NULL ? p - left : left_len; + next_token_len = p != NULL ? (size_t)(p - left) : left_len; memcpy(next_token, left, next_token_len); next_token[next_token_len] = '\0'; @@ -146,7 +146,7 @@ realpath1(const char *path, char *resolved) return (NULL); } slen = readlink(resolved, symlink, sizeof(symlink)); - if (slen <= 0 || slen >= sizeof(symlink)) { + if (slen <= 0 || slen >= (ssize_t)sizeof(symlink)) { if (slen < 0) ; /* keep errno from readlink(2) call */ else if (slen == 0) @@ -173,7 +173,7 @@ realpath1(const char *path, char *resolved) */ if (p != NULL) { if (symlink[slen - 1] != '/') { - if (slen + 1 >= sizeof(symlink)) { + if (slen + 1 >= (ssize_t)sizeof(symlink)) { errno = ENAMETOOLONG; return (NULL); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349417 - head/libexec/rtld-elf
Author: arichardson Date: Wed Jun 26 15:43:26 2019 New Revision: 349417 URL: https://svnweb.freebsd.org/changeset/base/349417 Log: Use rtld_putstr() instead of write() for the rtld msg() macro This removes an unnecessary libc dependency from rtld. See https://reviews.freebsd.org/D20663 for more details. Modified: head/libexec/rtld-elf/debug.h head/libexec/rtld-elf/rtld_printf.h Modified: head/libexec/rtld-elf/debug.h == --- head/libexec/rtld-elf/debug.h Wed Jun 26 15:43:20 2019 (r349416) +++ head/libexec/rtld-elf/debug.h Wed Jun 26 15:43:26 2019 (r349417) @@ -37,7 +37,7 @@ #include #include -#include +#include "rtld_printf.h" void debug_printf(const char *, ...) __printflike(1, 2); extern int debug; @@ -57,7 +57,7 @@ extern int debug; #define assert(cond) ((cond) ? (void) 0 :\ (msg(_MYNAME ": assert failed: " __FILE__ ":" \ __XSTRING(__LINE__) "\n"), abort())) -#define msg(s) write(STDOUT_FILENO, s, strlen(s)) +#define msg(s) rtld_putstr(s) #define trace()msg(_MYNAME ": " __XSTRING(__LINE__) "\n") Modified: head/libexec/rtld-elf/rtld_printf.h == --- head/libexec/rtld-elf/rtld_printf.h Wed Jun 26 15:43:20 2019 (r349416) +++ head/libexec/rtld-elf/rtld_printf.h Wed Jun 26 15:43:26 2019 (r349417) @@ -31,6 +31,7 @@ #define RTLD_PRINTF_H 1 #include +#include #include int rtld_snprintf(char *buf, size_t bufsize, const char *fmt, ...) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349554 - in head: lib/libc/gen libexec/rtld-elf libexec/rtld-elf/rtld-libc
Author: arichardson Date: Sun Jun 30 11:49:58 2019 New Revision: 349554 URL: https://svnweb.freebsd.org/changeset/base/349554 Log: Reduce size of rtld by 22% by pulling in less code from libc Currently RTLD is linked against libc_nossp_pic which means that any libc symbol used in rtld can pull in a lot of depedencies. This was causing symbol such as __libc_interposing and all the pthread stubs to be included in RTLD even though they are not required. It turns out most of these dependencies can easily be avoided by providing overrides inside of rtld. This change is motivated by CHERI, where we have an experimental ABI that requires additional relocation processing to allow the use of function pointers inside of rtld. Instead of adding this self-relocation code to RTLD I attempted to remove most function pointers from RTLD and discovered that most of them came from the libc dependencies instead of being actually used inside rtld. A nice side-effect of this change is that rtld is now 22% smaller on amd64. text data bss dec hex filename 0x21eb6 0xce0 0xe60 145910 239f6 /home/alr48/ld-elf-x86.before.so.1 0x1a6ed 0x728 0xdd8 113645 1bbed /home/alr48/ld-elf-x86.after.so.1 The number of R_X86_64_RELATIVE relocations that need to be processed on startup has also gone down from 368 to 187 (almost 50% less). Reviewed By: kib Differential Revision: https://reviews.freebsd.org/D20663 Added: head/libexec/rtld-elf/rtld-libc/ head/libexec/rtld-elf/rtld-libc/Makefile.inc (contents, props changed) head/libexec/rtld-elf/rtld-libc/libc_private.h (contents, props changed) head/libexec/rtld-elf/rtld-libc/namespace.h (contents, props changed) head/libexec/rtld-elf/rtld-libc/rtld_libc.c (contents, props changed) head/libexec/rtld-elf/rtld-libc/rtld_libc.h (contents, props changed) head/libexec/rtld-elf/rtld-libc/un-namespace.h (contents, props changed) Modified: head/lib/libc/gen/gen-private.h head/libexec/rtld-elf/Makefile head/libexec/rtld-elf/libmap.c head/libexec/rtld-elf/rtld.c head/libexec/rtld-elf/rtld_lock.c head/libexec/rtld-elf/rtld_printf.c head/libexec/rtld-elf/xmalloc.c Modified: head/lib/libc/gen/gen-private.h == --- head/lib/libc/gen/gen-private.h Sun Jun 30 06:44:35 2019 (r349553) +++ head/lib/libc/gen/gen-private.h Sun Jun 30 11:49:58 2019 (r349554) @@ -51,7 +51,11 @@ struct _dirdesc { int dd_len; /* size of data buffer */ off_t dd_seek;/* magic cookie returned by getdirentries */ int dd_flags; /* flags for readdir */ +#ifndef IN_RTLD struct pthread_mutex*dd_lock; /* lock */ +#else + struct _donotuse*dd_lock; /* unused in rtld, keep same layout */ +#endif struct _telldir *dd_td; /* telldir position recording */ void*dd_compat_de; /* compat dirent */ }; Modified: head/libexec/rtld-elf/Makefile == --- head/libexec/rtld-elf/Makefile Sun Jun 30 06:44:35 2019 (r349553) +++ head/libexec/rtld-elf/Makefile Sun Jun 30 11:49:58 2019 (r349554) @@ -63,7 +63,8 @@ CFLAGS+= -fvisibility=hidden CFLAGS.reloc.c+=-fno-jump-tables .endif LDFLAGS+= -shared -Wl,-Bsymbolic -Wl,-z,defs -LIBADD=c_nossp_pic +# Pull in the dependencies that we use from libc +.include "rtld-libc/Makefile.inc" .if ${MK_TOOLCHAIN} == "no" LDFLAGS+= -L${LIBCDIR} .endif Modified: head/libexec/rtld-elf/libmap.c == --- head/libexec/rtld-elf/libmap.c Sun Jun 30 06:44:35 2019 (r349553) +++ head/libexec/rtld-elf/libmap.c Sun Jun 30 11:49:58 2019 (r349554) @@ -17,6 +17,7 @@ #include "rtld.h" #include "libmap.h" #include "paths.h" +#include "rtld_libc.h" TAILQ_HEAD(lm_list, lm); struct lm { Added: head/libexec/rtld-elf/rtld-libc/Makefile.inc == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/rtld-elf/rtld-libc/Makefile.incSun Jun 30 11:49:58 2019(r349554) @@ -0,0 +1,101 @@ +# $FreeBSD$ +# This makefiles adds the necessary libc dependencies for RTLD without pulling +# in all of the complex libc bits such as locales, etc. + +.include + +LIBC_SRCTOP=${SRCTOP}/lib/libc +.if exists(${LIBC_SRCTOP}/${MACHINE_ARCH}) +LIBC_ARCH=${MACHINE_ARCH} +.else +LIBC_ARCH=${MACHINE_CPUARCH} +.endif + +CFLAGS+= -I${SRCTOP}/libexec/rtld-elf/rtld-libc + +# Build all the libc files that use interposed symbols or pthreads again for +# RTLD. We compile with a different libc_private.h and namespace.h that +# redirects all calls to interposed functions to u
svn commit: r349555 - head/libexec/rtld-elf/rtld-libc
Author: arichardson Date: Sun Jun 30 14:04:30 2019 New Revision: 349555 URL: https://svnweb.freebsd.org/changeset/base/349555 Log: Fix my name in license header Reported by: trasz Modified: head/libexec/rtld-elf/rtld-libc/libc_private.h head/libexec/rtld-elf/rtld-libc/namespace.h head/libexec/rtld-elf/rtld-libc/rtld_libc.c head/libexec/rtld-elf/rtld-libc/rtld_libc.h head/libexec/rtld-elf/rtld-libc/un-namespace.h Modified: head/libexec/rtld-elf/rtld-libc/libc_private.h == --- head/libexec/rtld-elf/rtld-libc/libc_private.h Sun Jun 30 11:49:58 2019(r349554) +++ head/libexec/rtld-elf/rtld-libc/libc_private.h Sun Jun 30 14:04:30 2019(r349555) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2019 Alex Richadson + * Copyright 2019 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and Modified: head/libexec/rtld-elf/rtld-libc/namespace.h == --- head/libexec/rtld-elf/rtld-libc/namespace.h Sun Jun 30 11:49:58 2019 (r349554) +++ head/libexec/rtld-elf/rtld-libc/namespace.h Sun Jun 30 14:04:30 2019 (r349555) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2019 Alex Richadson + * Copyright 2019 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and Modified: head/libexec/rtld-elf/rtld-libc/rtld_libc.c == --- head/libexec/rtld-elf/rtld-libc/rtld_libc.c Sun Jun 30 11:49:58 2019 (r349554) +++ head/libexec/rtld-elf/rtld-libc/rtld_libc.c Sun Jun 30 14:04:30 2019 (r349555) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2019 Alex Richadson + * Copyright 2019 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and Modified: head/libexec/rtld-elf/rtld-libc/rtld_libc.h == --- head/libexec/rtld-elf/rtld-libc/rtld_libc.h Sun Jun 30 11:49:58 2019 (r349554) +++ head/libexec/rtld-elf/rtld-libc/rtld_libc.h Sun Jun 30 14:04:30 2019 (r349555) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2019 Alex Richadson + * Copyright 2019 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and Modified: head/libexec/rtld-elf/rtld-libc/un-namespace.h == --- head/libexec/rtld-elf/rtld-libc/un-namespace.h Sun Jun 30 11:49:58 2019(r349554) +++ head/libexec/rtld-elf/rtld-libc/un-namespace.h Sun Jun 30 14:04:30 2019(r349555) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause * - * Copyright 2019 Alex Richadson + * Copyright 2019 Alex Richardson * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory (Department of Computer Science and ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349561 - head/libexec/rtld-elf/rtld-libc
Author: arichardson Date: Sun Jun 30 17:03:14 2019 New Revision: 349561 URL: https://svnweb.freebsd.org/changeset/base/349561 Log: Fix CROSS_TOOLCHAIN=amd64-gcc build after r349554 Apparently clang can remove the reference to __umoddi3 but GCC keeps it. Reported by: lwhsu Modified: head/libexec/rtld-elf/rtld-libc/Makefile.inc Modified: head/libexec/rtld-elf/rtld-libc/Makefile.inc == --- head/libexec/rtld-elf/rtld-libc/Makefile.incSun Jun 30 15:01:19 2019(r349560) +++ head/libexec/rtld-elf/rtld-libc/Makefile.incSun Jun 30 17:03:14 2019(r349561) @@ -58,7 +58,7 @@ _libc_other_objects+=aeabi_unwind_cpp .elif ${LIBC_ARCH} == "i386" # __udivdi3 is needed by kvprintf() in rtld_printf.c # i386 also needs i386_set_gsbase for allocate_initial_tls() -_libc_other_objects+=udivdi3 qdivrem i386_set_gsbase +_libc_other_objects+=umoddi3 udivdi3 qdivrem i386_set_gsbase .elif ${LIBC_ARCH} == "powerpc" || ${LIBC_ARCH} == "powerpcspe" # ppc needs __syncicache for reloc.c and __umoddi3+__udivdi3 for rtld_printf.c _libc_other_objects+=syncicache umoddi3 udivdi3 qdivrem ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349576 - head/kerberos5/usr.bin/krb5-config
Author: arichardson Date: Mon Jul 1 11:47:45 2019 New Revision: 349576 URL: https://svnweb.freebsd.org/changeset/base/349576 Log: Fix generation of krb5-config with LC_CTYPE=*.UTF-8 When building on MacOS with a UTF-8 locale sed will fail when reading krb-config.in due to invalid characters. Forcing the "C" locale fixes this. Reviewed By: emaste, cy Differential Revision: https://reviews.freebsd.org/D16849 Modified: head/kerberos5/usr.bin/krb5-config/Makefile Modified: head/kerberos5/usr.bin/krb5-config/Makefile == --- head/kerberos5/usr.bin/krb5-config/Makefile Mon Jul 1 10:15:52 2019 (r349575) +++ head/kerberos5/usr.bin/krb5-config/Makefile Mon Jul 1 11:47:45 2019 (r349576) @@ -5,8 +5,12 @@ MAN= krb5-config.1 CLEANFILES= krb5-config +# In order for this to work on MacOS we need to set LC_ALL=C since the +# krb5-config.in file contains characters that will be rejected by MacOS with +# a UTF-8 locale (see https://stackoverflow.com/a/23584470/894271) +# TODO: Should we just require LC_ALL=C during the build? krb5-config: krb5-config.in - sed -e "s,@PACKAGE@,FreeBSD heimdal,g" \ + env LC_ALL=C sed -e "s,@PACKAGE@,FreeBSD heimdal,g" \ -e "s,@VERSION@,1.1.0,g" \ -e "s,@prefix@,/usr,g" \ -e "s,@exec_prefix@,/usr,g" \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349577 - in head: contrib/elftoolchain/common contrib/elftoolchain/libelftc lib/libelf
Author: arichardson Date: Mon Jul 1 11:52:54 2019 New Revision: 349577 URL: https://svnweb.freebsd.org/changeset/base/349577 Log: Allow bootstrapping elftoolchain on MacOS and Linux This is required in order to build on non-FreeBSD systems without setting all the XAR/XSTRINGS/etc. variables Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D16771 Modified: head/contrib/elftoolchain/common/_elftc.h head/contrib/elftoolchain/libelftc/elftc_set_timestamps.c head/lib/libelf/Makefile Modified: head/contrib/elftoolchain/common/_elftc.h == --- head/contrib/elftoolchain/common/_elftc.h Mon Jul 1 11:47:45 2019 (r349576) +++ head/contrib/elftoolchain/common/_elftc.h Mon Jul 1 11:52:54 2019 (r349577) @@ -374,11 +374,14 @@ extern const char *__progname; #include #definehtobe32(x) OSSwapHostToBigInt32(x) +#definehtole32(x) OSSwapHostToLittleInt32(x) +#ifndef roundup2 #defineroundup2roundup +#endif -#defineELFTC_BYTE_ORDER_BYTE_ORDER -#defineELFTC_BYTE_ORDER_LITTLE_ENDIAN _LITTLE_ENDIAN -#defineELFTC_BYTE_ORDER_BIG_ENDIAN _BIG_ENDIAN +#defineELFTC_BYTE_ORDER__DARWIN_BYTE_ORDER +#defineELFTC_BYTE_ORDER_LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN +#defineELFTC_BYTE_ORDER_BIG_ENDIAN __DARWIN_BIG_ENDIAN #defineELFTC_HAVE_MMAP 1 #defineELFTC_HAVE_STRMODE 1 @@ -418,7 +421,9 @@ extern const char *__progname; /* Whether we need to supply {be,le}32dec. */ #define ELFTC_NEED_BYTEORDER_EXTENSIONS1 +#ifndef roundup2 #defineroundup2roundup +#endif #endif /* __GLIBC__ || __linux__ */ Modified: head/contrib/elftoolchain/libelftc/elftc_set_timestamps.c == --- head/contrib/elftoolchain/libelftc/elftc_set_timestamps.c Mon Jul 1 11:47:45 2019(r349576) +++ head/contrib/elftoolchain/libelftc/elftc_set_timestamps.c Mon Jul 1 11:52:54 2019(r349577) @@ -37,7 +37,7 @@ ELFTC_VCSID("$Id$"); * stat'. */ -#ifdefined(__FreeBSD__) || defined(__NetBSD__) +#ifdefined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__) #defineATIME st_atimespec #defineMTIME st_mtimespec #defineLIBELFTC_HAVE_UTIMES1 Modified: head/lib/libelf/Makefile == --- head/lib/libelf/MakefileMon Jul 1 11:47:45 2019(r349576) +++ head/lib/libelf/MakefileMon Jul 1 11:52:54 2019(r349577) @@ -79,6 +79,13 @@ INCS=libelf.h gelf.h # SRCS+= sys/elf32.h sys/elf64.h sys/elf_common.h +# Allow bootstrapping elftoolchain on Linux: +.if defined(BOOTSTRAPPING) && ${.MAKE.OS} == "Linux" +native-elf-format.h: + ${ELFTCDIR}/common/native-elf-format > ${.TARGET} || rm ${.TARGET} +SRCS+= native-elf-format.h +.endif + GENSRCS= libelf_fsize.c libelf_msize.c libelf_convert.c CLEANFILES=${GENSRCS} CLEANDIRS= sys ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r349615 - head/libexec/rtld-elf/rtld-libc
Author: arichardson Date: Tue Jul 2 22:11:07 2019 New Revision: 349615 URL: https://svnweb.freebsd.org/changeset/base/349615 Log: Fix build race when building rtld I found this on one of the CheriBSD Jenkins builders. Using beforelinking instead of ${PROG} should fix the dependency for the DEBUG_FILES case. Reviewed by: brooks Modified: head/libexec/rtld-elf/rtld-libc/Makefile.inc Modified: head/libexec/rtld-elf/rtld-libc/Makefile.inc == --- head/libexec/rtld-elf/rtld-libc/Makefile.incTue Jul 2 21:03:06 2019(r349614) +++ head/libexec/rtld-elf/rtld-libc/Makefile.incTue Jul 2 22:11:07 2019(r349615) @@ -98,4 +98,4 @@ rtld_libc.a: ${LIBC_NOSSP_PIC} ${SRCTOP}/libexec/rtld- ${AR} cr ${.OBJDIR}/${.TARGET} ${_rtld_libc_objs} CLEANFILES+=rtld_libc.a LDADD+=${.OBJDIR}/rtld_libc.a -${PROG}: rtld_libc.a +beforelinking: rtld_libc.a ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363216 - head/lib/libpmc
Author: arichardson Date: Wed Jul 15 12:07:47 2020 New Revision: 363216 URL: https://svnweb.freebsd.org/changeset/base/363216 Log: Avoid rebuilding libpmc in every incremental rebuild Generate libpmc_events.c in a temporary file first and only overwrite it if the files are actually different. This avoids compiling and relinking the different variants of libpmc on every incremental build. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D24784 Modified: head/lib/libpmc/Makefile Modified: head/lib/libpmc/Makefile == --- head/lib/libpmc/MakefileWed Jul 15 10:24:39 2020(r363215) +++ head/lib/libpmc/MakefileWed Jul 15 12:07:47 2020(r363216) @@ -32,9 +32,13 @@ SUBDIR+= pmu-events .endif .endif -libpmc_events.c: ${JEVENTS} - ${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch libpmc_events.c -SRCS+= libpmc_events.c +libpmc_events.c: ${JEVENTS} .META + ${JEVENTS} ${EVENT_ARCH} ${.CURDIR}/pmu-events/arch ${.TARGET}.tmp + if [ ! -e ${.TARGET} ] || ! cmp -s ${.TARGET} ${.TARGET}.tmp; then \ + mv -f ${.TARGET}.tmp ${.TARGET}; \ + fi +CLEANFILES+= libpmc_events.c libpmc_events.c.tmp +SRCS+= libpmc_events.c .endif WARNS?=3 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363218 - in head/usr.bin/localedef: . bootstrap
Author: arichardson Date: Wed Jul 15 12:07:59 2020 New Revision: 363218 URL: https://svnweb.freebsd.org/changeset/base/363218 Log: Allow bootstrapping localdef on non-FreeBSD systems The current localedef simply assumes that the locale headers on build system are compatible with those on the target system which is not necessarily true. It generally works on FreeBSD (as long as we don't change the locale headers), but Linux and macOS provide completely different locale headers. This change adds new bootstrap headers that namespace certain xlocale structures defined or used by in the headers that localdef needs. This is required since system headers *must* be able to include the "real" locale headers for printf(), etc., but we also want to access the target systems's internal locale structures. Reviewed By: yuripv, brooks Differential Revision: https://reviews.freebsd.org/D25229 Added: head/usr.bin/localedef/bootstrap/ head/usr.bin/localedef/bootstrap/_ctype.h (contents, props changed) head/usr.bin/localedef/bootstrap/bootstrap_xlocale_private.h (contents, props changed) head/usr.bin/localedef/bootstrap/collate.h (contents, props changed) head/usr.bin/localedef/bootstrap/ctype.h (contents, props changed) head/usr.bin/localedef/bootstrap/limits.h (contents, props changed) head/usr.bin/localedef/bootstrap/lmessages.h (contents, props changed) head/usr.bin/localedef/bootstrap/lmonetary.h (contents, props changed) head/usr.bin/localedef/bootstrap/lnumeric.h (contents, props changed) head/usr.bin/localedef/bootstrap/namespace.h (contents, props changed) head/usr.bin/localedef/bootstrap/timelocal.h (contents, props changed) head/usr.bin/localedef/bootstrap/un-namespace.h (contents, props changed) head/usr.bin/localedef/bootstrap/xlocale.h (contents, props changed) Modified: head/usr.bin/localedef/Makefile head/usr.bin/localedef/collate.c head/usr.bin/localedef/ctype.c Modified: head/usr.bin/localedef/Makefile == --- head/usr.bin/localedef/Makefile Wed Jul 15 12:07:53 2020 (r363217) +++ head/usr.bin/localedef/Makefile Wed Jul 15 12:07:59 2020 (r363218) @@ -20,6 +20,9 @@ parser.h: parser.y IGNORE_PRAGMA= yes CFLAGS+= -I. -I${.CURDIR} +.if defined(BOOTSTRAPPING) +CFLAGS+= -I${.CURDIR}/bootstrap +.endif CFLAGS+= -I${SRCTOP}/lib/libc/locale CFLAGS+= -I${SRCTOP}/lib/libc/stdtime Added: head/usr.bin/localedef/bootstrap/_ctype.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/localedef/bootstrap/_ctype.h Wed Jul 15 12:07:59 2020 (r363218) @@ -0,0 +1,48 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2020 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * We have to ensure that we use the same constants as the target system when + * bootstrapping localedef so that we generate compatible databases. + */ +#ifndef __FreeBSD__ +typedefint
svn commit: r363217 - head/usr.bin/localedef
Author: arichardson Date: Wed Jul 15 12:07:53 2020 New Revision: 363217 URL: https://svnweb.freebsd.org/changeset/base/363217 Log: Add missing newline and return in localedef error message I hit those error messages when using a localedef built against headers that don't match the target system (cross-building from a Linux host). This problem will be fixed in the next commit. Modified: head/usr.bin/localedef/collate.c Modified: head/usr.bin/localedef/collate.c == --- head/usr.bin/localedef/collate.cWed Jul 15 12:07:47 2020 (r363216) +++ head/usr.bin/localedef/collate.cWed Jul 15 12:07:53 2020 (r363217) @@ -850,7 +850,8 @@ void add_order_directive(void) { if (collinfo.directive_count >= COLL_WEIGHTS_MAX) { - fprintf(stderr,"too many directives (max %d)", COLL_WEIGHTS_MAX); + fprintf(stderr, "too many directives (max %d)\n", COLL_WEIGHTS_MAX); + return; } collinfo.directive_count++; } @@ -859,7 +860,7 @@ static void add_order_pri(int32_t ref) { if (curr_weight >= NUM_WT) { - fprintf(stderr,"too many weights (max %d)", NUM_WT); + fprintf(stderr, "too many weights (max %d)\n", NUM_WT); return; } order_weights[curr_weight] = ref; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363219 - head/tools/build
Author: arichardson Date: Wed Jul 15 12:08:06 2020 New Revision: 363219 URL: https://svnweb.freebsd.org/changeset/base/363219 Log: Fix BUILD_WITH_STRICT_TMPPATH builds We need dd in $PATH for some of the MK_BOOT code and some tests also use it. Obtained from:CheriBSD Modified: head/tools/build/Makefile Modified: head/tools/build/Makefile == --- head/tools/build/Makefile Wed Jul 15 12:07:59 2020(r363218) +++ head/tools/build/Makefile Wed Jul 15 12:08:06 2020(r363219) @@ -105,7 +105,7 @@ SYSINCS+= ${SRCTOP}/sys/sys/font.h # basic commands: It is fine to use the host version for all of these even on # Linux/MacOS since we only use flags that are supported by all of them. -_host_tools_to_symlink=basename bzip2 bunzip2 chmod chown cmp comm cp date \ +_host_tools_to_symlink=basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ dirname echo env false find fmt gzip gunzip head hostname id ln ls \ mkdir mv nice patch rm realpath sh sleep stat tee touch tr true uname \ uniq wc which ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363230 - head/usr.bin/xinstall
Author: arichardson Date: Wed Jul 15 17:24:39 2020 New Revision: 363230 URL: https://svnweb.freebsd.org/changeset/base/363230 Log: Allow install(1)'s create_tempfile() to work on Linux hosts GLibc expects six 'X' characters in the mkstemp template argument and will return EINVAL otherwise. Reviewed By: emaste, imp, mjg Differential Revision: https://reviews.freebsd.org/D25662 Modified: head/usr.bin/xinstall/install.1 head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/install.1 == --- head/usr.bin/xinstall/install.1 Wed Jul 15 17:24:34 2020 (r363229) +++ head/usr.bin/xinstall/install.1 Wed Jul 15 17:24:39 2020 (r363230) @@ -301,8 +301,8 @@ This is mainly for use in debugging the .Fx Ports Collection. .Sh FILES -.Bl -tag -width "INS@" -compact -.It Pa INS@ +.Bl -tag -width "INS@XX" -compact +.It Pa INS@XX If either .Fl S option is specified, or the @@ -312,9 +312,9 @@ or option is used in conjunction with the .Fl s option, temporary files named -.Pa INS@ , +.Pa INS@XX , where -.Pa +.Pa XX is decided by .Xr mkstemp 3 , are created in the target directory. Modified: head/usr.bin/xinstall/xinstall.c == --- head/usr.bin/xinstall/xinstall.cWed Jul 15 17:24:34 2020 (r363229) +++ head/usr.bin/xinstall/xinstall.cWed Jul 15 17:24:39 2020 (r363230) @@ -1161,7 +1161,7 @@ create_tempfile(const char *path, char *temp, size_t t p++; else p = temp; - (void)strncpy(p, "INS@", &temp[tsize - 1] - p); + (void)strncpy(p, "INS@XX", &temp[tsize - 1] - p); temp[tsize - 1] = '\0'; return (mkstemp(temp)); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363229 - head/lib/libmd
Author: arichardson Date: Wed Jul 15 17:24:34 2020 New Revision: 363229 URL: https://svnweb.freebsd.org/changeset/base/363229 Log: Remove warning that is no longer accurate after r361853 We now build the skein assembly with clangs integrated assembler. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D25664 Modified: head/lib/libmd/Makefile Modified: head/lib/libmd/Makefile == --- head/lib/libmd/Makefile Wed Jul 15 17:05:37 2020(r363228) +++ head/lib/libmd/Makefile Wed Jul 15 17:24:34 2020(r363229) @@ -121,8 +121,6 @@ CFLAGS+= -DRMD160_ASM ACFLAGS+= -DSKEIN_LOOP=0 SRCS+= skein_block_asm.S CFLAGS+= -DSKEIN_ASM -DSKEIN_USE_ASM=1792 # list of block functions to replace with assembly: 256+512+1024 = 1792 -.else -.warning as not available: not using optimized Skein asm .endif .if exists(${MACHINE_ARCH}/sha.S) || exists(${MACHINE_ARCH}/rmd160.S) || exists(${MACHINE_ARCH}/skein_block_asm.S) ACFLAGS+= -DELF -Wa,--noexecstack ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363471 - in head/sys: amd64/conf arm64/conf i386/conf powerpc/conf riscv/conf
Author: arichardson Date: Fri Jul 24 08:40:04 2020 New Revision: 363471 URL: https://svnweb.freebsd.org/changeset/base/363471 Log: Include TMPFS in all the GENERIC kernel configs Being able to use tmpfs without kernel modules is very useful when building small MFS_ROOT kernels without a real file system. Including TMPFS also matches arm/GENERIC and the MIPS std.MALTA configs. Compiling TMPFS only adds 4 .c files so this should not make much of a difference to NO_MODULES build times (as we do for our minimal RISC-V images). Reviewed By: br (earlier version for riscv), brooks, emaste Differential Revision: https://reviews.freebsd.org/D25317 Modified: head/sys/amd64/conf/GENERIC head/sys/arm64/conf/GENERIC head/sys/i386/conf/GENERIC head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/GENERIC64 head/sys/riscv/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC == --- head/sys/amd64/conf/GENERIC Fri Jul 24 02:19:00 2020(r363470) +++ head/sys/amd64/conf/GENERIC Fri Jul 24 08:40:04 2020(r363471) @@ -51,6 +51,7 @@ options MSDOSFS # MSDOS Filesystem optionsCD9660 # ISO 9660 Filesystem optionsPROCFS # Process filesystem (requires PSEUDOFS) optionsPSEUDOFS# Pseudo-filesystem framework +optionsTMPFS # Efficient memory filesystem optionsGEOM_RAID # Soft RAID functionality. optionsGEOM_LABEL # Provides labelization optionsEFIRT # EFI Runtime Services support Modified: head/sys/arm64/conf/GENERIC == --- head/sys/arm64/conf/GENERIC Fri Jul 24 02:19:00 2020(r363470) +++ head/sys/arm64/conf/GENERIC Fri Jul 24 08:40:04 2020(r363471) @@ -50,6 +50,7 @@ options MSDOSFS # MSDOS Filesystem optionsCD9660 # ISO 9660 Filesystem optionsPROCFS # Process filesystem (requires PSEUDOFS) optionsPSEUDOFS# Pseudo-filesystem framework +optionsTMPFS # Efficient memory filesystem optionsGEOM_RAID # Soft RAID functionality. optionsGEOM_LABEL # Provides labelization optionsCOMPAT_FREEBSD32# Compatible with FreeBSD/arm Modified: head/sys/i386/conf/GENERIC == --- head/sys/i386/conf/GENERIC Fri Jul 24 02:19:00 2020(r363470) +++ head/sys/i386/conf/GENERIC Fri Jul 24 08:40:04 2020(r363471) @@ -50,6 +50,7 @@ options MSDOSFS # MSDOS Filesystem optionsCD9660 # ISO 9660 Filesystem optionsPROCFS # Process filesystem (requires PSEUDOFS) optionsPSEUDOFS# Pseudo-filesystem framework +optionsTMPFS # Efficient memory filesystem optionsGEOM_RAID # Soft RAID functionality. optionsGEOM_LABEL # Provides labelization optionsCOMPAT_FREEBSD4 # Compatible with FreeBSD4 Modified: head/sys/powerpc/conf/GENERIC == --- head/sys/powerpc/conf/GENERIC Fri Jul 24 02:19:00 2020 (r363470) +++ head/sys/powerpc/conf/GENERIC Fri Jul 24 08:40:04 2020 (r363471) @@ -57,6 +57,7 @@ options MSDOSFS #MSDOS Filesystem optionsCD9660 #ISO 9660 Filesystem optionsPROCFS #Process filesystem (requires PSEUDOFS) optionsPSEUDOFS#Pseudo-filesystem framework +optionsTMPFS #Efficient memory filesystem optionsGEOM_PART_APM #Apple Partition Maps. optionsGEOM_PART_GPT #GUID Partition Tables. optionsGEOM_LABEL #Provides labelization Modified: head/sys/powerpc/conf/GENERIC64 == --- head/sys/powerpc/conf/GENERIC64 Fri Jul 24 02:19:00 2020 (r363470) +++ head/sys/powerpc/conf/GENERIC64 Fri Jul 24 08:40:04 2020 (r363471) @@ -62,6 +62,7 @@ options MSDOSFS #MSDOS Filesystem optionsCD9660 #ISO 9660 Filesystem optionsPROCFS #Process filesystem (requires PSEUDOFS) optionsPSEUDOFS#Pseudo-filesystem framework +optionsTMPFS #Efficient memory filesystem optionsGEOM_PART_APM #Apple Partition Maps. optionsGEOM_PART_GPT #GUID Partition Tables. optionsGEOM_LABEL #Provides labelizat
svn commit: r363730 - head/sys/mips/conf
Author: arichardson Date: Fri Jul 31 11:28:09 2020 New Revision: 363730 URL: https://svnweb.freebsd.org/changeset/base/363730 Log: Include virtio support in std.MALTA The MALTA kernel config is generally used for QEMU and having support for VirtIO there by default is quite useful. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25217 Modified: head/sys/mips/conf/std.MALTA Modified: head/sys/mips/conf/std.MALTA == --- head/sys/mips/conf/std.MALTAFri Jul 31 11:14:11 2020 (r363729) +++ head/sys/mips/conf/std.MALTAFri Jul 31 11:28:09 2020 (r363730) @@ -55,3 +55,10 @@ device miibus device bpf device md device uart + +# VirtIO support +device virtio # Generic VirtIO bus (required) +device virtio_pci # VirtIO PCI Interface +device vtnet # VirtIO Ethernet device +device virtio_blk # VirtIO Block device +device virtio_random # VirtIO Entropy device ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363805 - head/lib/libc/gen
Author: arichardson Date: Mon Aug 3 18:08:04 2020 New Revision: 363805 URL: https://svnweb.freebsd.org/changeset/base/363805 Log: Allow building setmode.c on Linux/macOS We bootstrap this file to allow compiling FreeBSD on Linux systems since some boostrap tools use setmode(). Unfortunately, glibc's sys/stat.h declares a non-static getumask() function (which is unimplemented!) and that conflicts with the local getumask() function. To work around this simply use a different name here. Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D25929 Modified: head/lib/libc/gen/setmode.c Modified: head/lib/libc/gen/setmode.c == --- head/lib/libc/gen/setmode.c Mon Aug 3 17:53:15 2020(r363804) +++ head/lib/libc/gen/setmode.c Mon Aug 3 18:08:04 2020(r363805) @@ -70,7 +70,7 @@ typedef struct bitcmd { #defineCMD2_OBITS 0x08 #defineCMD2_UBITS 0x10 -static mode_t getumask(void); +static mode_t get_current_umask(void); static BITCMD *addcmd(BITCMD *, mode_t, mode_t, mode_t, mode_t); static void compress_mode(BITCMD *); #ifdef SETMODE_DEBUG @@ -186,7 +186,7 @@ setmode(const char *p) * Get a copy of the mask for the permissions that are mask relative. * Flip the bits, we want what's not set. */ - mask = ~getumask(); + mask = ~get_current_umask(); setlen = SET_LEN + 2; @@ -343,13 +343,14 @@ out: } static mode_t -getumask(void) +get_current_umask(void) { sigset_t sigset, sigoset; size_t len; mode_t mask; u_short smask; +#ifdef KERN_PROC_UMASK /* * First try requesting the umask without temporarily modifying it. * Note that this does not work if the sysctl @@ -359,7 +360,7 @@ getumask(void) if (sysctl((int[4]){ CTL_KERN, KERN_PROC, KERN_PROC_UMASK, 0 }, 4, &smask, &len, NULL, 0) == 0) return (smask); - +#endif /* * Since it's possible that the caller is opening files inside a signal * handler, protect them as best we can. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363806 - head/usr.sbin/nmtree
Author: arichardson Date: Mon Aug 3 18:08:10 2020 New Revision: 363806 URL: https://svnweb.freebsd.org/changeset/base/363806 Log: Allow bootstrapping mtree on Linux systems Linux glibc has a dummy lchmod that always fails and emitting a linker warning when used. Don't fail the build due to that warning when bootstrapping by setting LD_FATAL_WARNINGS=no. Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D25930 Modified: head/usr.sbin/nmtree/Makefile Modified: head/usr.sbin/nmtree/Makefile == --- head/usr.sbin/nmtree/Makefile Mon Aug 3 18:08:04 2020 (r363805) +++ head/usr.sbin/nmtree/Makefile Mon Aug 3 18:08:10 2020 (r363806) @@ -22,4 +22,10 @@ MLINKS= mtree.8 nmtree.8 HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +.if defined(BOOTSTRAPPING) +# Linux glibc has a dummy lchmod that always fails. Don't fail due to +# the linker warning that it emits. +LD_FATAL_WARNINGS=no +.endif + .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363991 - head/cddl/contrib/opensolaris/tools/ctf/cvt
Author: arichardson Date: Thu Aug 6 20:44:40 2020 New Revision: 363991 URL: https://svnweb.freebsd.org/changeset/base/363991 Log: ctfmerge: Fix missing pthread_cond_init() This does not appear to matter on FreeBSD or Linux, but when building an amd64 kernel on macOS I was seeing infinite loops in ctfmerge. It turns out the loop in wip_save_work() was looping forever due to pthread_cond_wait() always returning -EINVAL. Reviewed By: markj, brooks Differential Revision: https://reviews.freebsd.org/D25973 Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c == --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Thu Aug 6 20:44:18 2020(r363990) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c Thu Aug 6 20:44:40 2020(r363991) @@ -665,6 +665,7 @@ wq_init(workqueue_t *wq, int nfiles) for (i = 0; i < nslots; i++) { pthread_mutex_init(&wq->wq_wip[i].wip_lock, NULL); + pthread_cond_init(&wq->wq_wip[i].wip_cv, NULL); wq->wq_wip[i].wip_batchid = wq->wq_next_batchid++; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363993 - head/stand
Author: arichardson Date: Thu Aug 6 20:46:18 2020 New Revision: 363993 URL: https://svnweb.freebsd.org/changeset/base/363993 Log: stand: use portable ln -n instead of ln -h This fixes the build on Linux Differential Revision: https://reviews.freebsd.org/D24783 Modified: head/stand/defs.mk Modified: head/stand/defs.mk == --- head/stand/defs.mk Thu Aug 6 20:46:13 2020(r363992) +++ head/stand/defs.mk Thu Aug 6 20:46:18 2020(r363993) @@ -237,6 +237,6 @@ ${_ILINKS}: .NOMETA esac ; \ path=`(cd $$path && /bin/pwd)` ; \ ${ECHO} ${.TARGET} "->" $$path ; \ - ln -fhs $$path ${.TARGET} + ln -fns $$path ${.TARGET} .endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r363992 - head/usr.sbin/pwd_mkdb
Author: arichardson Date: Thu Aug 6 20:46:13 2020 New Revision: 363992 URL: https://svnweb.freebsd.org/changeset/base/363992 Log: Allow bootstrapping pwd_mkdb on Linux/macOS We need to provide a struct passwd that is compatible with the target system and this is not the case when cross-building from macOS/Linux. It should also be a problem when bootstrapping for an i386 target from a FreeBSD amd64 host since time_t does not match across those systems. However, pwd_mkdb always truncates integer values to 32-bit so this difference does not result in different databases. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25931 Added: head/usr.sbin/pwd_mkdb/pwd.h (contents, props changed) Modified: head/usr.sbin/pwd_mkdb/Makefile Modified: head/usr.sbin/pwd_mkdb/Makefile == --- head/usr.sbin/pwd_mkdb/Makefile Thu Aug 6 20:44:40 2020 (r363991) +++ head/usr.sbin/pwd_mkdb/Makefile Thu Aug 6 20:46:13 2020 (r363992) @@ -9,5 +9,8 @@ MAN=pwd_mkdb.8 SRCS= pw_scan.c pwd_mkdb.c CFLAGS+= -I${SRCTOP}/lib/libc/gen # for pw_scan.h +.if defined(BOOTSTRAPPING) +CFLAGS+=-I${.CURDIR} +.endif .include Added: head/usr.sbin/pwd_mkdb/pwd.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pwd_mkdb/pwd.hThu Aug 6 20:46:13 2020 (r363992) @@ -0,0 +1,66 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2020 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * When building pwd_mkdb we need to use target systems definition of + * struct passwd. This protects against future changes to struct passwd and + * is essential to allow cross-building from Linux/macOS hosts since the + * structure is not compatible there. + */ +#include +#include +/* + * Note: pwd_mkdb always stores uint32_t for all integer fields (including + * time_t!) so these definitions do not need to match sys/sys/_types.h + */ +typedefuint32_t_bootstrap_gid_t; +typedefuint32_t_bootstrap_uid_t; +typedefuint64_t_bootstrap_time_t; +#define_GID_T_DECLARED +#define_TIME_T_DECLARED +#define_UID_T_DECLARED +#define_SIZE_T_DECLARED + +#definegid_t _bootstrap_gid_t +#defineuid_t _bootstrap_uid_t +#definetime_t _bootstrap_time_t +#definepasswd _bootstrap_passwd +#include "../../include/pwd.h" +#undef gid_t +#undef uid_t +#undef time_t ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364022 - in head: cddl/contrib/opensolaris/lib/libctf/common cddl/contrib/opensolaris/tools/ctf/cvt sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/sys
Author: arichardson Date: Fri Aug 7 16:03:55 2020 New Revision: 364022 URL: https://svnweb.freebsd.org/changeset/base/364022 Log: Fix cddl tools bootstrapping on macOS and Linux Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25979 Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h head/sys/cddl/compat/opensolaris/sys/stat.h head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c == --- head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 7 16:01:05 2020(r364021) +++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 7 16:03:55 2020(r364022) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include +#include #include #include #include Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h == --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Fri Aug 7 16:01:05 2020(r364021) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Fri Aug 7 16:03:55 2020(r364022) @@ -38,6 +38,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -63,6 +64,15 @@ extern "C" { #ifndef MIN #defineMIN(a, b) ((a) > (b) ? (b) : (a)) +#endif + +/* Sanity check for cross-build bootstrap tools */ +#if !defined(BYTE_ORDER) +#error "Missing BYTE_ORDER defines" +#elif !defined(_LITTLE_ENDIAN) +#error "Missing _LITTLE_ENDIAN defines" +#elif !defined(_BIG_ENDIAN) +#error "Missing _BIG_ENDIAN defines" #endif #defineTRUE1 Modified: head/sys/cddl/compat/opensolaris/sys/stat.h == --- head/sys/cddl/compat/opensolaris/sys/stat.h Fri Aug 7 16:01:05 2020 (r364021) +++ head/sys/cddl/compat/opensolaris/sys/stat.h Fri Aug 7 16:03:55 2020 (r364022) @@ -32,11 +32,19 @@ #include_next +/* + * When bootstrapping on Linux a stat64/fstat64 functions exists in both + * glibc and musl libc. To avoid compilation errors, use those functions instead + * of redefining them to stat/fstat. + * Similarly, macOS provides (deprecated) stat64 functions that we can use + * for now. + */ +#if !defined(__linux__) && !defined(__APPLE__) #definestat64 stat #defineMAXOFFSET_T OFF_MAX -#ifndef _KERNEL +#if !defined(_KERNEL) #include static __inline int @@ -51,6 +59,7 @@ fstat64(int fd, struct stat *sb) } return (ret); } -#endif +#endif /* !defined(_KERNEL) */ +#endif /* !defined(__linux__) && !defined(__APPLE__) */ #endif /* !_COMPAT_OPENSOLARIS_SYS_STAT_H_ */ Modified: head/sys/cddl/compat/opensolaris/sys/time.h == --- head/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 7 16:01:05 2020 (r364021) +++ head/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 7 16:03:55 2020 (r364022) @@ -29,6 +29,7 @@ #ifndef _OPENSOLARIS_SYS_TIME_H_ #define_OPENSOLARIS_SYS_TIME_H_ +#include #include_next #define SEC1 Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h == --- head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.hFri Aug 7 16:01:05 2020(r364021) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.hFri Aug 7 16:03:55 2020(r364022) @@ -46,8 +46,12 @@ extern "C" { /* * Disk blocks (sectors) and bytes. */ +#ifndef dtob #definedtob(DD)((DD) << DEV_BSHIFT) +#endif +#ifndef btod #definebtod(BB)(((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) +#endif #definebtodt(BB) ((BB) >> DEV_BSHIFT) #definelbtod(BB) (((offset_t)(BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) @@ -220,9 +224,12 @@ extern unsigned char bcd_to_byte[256]; /* * Macros for counting and rounding. */ +#ifndef howmany #definehowmany(x, y) (((x)+((y)-1))/(y)) +#endif +#ifndef roundup #defineroundup(x, y) x)+((y)-1))/(y))*(y)) - +#endif /* * Macro to determine if value is a power of 2 */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364026 - head
Author: arichardson Date: Fri Aug 7 16:04:15 2020 New Revision: 364026 URL: https://svnweb.freebsd.org/changeset/base/364026 Log: Fix duplicate assignment of _localedef in Makefile.inc1 The same .if exists a few lines below. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Fri Aug 7 16:04:10 2020(r364025) +++ head/Makefile.inc1 Fri Aug 7 16:04:15 2020(r364026) @@ -2179,9 +2179,6 @@ _yacc=usr.bin/yacc _gensnmptree= usr.sbin/bsnmpd/gensnmptree .endif -.if ${MK_LOCALES} != "no" -_localedef=usr.bin/localedef -.endif # We need to build tblgen when we're building clang or lld, either as # bootstrap tools, or as the part of the normal build. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364025 - head/usr.sbin/tzsetup
Author: arichardson Date: Fri Aug 7 16:04:10 2020 New Revision: 364025 URL: https://svnweb.freebsd.org/changeset/base/364025 Log: Don't link against libdialog/ncurses when bootstrapping tzsetup Modified: head/usr.sbin/tzsetup/Makefile Modified: head/usr.sbin/tzsetup/Makefile == --- head/usr.sbin/tzsetup/Makefile Fri Aug 7 16:04:06 2020 (r364024) +++ head/usr.sbin/tzsetup/Makefile Fri Aug 7 16:04:10 2020 (r364025) @@ -7,7 +7,7 @@ MAN=tzsetup.8 CFLAGS+= -I. -.if ${MK_DIALOG} != no +.if ${MK_DIALOG} != no && !defined(BOOTSTRAPPING) WARNS?=3 CFLAGS+= -I${SRCTOP}/contrib/dialog -DHAVE_DIALOG LIBADD=dialog ncursesw ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364023 - head/usr.bin/grep
Author: arichardson Date: Fri Aug 7 16:04:01 2020 New Revision: 364023 URL: https://svnweb.freebsd.org/changeset/base/364023 Log: Always install usr.bin/grep as grep when bootstrapping We have to bootstrap grep when cross-building from macOS/Linux. Modified: head/usr.bin/grep/Makefile Modified: head/usr.bin/grep/Makefile == --- head/usr.bin/grep/Makefile Fri Aug 7 16:03:55 2020(r364022) +++ head/usr.bin/grep/Makefile Fri Aug 7 16:04:01 2020(r364023) @@ -4,7 +4,7 @@ .include -.if ${MK_BSD_GREP} == "yes" +.if ${MK_BSD_GREP} == "yes" || defined(BOOTSTRAPPING) PROG= grep MAN1= grep.1 zgrep.1 .else @@ -50,7 +50,7 @@ MLINKS= zgrep.1 zfgrep.1 \ CFLAGS.gcc+= --param max-inline-insns-single=500 -.if ${MK_BSD_GREP} == "yes" +.if ${MK_BSD_GREP} == "yes" || defined(BOOTSTRAPPING) LINKS+=${BINDIR}/grep ${BINDIR}/egrep \ ${BINDIR}/grep ${BINDIR}/fgrep \ ${BINDIR}/grep ${BINDIR}/rgrep \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364024 - head/usr.sbin/makefs/msdos
Author: arichardson Date: Fri Aug 7 16:04:06 2020 New Revision: 364024 URL: https://svnweb.freebsd.org/changeset/base/364024 Log: makefs: Drop unnecessary sys/clock.h include This breaks the build on macOS where this header doesn't exist. I could also add a compat header to tools/build/cross-build but since it's not needed removing it seems like the better solution. Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c == --- head/usr.sbin/makefs/msdos/msdosfs_vnops.c Fri Aug 7 16:04:01 2020 (r364023) +++ head/usr.sbin/makefs/msdos/msdosfs_vnops.c Fri Aug 7 16:04:06 2020 (r364024) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364027 - in head/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs contrib/opensolaris/uts/common/fs/zfs/sys
Author: arichardson Date: Fri Aug 7 16:04:21 2020 New Revision: 364027 URL: https://svnweb.freebsd.org/changeset/base/364027 Log: Fix linker error in libuutil with recent LLVM Not marking the function as static can result in a linker error: undefined reference to __assfail [--no-allow-shlib-undefined] I noticed this error after updating our CHERI LLVM to the latest upstream LLVM HEAD revision. This change effectively reverts r329984 and marks dmu_buf_init_user as static (which keeps the GCC build happy). Reviewed By: #zfs, asomers, freqlabs, mav Differential Revision: https://reviews.freebsd.org/D25663 Modified: head/sys/cddl/compat/opensolaris/sys/assfail.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Modified: head/sys/cddl/compat/opensolaris/sys/assfail.h == --- head/sys/cddl/compat/opensolaris/sys/assfail.h Fri Aug 7 16:04:15 2020(r364026) +++ head/sys/cddl/compat/opensolaris/sys/assfail.h Fri Aug 7 16:04:21 2020(r364027) @@ -48,9 +48,7 @@ void assfail3(const char *, uintmax_t, const char *, u #ifndef HAVE_ASSFAIL extern int aok; -__inline int __assfail(const char *expr, const char *file, int line); - -__inline int +static __inline int __assfail(const char *expr, const char *file, int line) { Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Aug 7 16:04:15 2020(r364026) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Fri Aug 7 16:04:21 2020(r364027) @@ -175,13 +175,6 @@ static int __dbuf_hold_impl(struct dbuf_hold_impl_data static boolean_t dbuf_undirty(dmu_buf_impl_t *db, dmu_tx_t *tx); static void dbuf_write(dbuf_dirty_record_t *dr, arc_buf_t *data, dmu_tx_t *tx); -#ifndef __lint -extern inline void dmu_buf_init_user(dmu_buf_user_t *dbu, -dmu_buf_evict_func_t *evict_func_sync, -dmu_buf_evict_func_t *evict_func_async, -dmu_buf_t **clear_on_evict_dbufp); -#endif /* ! __lint */ - /* * Global data structures and functions for the dbuf cache. */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h == --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Aug 7 16:04:15 2020(r364026) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h Fri Aug 7 16:04:21 2020(r364027) @@ -610,7 +610,7 @@ typedef struct dmu_buf_user { * To allow enforcement of this, dbu must already be zeroed on entry. */ /*ARGSUSED*/ -inline void +static inline void dmu_buf_init_user(dmu_buf_user_t *dbu, dmu_buf_evict_func_t *evict_func_sync, dmu_buf_evict_func_t *evict_func_async, dmu_buf_t **clear_on_evict_dbufp) { ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364049 - in head: usr.bin/chpass usr.sbin/pwd_mkdb usr.sbin/pwd_mkdb/bootstrap
Author: arichardson Date: Sat Aug 8 10:05:27 2020 New Revision: 364049 URL: https://svnweb.freebsd.org/changeset/base/364049 Log: Fix i386 build of chpass after r363992 My change to allow bootstrapping pwd_mkdb (r363992) resulted in i386 build failures because the bootstrap header was being included in non-bootstrap chpass. Dropping the no longer required pwd_mkdb include path from chpass fixes the build, but to be certain that the failure doesn't get re-introduced, I've also moved the bootstrap pwd.h into a subdirectory so that adding -I${SRCTOP}/usr.sbin/pwd_mkdb doesn't pull it in. Reported by: mjg Added: head/usr.sbin/pwd_mkdb/bootstrap/ head/usr.sbin/pwd_mkdb/bootstrap/pwd.h (contents, props changed) - copied, changed from r364046, head/usr.sbin/pwd_mkdb/pwd.h Deleted: head/usr.sbin/pwd_mkdb/pwd.h Modified: head/usr.bin/chpass/Makefile head/usr.sbin/pwd_mkdb/Makefile Modified: head/usr.bin/chpass/Makefile == --- head/usr.bin/chpass/MakefileFri Aug 7 23:32:42 2020 (r364048) +++ head/usr.bin/chpass/MakefileSat Aug 8 10:05:27 2020 (r364049) @@ -3,7 +3,7 @@ .include -.PATH: ${SRCTOP}/usr.sbin/pwd_mkdb ${SRCTOP}/lib/libc/gen +.PATH: ${SRCTOP}/lib/libc/gen PROG= chpass SRCS= chpass.c edit.c field.c pw_scan.c table.c util.c @@ -15,7 +15,7 @@ CFLAGS+= -DYP .endif #Some people need this, uncomment to activate #CFLAGS+=-DRESTRICT_FULLNAME_CHANGE -CFLAGS+=-I${SRCTOP}/usr.sbin/pwd_mkdb -I${SRCTOP}/lib/libc/gen -I. +CFLAGS+=-I${SRCTOP}/lib/libc/gen -I. LIBADD=crypt util .if ${MK_NIS} != "no" Modified: head/usr.sbin/pwd_mkdb/Makefile == --- head/usr.sbin/pwd_mkdb/Makefile Fri Aug 7 23:32:42 2020 (r364048) +++ head/usr.sbin/pwd_mkdb/Makefile Sat Aug 8 10:05:27 2020 (r364049) @@ -10,7 +10,7 @@ SRCS= pw_scan.c pwd_mkdb.c CFLAGS+= -I${SRCTOP}/lib/libc/gen # for pw_scan.h .if defined(BOOTSTRAPPING) -CFLAGS+=-I${.CURDIR} +CFLAGS+=-I${.CURDIR}/bootstrap .endif .include Copied and modified: head/usr.sbin/pwd_mkdb/bootstrap/pwd.h (from r364046, head/usr.sbin/pwd_mkdb/pwd.h) == ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364120 - head/tools/build
Author: arichardson Date: Tue Aug 11 16:46:33 2020 New Revision: 364120 URL: https://svnweb.freebsd.org/changeset/base/364120 Log: Fix bootstrapping ldd after r362152 r362152 started using DF_1_PIE, which is not present in older versions of sys/elf_common.h. To fix this include the ELF headers as part of -legacy. Modified: head/tools/build/Makefile Modified: head/tools/build/Makefile == --- head/tools/build/Makefile Tue Aug 11 16:46:27 2020(r364119) +++ head/tools/build/Makefile Tue Aug 11 16:46:33 2020(r364120) @@ -92,6 +92,12 @@ DISKINCS+= ${SRCTOP}/sys/sys/disk/bsd.h SYSINCS+= ${SRCTOP}/sys/sys/nv.h ${SRCTOP}/sys/sys/cnv.h \ ${SRCTOP}/sys/sys/dnv.h +# Needed when bootstrapping ldd (since it uses DF_1_PIE) +SYSINCS+= ${SRCTOP}/sys/sys/elf32.h +SYSINCS+= ${SRCTOP}/sys/sys/elf64.h +SYSINCS+= ${SRCTOP}/sys/sys/elf_common.h +SYSINCS+= ${SRCTOP}/sys/sys/elf_generic.h + # vtfontcvt is using sys/font.h SYSINCS+= ${SRCTOP}/sys/sys/font.h ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364119 - in head: . share/mk stand/i386/loader sys/modules/linux sys/modules/linux64
Author: arichardson Date: Tue Aug 11 16:46:27 2020 New Revision: 364119 URL: https://svnweb.freebsd.org/changeset/base/364119 Log: Allow overriding the tool used for stripping binaries Since the make variable STRIP is already used for other purposes, this uses STRIPBIN (which is also used for the same purpose by install(1). This allows using LLVM objcopy to strip binaries instead of the in-tree elftoolchain objcopy. We make use of this in CheriBSD since passing binaries generated by our toolchain to elftoolchain strip sometimes results in assertion failures. This allows working around https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248516 by specifying STRIPBIN=/path/to/llvm-strip Obtained from:CheriBSD Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D25988 Modified: head/Makefile.inc1 head/share/mk/sys.mk head/stand/i386/loader/Makefile head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Aug 11 16:40:09 2020(r364118) +++ head/Makefile.inc1 Tue Aug 11 16:46:27 2020(r364119) @@ -180,7 +180,7 @@ MK_SYSTEM_LINKER= no .if defined(CROSS_TOOLCHAIN_PREFIX) CROSS_BINUTILS_PREFIX?=${CROSS_TOOLCHAIN_PREFIX} .endif -XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS +XBINUTILS= AS AR LD NM OBJCOPY RANLIB SIZE STRINGS STRIPBIN .for BINUTIL in ${XBINUTILS} .if defined(CROSS_BINUTILS_PREFIX) && \ exists(${CROSS_BINUTILS_PREFIX}/${${BINUTIL}}) @@ -755,7 +755,7 @@ CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXF AS="${XAS}" AR="${XAR}" LD="${XLD}" LLVM_LINK="${XLLVM_LINK}" \ NM=${XNM} OBJCOPY="${XOBJCOPY}" \ RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ - SIZE="${XSIZE}" + SIZE="${XSIZE}" STRIPBIN="${XSTRIPBIN}" .if defined(CROSS_BINUTILS_PREFIX) && exists(${CROSS_BINUTILS_PREFIX}) # In the case of xdev-build tools, CROSS_BINUTILS_PREFIX won't be a Modified: head/share/mk/sys.mk == --- head/share/mk/sys.mkTue Aug 11 16:40:09 2020(r364118) +++ head/share/mk/sys.mkTue Aug 11 16:46:27 2020(r364119) @@ -275,6 +275,7 @@ SHELL ?= sh .if !defined(%POSIX) SIZE ?= size +STRIPBIN ?= strip .endif YACC ?= yacc Modified: head/stand/i386/loader/Makefile == --- head/stand/i386/loader/Makefile Tue Aug 11 16:40:09 2020 (r364118) +++ head/stand/i386/loader/Makefile Tue Aug 11 16:46:27 2020 (r364119) @@ -64,7 +64,7 @@ ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} -b ${BTXKERN} ${LOADER}.bin ${LOADER}.bin: ${LOADER}.sym - strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC} + ${STRIPBIN} -R .comment -R .note -o ${.TARGET} ${.ALLSRC} .if ${MK_LOADER_ZFS} == "yes" && ${LOADER_INTERP} == ${LOADER_DEFAULT_INTERP} LINKS+=${BINDIR}/${LOADER} ${BINDIR}/zfsloader Modified: head/sys/modules/linux/Makefile == --- head/sys/modules/linux/Makefile Tue Aug 11 16:40:09 2020 (r364118) +++ head/sys/modules/linux/Makefile Tue Aug 11 16:46:27 2020 (r364119) @@ -69,12 +69,12 @@ linux${SFX}_support.o: linux${SFX}_assym.h assym.inc ${VDSO}.so: linux${SFX}_locore.o ${OBJCOPY} --input-target binary --output-target elf64-x86-64-freebsd \ --binary-architecture i386 linux${SFX}_locore.o ${.TARGET} - strip -N _binary_linux${SFX}_locore_o_size ${.TARGET} + ${STRIPBIN} -N _binary_linux${SFX}_locore_o_size ${.TARGET} .else ${VDSO}.so: linux${SFX}_locore.o ${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd \ --binary-architecture i386 linux${SFX}_locore.o ${.TARGET} - strip -N _binary_linux_locore_o_size ${.TARGET} + ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET} .endif linux${SFX}_genassym.o: offset.inc Modified: head/sys/modules/linux64/Makefile == --- head/sys/modules/linux64/Makefile Tue Aug 11 16:40:09 2020 (r364118) +++ head/sys/modules/linux64/Makefile Tue Aug 11 16:46:27 2020 (r364119) @@ -46,7 +46,7 @@ OBJCOPY_TARGET=--output-target elf64-x86-64 --binary-a ${VDSO}.so: linux_locore.o ${OBJCOPY} --input-target binary ${OBJCOPY_TARGET} -S -g \ linux_locore.o ${.TARGET} - strip -N _binary_linux_locore_o_size ${.TARGET} + ${STRIPBIN} -N _binary_linux_locore_o_size ${.TARGET} linux_support.o: assym.inc linux_assym.h ${CC} -c -x
svn commit: r364121 - head/usr.sbin/pwd_mkdb/bootstrap
Author: arichardson Date: Tue Aug 11 16:46:38 2020 New Revision: 364121 URL: https://svnweb.freebsd.org/changeset/base/364121 Log: Fix bootstrapping of pwd_mkdb after r364049 I moved the bootstrap pwd.h to a subdirectory in r364049 but forgot to adjust the #include path. Modified: head/usr.sbin/pwd_mkdb/bootstrap/pwd.h Modified: head/usr.sbin/pwd_mkdb/bootstrap/pwd.h == --- head/usr.sbin/pwd_mkdb/bootstrap/pwd.h Tue Aug 11 16:46:33 2020 (r364120) +++ head/usr.sbin/pwd_mkdb/bootstrap/pwd.h Tue Aug 11 16:46:38 2020 (r364121) @@ -60,7 +60,7 @@ typedef uint64_t_bootstrap_time_t; #defineuid_t _bootstrap_uid_t #definetime_t _bootstrap_time_t #definepasswd _bootstrap_passwd -#include "../../include/pwd.h" +#include "../../../include/pwd.h" #undef gid_t #undef uid_t #undef time_t ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364122 - head/share/mk
Author: arichardson Date: Tue Aug 11 16:46:43 2020 New Revision: 364122 URL: https://svnweb.freebsd.org/changeset/base/364122 Log: Add CLANG/LLD/LLD to BROKEN_OPTIONS when building on non-FreeBSD These tools require a bootstrap llvm-tblgen/clang-tblgen and that cannot be built with the current make infrastructure: the config header is not correct for Linux/macOS and we don't include the CMakeLists.txt in contrib so we can't generate one that would be correct. Reviewed By: emaste, imp, dim Differential Revision: https://reviews.freebsd.org/D14245 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk == --- head/share/mk/src.opts.mk Tue Aug 11 16:46:38 2020(r364121) +++ head/share/mk/src.opts.mk Tue Aug 11 16:46:43 2020(r364122) @@ -365,6 +365,14 @@ __DEFAULT_YES_OPTIONS+=OPENMP __DEFAULT_NO_OPTIONS+=OPENMP .endif +.if ${.MAKE.OS} != "FreeBSD" +# Building the target compiler requires building tablegen on the host +# which is (currently) not possible on non-FreeBSD. +BROKEN_OPTIONS+=CLANG LLD LLDB +# The same also applies to the bootstrap LLVM. +BROKEN_OPTIONS+=CLANG_BOOTSTRAP LLD_BOOTSTRAP +.endif + .include # ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364123 - in head: . cddl/contrib/opensolaris/lib/libdtrace/common
Author: arichardson Date: Tue Aug 11 16:46:48 2020 New Revision: 364123 URL: https://svnweb.freebsd.org/changeset/base/364123 Log: Fix -DBUILD_WITH_STRICT_TMPPATH dtrace builds Some of the scripts used for libdtrace invoke nawk instead of awk (for example cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh). When bootstrapping all tools, we get the nawk -> awk link while building usr.bin/awk, but when linking/copying the dependencies from the host we were only adding awk but not nawk. This was silently generating invalid files when building libdtrace with BUILD_WITH_STRICT_TMPPATH=1 since those scripts invoke nawk instead of awk. In addition to adding the missing link this commit also adds set -e to those scripts to catch errors like this in the future. Reviewed By: markj, emaste Differential Revision: https://reviews.freebsd.org/D26025 Modified: head/Makefile.inc1 head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Aug 11 16:46:43 2020(r364122) +++ head/Makefile.inc1 Tue Aug 11 16:46:48 2020(r364123) @@ -2240,9 +2240,13 @@ ${_bt}-usr.bin/mandoc: ${_bt}-lib/libopenbsd _basic_bootstrap_tools_multilink=usr.bin/grep grep,egrep,fgrep _basic_bootstrap_tools_multilink+=bin/test test,[ # bootstrap tools needed by buildworld: -_basic_bootstrap_tools=usr.bin/awk usr.bin/cut bin/expr usr.bin/gencat \ +_basic_bootstrap_tools=usr.bin/cut bin/expr usr.bin/gencat \ usr.bin/join usr.bin/mktemp bin/rmdir usr.bin/sed usr.bin/sort \ usr.bin/truncate usr.bin/tsort +# Some build scripts use nawk instead of awk (this happens at least in +# cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh) so we need both awk +# and nawk in ${WORLDTMP}/legacy/bin. +_basic_bootstrap_tools_multilink+=usr.bin/awk awk,nawk # file2c is required for building usr.sbin/config: _basic_bootstrap_tools+=usr.bin/file2c # uuencode/uudecode required for share/tabset Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:43 2020(r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:48 2020(r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e echo "\ /*\n\ Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:43 2020(r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:48 2020(r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e BSDECHO=-e Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:43 2020(r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:48 2020(r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e BSDECHO=-e Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:43 2020(r364122) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:48 2020(r364123) @@ -25,6 +25,7 @@ # Use is subject to license terms. # #ident "%Z%%M% %I% %E% SMI" +set -e echo "\ /*\n\ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364124 - head/cddl/contrib/opensolaris/lib/libdtrace/common
Author: arichardson Date: Tue Aug 11 16:46:54 2020 New Revision: 364124 URL: https://svnweb.freebsd.org/changeset/base/364124 Log: Fix libdtrace build with zsh as /bin/sh When zsh runs in POSIX sh mode it does not support the -e flag to echo. Use printf instead of echo to avoid the "-e" characters being printed. Obtained from:CheriBSD Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D26026 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:48 2020(r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrno.sh Tue Aug 11 16:46:54 2020(r364124) @@ -24,16 +24,15 @@ # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" set -e -echo "\ -/*\n\ - * Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ - * Use is subject to license terms.\n\ - */\n\ -\n\ -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n" +printf "%s" " +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +" pattern='^#define[ ]\(E[A-Z0-9]*\)[]*\([A-Z0-9]*\).*$' replace='inline int \1 = \2;@#pragma D binding "1.0" \1' Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:48 2020(r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mkerrtags.sh Tue Aug 11 16:46:54 2020(r364124) @@ -24,37 +24,34 @@ # Copyright 2003 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" set -e -BSDECHO=-e +printf "%s" " +/* + * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ -echo ${BSDECHO} "\ -/*\n\ - * Copyright 2003 Sun Microsystems, Inc. All rights reserved.\n\ - * Use is subject to license terms.\n\ - */\n\ -\n\ -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\ -\n\ #include -\n\ -static const char *const _dt_errtags[] = {" +static const char *const _dt_errtags[] = { +" + pattern='^ \(D_[A-Z0-9_]*\),*' replace=' "\1",' sed -n "s/$pattern/$replace/p" || exit 1 -echo ${BSDECHO} "\ -};\n\ -\n\ -static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]);\n\ -\n\ +printf "%s" " +}; + +static const int _dt_ntag = sizeof (_dt_errtags) / sizeof (_dt_errtags[0]); + const char * dt_errtag(dt_errtag_t tag) { return (_dt_errtags[(tag > 0 && tag < _dt_ntag) ? tag : 0]); -}" +} +" exit 0 Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:48 2020(r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh Tue Aug 11 16:46:54 2020(r364124) @@ -24,33 +24,30 @@ # Copyright 2005 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" set -e -BSDECHO=-e +printf "%s" " +/* + * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ -echo ${BSDECHO} "\ -/*\n\ - * Copyright 2005 Sun Microsystems, Inc. All rights reserved.\n\ - * Use is subject to license terms.\n\ - */\n\ -\n\ -#pragma ident\t\"%Z%%M%\t%I%\t%E% SMI\"\n\ -\n\ -#include \n\ -\n\ +#include + /*ARGSUSED*/ -const char *\n\ -dtrace_subrstr(dtrace_hdl_t *dtp, int subr)\n\ -{\n\ - switch (subr) {" +const char * +dtrace_subrstr(dtrace_hdl_t *dtp, int subr) +{ + switch (subr) { +" nawk ' /^#define[ ]*DIF_SUBR_/ && $2 != "DIF_SUBR_MAX" { printf("\tcase %s: return (\"%s\");\n", $2, tolower(substr($2, 10))); }' -echo ${BSDECHO} "\ - default: return (\"unknown\");\n\ - }\n\ -}" +printf "%s" " + default: return (\"unknown\"); + } +} +" Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh == --- head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:48 2020(r364123) +++ head/cddl/contrib/opensolaris/lib/libdtrace/common/mksignal.sh Tue Aug 11 16:46:54 2020(r364124) @@ -24,16 +24,15 @@ # Copyright 2003 Sun Microsystems,
svn commit: r364125 - in head: share/mk sys/conf
Author: arichardson Date: Tue Aug 11 16:47:00 2020 New Revision: 364125 URL: https://svnweb.freebsd.org/changeset/base/364125 Log: Allow linking the kernel with a linker that doesn't support -z ifunc-noplt This can happen when linking with upstream LLD < 9.0. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D25985 Modified: head/share/mk/bsd.linker.mk head/sys/conf/kern.pre.mk Modified: head/share/mk/bsd.linker.mk == --- head/share/mk/bsd.linker.mk Tue Aug 11 16:46:54 2020(r364124) +++ head/share/mk/bsd.linker.mk Tue Aug 11 16:47:00 2020(r364125) @@ -94,6 +94,9 @@ ${X_}LINKER_FEATURES+=riscv-relaxations .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 6 ${X_}LINKER_FEATURES+= retpoline .endif +.if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 9 +${X_}LINKER_FEATURES+= ifunc-noplt +.endif .endif .else # Use LD's values Modified: head/sys/conf/kern.pre.mk == --- head/sys/conf/kern.pre.mk Tue Aug 11 16:46:54 2020(r364124) +++ head/sys/conf/kern.pre.mk Tue Aug 11 16:47:00 2020(r364125) @@ -166,9 +166,13 @@ LDFLAGS+= -z max-page-size=2097152 .if ${LINKER_TYPE} != "lld" LDFLAGS+= -z common-page-size=4096 .else +.if defined(LINKER_FEATURES) && !${LINKER_FEATURES:Mifunc-noplt} +.warning "Linker ${LD} does not support -z ifunc-noplt -> ifunc calls are unoptimized." +.else LDFLAGS+= -z notext -z ifunc-noplt .endif .endif +.endif # ${MACHINE_CPUARCH} == "amd64" .if ${MACHINE_CPUARCH} == "riscv" # Hack: Work around undefined weak symbols being out of range when linking with ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364166 - head/usr.sbin/crunch/crunchgen
Author: arichardson Date: Wed Aug 12 15:49:06 2020 New Revision: 364166 URL: https://svnweb.freebsd.org/changeset/base/364166 Log: Fix crunchgen usage of mkstemp() On Glibc systems mkstemp can only be used once with the same template string since it will be modified in-place and no longer contain any 'X' chars. It is fine to reuse the same file here but we need to be explicit and use open() instead of mkstemp() on the second use. While touching this file also avoid a hardcoded /bin/pwd since that may not work when building on non-FreeBSD systems. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25990 Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c == --- head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 14:45:31 2020 (r364165) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 15:49:06 2020 (r364166) @@ -39,10 +39,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include #include +#include #include #define CRUNCH_VERSION "0.2" @@ -91,6 +94,7 @@ prog_t *progs = NULL; char confname[MAXPATHLEN], infilename[MAXPATHLEN]; char outmkname[MAXPATHLEN], outcfname[MAXPATHLEN], execfname[MAXPATHLEN]; char tempfname[MAXPATHLEN], cachename[MAXPATHLEN], curfilename[MAXPATHLEN]; +bool tempfname_initialized = false; char outhdrname[MAXPATHLEN] ; /* user-supplied header for *.mk */ char *objprefix; /* where are the objects ? */ char *path_make; @@ -216,6 +220,7 @@ main(int argc, char **argv) snprintf(cachename, sizeof(cachename), "%s.cache", confname); snprintf(tempfname, sizeof(tempfname), "%s/crunchgen_%sXX", getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, confname); + tempfname_initialized = false; parse_conf_file(); if (list_mode) @@ -648,8 +653,7 @@ fillin_program(prog_t *p) /* Determine the actual srcdir (maybe symlinked). */ if (p->srcdir) { - snprintf(line, MAXLINELEN, "cd %s && echo -n `/bin/pwd`", - p->srcdir); + snprintf(line, MAXLINELEN, "cd %s && pwd", p->srcdir); f = popen(line,"r"); if (!f) errx(1, "Can't execute: %s\n", line); @@ -721,14 +725,26 @@ fillin_program_objs(prog_t *p, char *path) /* discover the objs from the srcdir Makefile */ - if ((fd = mkstemp(tempfname)) == -1) { - perror(tempfname); - exit(1); + /* +* We reuse the same temporary file name for multiple objects. However, +* some libc implementations (such as glibc) return EINVAL if there +* are no X characters in the template. This happens after the +* first call to mkstemp since the argument is modified in-place. +* To avoid this error we use open() instead of mkstemp() after the +* call to mkstemp(). +*/ + if (tempfname_initialized) { + if ((fd = open(tempfname, O_CREAT | O_EXCL | O_RDWR, 0600)) == -1) { + err(EX_OSERR, "open(%s)", tempfname); + } + } else if ((fd = mkstemp(tempfname)) == -1) { + err(EX_OSERR, "mkstemp(%s)", tempfname); } + tempfname_initialized = true; if ((f = fdopen(fd, "w")) == NULL) { - warn("%s", tempfname); + warn("fdopen(%s)", tempfname); goterror = 1; - return; + goto out; } if (p->objvar) objvar = p->objvar; @@ -763,14 +779,14 @@ fillin_program_objs(prog_t *p, char *path) if ((f = popen(line, "r")) == NULL) { warn("submake pipe"); goterror = 1; - return; + goto out; } while(fgets(line, MAXLINELEN, f)) { if (strncmp(line, "OBJS= ", 6)) { warnx("make error: %s", line); goterror = 1; - continue; + goto out; } cp = line + 6; @@ -793,7 +809,7 @@ fillin_program_objs(prog_t *p, char *path) warnx("make error: make returned %d", rc); goterror = 1; } - +out: unlink(tempfname); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364167 - head/stand/common
Author: arichardson Date: Wed Aug 12 15:49:10 2020 New Revision: 364167 URL: https://svnweb.freebsd.org/changeset/base/364167 Log: Fix stand/newvers.sh with zsh in sh mode When building on macOS with sh==zsh, newvers.sh was producing an unterminated string literal due to \\n being turned as a newline. Fix this by using a here document instead. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D26036 Modified: head/stand/common/newvers.sh Modified: head/stand/common/newvers.sh == --- head/stand/common/newvers.shWed Aug 12 15:49:06 2020 (r364166) +++ head/stand/common/newvers.shWed Aug 12 15:49:10 2020 (r364167) @@ -55,6 +55,8 @@ if [ -n "${include_metadata}" ]; then bootprog_info="$bootprog_info(${t} ${u}@${h})\\n" fi -echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile -echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile +cat > $tempfile
svn commit: r364174 - head/usr.sbin/crunch/crunchgen
Author: arichardson Date: Wed Aug 12 17:27:24 2020 New Revision: 364174 URL: https://svnweb.freebsd.org/changeset/base/364174 Log: Use env pwd instead of pwd in crunchgen.c In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that may not correctly return a real path. To ensure that all symlinks are resolved use `env pwd -P` instead (the -P flag is part of POSIX so should be supported everywhere). Reported By: rgrimes Suggested By: jrtc27 Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c == --- head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 17:16:26 2020 (r364173) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Wed Aug 12 17:27:24 2020 (r364174) @@ -653,7 +653,7 @@ fillin_program(prog_t *p) /* Determine the actual srcdir (maybe symlinked). */ if (p->srcdir) { - snprintf(line, MAXLINELEN, "cd %s && pwd", p->srcdir); + snprintf(line, MAXLINELEN, "cd %s && env pwd -P", p->srcdir); f = popen(line,"r"); if (!f) errx(1, "Can't execute: %s\n", line); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364190 - head/tools/build
Author: arichardson Date: Thu Aug 13 14:14:46 2020 New Revision: 364190 URL: https://svnweb.freebsd.org/changeset/base/364190 Log: Add pwd to the list of tools that are linked to $WORLDTMP/legacy After r364166 and r364174, crunchgen needs a pwd binary in $PATH instead of using a hardcoded absolute path. This commit is needed for BUILD_WITH_STRICT_TMPPATH builds (currently not on by default). Modified: head/tools/build/Makefile Modified: head/tools/build/Makefile == --- head/tools/build/Makefile Thu Aug 13 13:59:31 2020(r364189) +++ head/tools/build/Makefile Thu Aug 13 14:14:46 2020(r364190) @@ -113,8 +113,8 @@ SYSINCS+= ${SRCTOP}/sys/sys/font.h # Linux/MacOS since we only use flags that are supported by all of them. _host_tools_to_symlink=basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ dirname echo env false find fmt gzip gunzip head hostname id ln ls \ - mkdir mv nice patch rm realpath sh sleep stat tee touch tr true uname \ - uniq wc which + mkdir mv nice patch pwd rm realpath sh sleep stat tee touch tr true \ + uname uniq wc which # We also need a symlink to the absolute path to the make binary used for # the toplevel makefile. This is not necessarily the same as `which make` ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364191 - head/share/mk
Author: arichardson Date: Thu Aug 13 14:14:51 2020 New Revision: 364191 URL: https://svnweb.freebsd.org/changeset/base/364191 Log: Make bsd.linker.mk work with the MacOS linker This is not strictly required for crossbuilding but having lots of warnings from bsd.linker.mk in the output was making it hard to see the actual warning messages. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D14318 Modified: head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.linker.mk == --- head/share/mk/bsd.linker.mk Thu Aug 13 14:14:46 2020(r364190) +++ head/share/mk/bsd.linker.mk Thu Aug 13 14:14:51 2020(r364191) @@ -58,7 +58,7 @@ ${var}= ${${var}__${${X_}_ld_hash}} .if ${ld} == "LD" || (${ld} == "XLD" && ${XLD} != ${LD}) .if !defined(${X_}LINKER_TYPE) || !defined(${X_}LINKER_VERSION) -_ld_version!= (${${ld}} --version || echo none) | sed -n 1p +_ld_version!= (${${ld}} -v 2>&1 || echo none) | sed -n 1p .if ${_ld_version} == "none" .warning Unable to determine linker type from ${ld}=${${ld}} .endif @@ -73,6 +73,17 @@ _v= ${_ld_version:[2]} ${X_}LINKER_FREEBSD_VERSION:= ${_ld_version:[4]:C/.*-([^-]*)\)/\1/} .else ${X_}LINKER_FREEBSD_VERSION= 0 +.endif +.elif ${_ld_version:[1]} == "@(\#)PROGRAM:ld" +# bootstrap linker on MacOS +${X_}LINKER_TYPE=mac +_v=${_ld_version:[2]:S/PROJECT:ld64-//} +# Convert version 409.12 to 409.12.0 so that the echo + awk below works +.if empty(_v:M[1-9]*.[0-9]*.[0-9]*) && !empty(_v:M[1-9]*.[0-9]*) +_v:=${_v}.0 +.else +# Some versions do not contain a minor version so we need to append .0.0 there +_v:=${_v}.0.0 .endif .else .warning Unknown linker from ${ld}=${${ld}}: ${_ld_version}, defaulting to bfd ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364234 - in head: tools/build usr.sbin/crunch/crunchgen
Author: arichardson Date: Fri Aug 14 09:45:41 2020 New Revision: 364234 URL: https://svnweb.freebsd.org/changeset/base/364234 Log: crunchgen: use pwd -P without env The -P flag is required by POSIX so we don't have to care whether pwd is a shell builtin or not. This also allows removing pwd from the list of bootstrap tools since all shells we care about for building have a builtin pwd command. This effectively reverts r364190. Suggested By: rgrimes, jrtc27 Modified: head/tools/build/Makefile head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/tools/build/Makefile == --- head/tools/build/Makefile Fri Aug 14 08:49:40 2020(r364233) +++ head/tools/build/Makefile Fri Aug 14 09:45:41 2020(r364234) @@ -113,7 +113,7 @@ SYSINCS+= ${SRCTOP}/sys/sys/font.h # Linux/MacOS since we only use flags that are supported by all of them. _host_tools_to_symlink=basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ dirname echo env false find fmt gzip gunzip head hostname id ln ls \ - mkdir mv nice patch pwd rm realpath sh sleep stat tee touch tr true \ + mkdir mv nice patch rm realpath sh sleep stat tee touch tr true \ uname uniq wc which # We also need a symlink to the absolute path to the make binary used for Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c == --- head/usr.sbin/crunch/crunchgen/crunchgen.c Fri Aug 14 08:49:40 2020 (r364233) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Fri Aug 14 09:45:41 2020 (r364234) @@ -653,7 +653,7 @@ fillin_program(prog_t *p) /* Determine the actual srcdir (maybe symlinked). */ if (p->srcdir) { - snprintf(line, MAXLINELEN, "cd %s && env pwd -P", p->srcdir); + snprintf(line, MAXLINELEN, "cd %s && pwd -P", p->srcdir); f = popen(line,"r"); if (!f) errx(1, "Can't execute: %s\n", line); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364646 - head/usr.sbin/crunch/crunchgen
Author: arichardson Date: Mon Aug 24 09:20:18 2020 New Revision: 364646 URL: https://svnweb.freebsd.org/changeset/base/364646 Log: Re-indent crunched_main.c in preparation for D25998 Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c == --- head/usr.sbin/crunch/crunchgen/crunched_main.c Mon Aug 24 09:20:13 2020(r364645) +++ head/usr.sbin/crunch/crunchgen/crunched_main.c Mon Aug 24 09:20:18 2020(r364646) @@ -40,8 +40,8 @@ __FBSDID("$FreeBSD$"); #include struct stub { -char *name; -int (*f)(); + char *name; + int (*f)(); }; extern char *__progname; @@ -52,65 +52,64 @@ static void crunched_usage(void); int main(int argc, char **argv, char **envp) { -char *slash, *basename; -struct stub *ep; + char *slash, *basename; + struct stub *ep; -if(argv[0] == NULL || *argv[0] == '\0') - crunched_usage(); + if (argv[0] == NULL || *argv[0] == '\0') + crunched_usage(); -slash = strrchr(argv[0], '/'); -basename = slash? slash+1 : argv[0]; + slash = strrchr(argv[0], '/'); + basename = slash ? slash + 1 : argv[0]; -for(ep=entry_points; ep->name != NULL; ep++) - if(!strcmp(basename, ep->name)) break; + for (ep = entry_points; ep->name != NULL; ep++) + if (!strcmp(basename, ep->name)) + break; -if(ep->name) - return ep->f(argc, argv, envp); -else { - fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, basename); - crunched_usage(); -} + if (ep->name) + return ep->f(argc, argv, envp); + else { + fprintf(stderr, "%s: %s not compiled in\n", EXECNAME, basename); + crunched_usage(); + } } - int crunched_main(int argc, char **argv, char **envp) { -char *slash; -struct stub *ep; -int columns, len; + char *slash; + struct stub *ep; + int columns, len; -if(argc <= 1) - crunched_usage(); + if (argc <= 1) + crunched_usage(); -slash = strrchr(argv[1], '/'); -__progname = slash? slash+1 : argv[1]; + slash = strrchr(argv[1], '/'); + __progname = slash ? slash + 1 : argv[1]; -return main(--argc, ++argv, envp); + return main(--argc, ++argv, envp); } - static void crunched_usage() { -int columns, len; -struct stub *ep; + int columns, len; + struct stub *ep; -fprintf(stderr, "usage: %s ..., where is one of:\n", - EXECNAME); -columns = 0; -for(ep=entry_points; ep->name != NULL; ep++) { - len = strlen(ep->name) + 1; - if(columns+len < 80) - columns += len; - else { - fprintf(stderr, "\n"); - columns = len; + fprintf(stderr, + "usage: %s ..., where is one of:\n", EXECNAME); + columns = 0; + for (ep = entry_points; ep->name != NULL; ep++) { + len = strlen(ep->name) + 1; + if (columns + len < 80) + columns += len; + else { + fprintf(stderr, "\n"); + columns = len; + } + fprintf(stderr, " %s", ep->name); } - fprintf(stderr, " %s", ep->name); -} -fprintf(stderr, "\n"); -exit(1); + fprintf(stderr, "\n"); + exit(1); } /* end of crunched_main.c */ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364647 - head/usr.sbin/crunch/crunchgen
Author: arichardson Date: Mon Aug 24 09:20:23 2020 New Revision: 364647 URL: https://svnweb.freebsd.org/changeset/base/364647 Log: Correctly determine the real executable in crunched binaries This should fix cases like su setting argv[0] to _su for /bin/sh. Previously cheribsdbox (a crunched tool we use in CheriBSD to reduce the size of our minimal disk images to allow loading them onto FPGAs without waiting forever for the transfer) would complain about _su not being compiled in, but now that we also look at AT_EXECPATH it correctly invokes the sh tool. Note: we use use AT_EXECPATH instead of the KERN_PROC_PATHNAME sysctl to get the crunchgen binary name since it seems like KERN_PROC_PATHNAME just returns the last cached path for a given hardlink. When using `su`, instead of invoking /bin/csh this would invoke the last used hardlink to cheribsdbox. This caused weird test failures when running tests due to `id` being executed instead of `echo`: $ id # id is a hardlink to /bin/cheribsdbox $ su postgres -c 'echo 1' # su is also a hardlink uid=1001(postgres) gid=1001(postgres) groups=1001(postgres) Obtained from: CheriBSD Reviewed By: emaste, brooks Differential Revision: https://reviews.freebsd.org/D25998 Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c == --- head/usr.sbin/crunch/crunchgen/crunched_main.c Mon Aug 24 09:20:18 2020(r364646) +++ head/usr.sbin/crunch/crunchgen/crunched_main.c Mon Aug 24 09:20:23 2020(r364647) @@ -23,6 +23,38 @@ *Computer Science Department *University of Maryland at College Park */ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2020 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ /* * crunched_main.c - main program for crunched binaries, it branches to a * particular subprogram based on the value of argv[0]. Also included @@ -35,6 +67,11 @@ #include __FBSDID("$FreeBSD$"); +#include +#include +#include + +#include #include #include #include @@ -44,30 +81,88 @@ struct stub { int (*f)(); }; -extern char *__progname; +extern const char *__progname; extern struct stub entry_points[]; static void crunched_usage(void); +static struct stub * +find_entry_point(const char *basename) +{ + struct stub *ep = NULL; + + for (ep = entry_points; ep->name != NULL; ep++) + if (!strcmp(basename, ep->name)) + break; + + return (ep); +} + +static const char * +get_basename(const char *exe_path) +{ + const char *slash = strrchr(exe_path, '/'); + return (slash ? slash + 1 : exe_path); +} + int main(int argc, char **argv, char **envp) { - char *slash, *basename; - struct stub *ep; + struct stub *ep = NULL; + const char *basename = NULL; - if (argv[0] == NULL || *argv[0] == '\0') - crunched_usage(); + /* +* Look at __progname first (this will be set if the crunched binary is +* invoked directly). +*/ + if (__progname) { + basename = get_basename(__progname); + ep = find_entry_point(basename); + }
svn commit: r364645 - head
Author: arichardson Date: Mon Aug 24 09:20:13 2020 New Revision: 364645 URL: https://svnweb.freebsd.org/changeset/base/364645 Log: Pass the installworld install(1) flags to make buildenv This ensure that running make install inside buildenv correctly includes the METALOG flags when building with -DNO_ROOT. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D26038 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Mon Aug 24 09:19:05 2020(r364644) +++ head/Makefile.inc1 Mon Aug 24 09:20:13 2020(r364645) @@ -1178,7 +1178,9 @@ buildenv: .PHONY .if ${BUILDENV_SHELL:M*zsh*} @echo For ZSH you must run: export CPUTYPE=${TARGET_CPUTYPE} .endif - @cd ${BUILDENV_DIR} && env ${WMAKEENV} BUILDENV=1 ${BUILDENV_SHELL} + @cd ${BUILDENV_DIR} && env ${WMAKEENV} \ + INSTALL="${INSTALL_CMD} ${INSTALLFLAGS}" \ + MTREE_CMD="${MTREE_CMD} ${MTREEFLAGS}" BUILDENV=1 ${BUILDENV_SHELL} TOOLCHAIN_TGTS=${WMAKE_TGTS:Neverything:Nbuild${libcompat}} toolchain: ${TOOLCHAIN_TGTS} .PHONY ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364648 - head/usr.sbin/makefs/msdos
Author: arichardson Date: Mon Aug 24 09:20:27 2020 New Revision: 364648 URL: https://svnweb.freebsd.org/changeset/base/364648 Log: makefs (msdosfs): Use fprintf instead of debug print for errors The added print was very helpful for debugging failed disk image creation. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D23200 Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c Modified: head/usr.sbin/makefs/msdos/msdosfs_vnops.c == --- head/usr.sbin/makefs/msdos/msdosfs_vnops.c Mon Aug 24 09:20:23 2020 (r364647) +++ head/usr.sbin/makefs/msdos/msdosfs_vnops.c Mon Aug 24 09:20:27 2020 (r364648) @@ -467,15 +467,15 @@ msdosfs_wfile(const char *path, struct denode *dep, fs if ((fd = open(path, O_RDONLY)) == -1) { error = errno; - MSDOSFS_DPRINTF(("open %s: %s", path, strerror(error))); + fprintf(stderr, "open %s: %s\n", path, strerror(error)); return error; } if ((dat = mmap(0, nsize, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0)) == MAP_FAILED) { error = errno; - MSDOSFS_DPRINTF(("%s: mmap %s: %s", __func__, node->name, - strerror(error))); + fprintf(stderr, "%s: mmap %s: %s\n", __func__, node->name, + strerror(error)); close(fd); goto out; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364649 - in head: lib/libcompiler_rt lib/libgcc_eh lib/libprocstat stand/userboot/userboot
Author: arichardson Date: Mon Aug 24 09:20:33 2020 New Revision: 364649 URL: https://svnweb.freebsd.org/changeset/base/364649 Log: Avoid adding duplicates to SRCS/OBJS/SOBJS/POBJS This is a change in preparation for stopping to use lorder.sh (D26044) and instead assume that we have a linker newer than ~1990. Without lorder.sh duplicates end up being passed to the linker when building .so files and this can result in duplicate symbol definition errors. There is one minor change: libcompiler_rt.a will no longer provide gcc_personality_v0 and instead we now only have it in libgcc_eh.a/libgcc_s.so. This matches GCC's behaviour. Reviewed By: emaste, cem Differential Revision: https://reviews.freebsd.org/D26042 Modified: head/lib/libcompiler_rt/Makefile.inc head/lib/libgcc_eh/Makefile head/lib/libgcc_eh/Makefile.inc head/lib/libprocstat/Makefile head/stand/userboot/userboot/Makefile Modified: head/lib/libcompiler_rt/Makefile.inc == --- head/lib/libcompiler_rt/Makefile.incMon Aug 24 09:20:27 2020 (r364648) +++ head/lib/libcompiler_rt/Makefile.incMon Aug 24 09:20:33 2020 (r364649) @@ -67,7 +67,6 @@ SRCF+=floatunsisf SRCF+= floatuntidf SRCF+= floatuntisf SRCF+= floatuntixf -SRCF+= gcc_personality_v0 # not in upstream SRCF+= int_util SRCF+= lshrdi3 SRCF+= lshrti3 Modified: head/lib/libgcc_eh/Makefile == --- head/lib/libgcc_eh/Makefile Mon Aug 24 09:20:27 2020(r364648) +++ head/lib/libgcc_eh/Makefile Mon Aug 24 09:20:33 2020(r364649) @@ -8,6 +8,7 @@ NO_PIC= MK_SSP=no WARNS?=2 +SRCS_EXC+= int_util.c .include "Makefile.inc" .if ${.MAKE.LEVEL} > 0 Modified: head/lib/libgcc_eh/Makefile.inc == --- head/lib/libgcc_eh/Makefile.inc Mon Aug 24 09:20:27 2020 (r364648) +++ head/lib/libgcc_eh/Makefile.inc Mon Aug 24 09:20:33 2020 (r364649) @@ -9,7 +9,6 @@ STATIC_CFLAGS+=${PICFLAG} -fvisibility=hidden -DVISIBI .PATH: ${COMPILERRTDIR}/lib/builtins .PATH: ${UNWINDSRCDIR} SRCS_EXC+= gcc_personality_v0.c -SRCS_EXC+= int_util.c SRCS_EXC+= Unwind-EHABI.cpp SRCS_EXC+= Unwind-sjlj.c SRCS_EXC+= UnwindLevel1-gcc-ext.c Modified: head/lib/libprocstat/Makefile == --- head/lib/libprocstat/Makefile Mon Aug 24 09:20:27 2020 (r364648) +++ head/lib/libprocstat/Makefile Mon Aug 24 09:20:33 2020 (r364649) @@ -59,8 +59,6 @@ MLINKS+=libprocstat.3 procstat_close.3 \ CFLAGS+= -DLIBPROCSTAT_ZFS SRCS+= zfs.c OBJS+= zfs/zfs_defs.o -SOBJS+=zfs/zfs_defs.pico -POBJS+=zfs/zfs_defs.po SUBDIR=zfs zfs/zfs_defs.o: .PHONY @cd ${.CURDIR}/zfs && ${MAKE} zfs_defs.o Modified: head/stand/userboot/userboot/Makefile == --- head/stand/userboot/userboot/Makefile Mon Aug 24 09:20:27 2020 (r364648) +++ head/stand/userboot/userboot/Makefile Mon Aug 24 09:20:33 2020 (r364649) @@ -20,7 +20,6 @@ SRCS+=bootinfo.c SRCS+= bootinfo32.c SRCS+= bootinfo64.c SRCS+= conf.c -SRCS+= console.c SRCS+= copy.c SRCS+= devicename.c SRCS+= elf32_freebsd.c ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364650 - head
Author: arichardson Date: Mon Aug 24 09:20:38 2020 New Revision: 364650 URL: https://svnweb.freebsd.org/changeset/base/364650 Log: Also print number of available CPUs on Linux Without this change the buildworld/buildkernel epilogue looks like this: >>> World built in 249 seconds, sysctl: cannot stat /proc/sys/hw/ncpu: No such file or directory ncpu: , make -j72. Reviewed By: emaste, bdrewery Differential Revision: https://reviews.freebsd.org/D26056 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Mon Aug 24 09:20:33 2020(r364649) +++ head/Makefile.inc1 Mon Aug 24 09:20:38 2020(r364650) @@ -1136,6 +1136,8 @@ _BUILDWORLD_START!= date '+%s' buildworld: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue .PHONY .ORDER: buildworld_prologue ${WMAKE_TGTS} buildworld_epilogue +_ncpu_cmd=sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo unknown + buildworld_prologue: .PHONY @echo "--" @echo ">>> World build started on `LC_ALL=C date`" @@ -1147,7 +1149,7 @@ buildworld_epilogue: .PHONY @echo ">>> World build completed on `LC_ALL=C date`" @seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \ echo -n ">>> World built in $$seconds seconds, "; \ - echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" + echo "ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" @echo "--" # @@ -1656,7 +1658,7 @@ buildkernel: .MAKE .PHONY .endfor @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ echo -n ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, "; \ - echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" + echo "ncpu: $$(${_ncpu_cmd})${.MAKE.JOBS:S/^/, make -j/}" @echo "--" NO_INSTALLEXTRAKERNELS?= yes ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364757 - in head/tools/build/cross-build/include: . common common/machine common/sys linux linux/sys mac mac/sys
props changed) head/tools/build/cross-build/include/linux/sys/time.h (contents, props changed) head/tools/build/cross-build/include/linux/sys/ttycom.h (contents, props changed) head/tools/build/cross-build/include/linux/sys/types.h (contents, props changed) head/tools/build/cross-build/include/linux/sys/ucred.h (contents, props changed) head/tools/build/cross-build/include/linux/time.h (contents, props changed) head/tools/build/cross-build/include/linux/unistd.h (contents, props changed) head/tools/build/cross-build/include/linux/wctype.h (contents, props changed) head/tools/build/cross-build/include/mac/ head/tools/build/cross-build/include/mac/libutil.h (contents, props changed) head/tools/build/cross-build/include/mac/nbtool_config.h (contents, props changed) head/tools/build/cross-build/include/mac/signal.h (contents, props changed) head/tools/build/cross-build/include/mac/stdlib.h (contents, props changed) head/tools/build/cross-build/include/mac/string.h (contents, props changed) head/tools/build/cross-build/include/mac/sys/ head/tools/build/cross-build/include/mac/sys/_types.h (contents, props changed) head/tools/build/cross-build/include/mac/sys/endian.h (contents, props changed) head/tools/build/cross-build/include/mac/sys/stat.h (contents, props changed) head/tools/build/cross-build/include/mac/sys/time.h (contents, props changed) head/tools/build/cross-build/include/mac/unistd.h (contents, props changed) Added: head/tools/build/cross-build/include/common/db.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/cross-build/include/common/db.hTue Aug 25 13:18:53 2020(r364757) @@ -0,0 +1,42 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2020 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +#pragma once + +/* Ensure that we use the FreeBSD version of the db functions */ +#define dbopen __freebsd_dbopen +#include_next Added: head/tools/build/cross-build/include/common/getopt.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/cross-build/include/common/getopt.hTue Aug 25 13:18:53 2020(r364757) @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2020 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met
svn commit: r364759 - in head: lib/libc/gen lib/libcapsicum tools/build tools/build/cross-build tools/build/libc-bootstrap tools/build/mk
to avoid surprises also compile the FreeBSD code on macOS) +.PATH: ${LIBC_SRCTOP}/stdlib +SRCS+= getopt.c getopt_long.c +INCS+= ${SRCTOP}/include/getopt.h + +# getcap.c is needed for cap_mkdb: +.PATH: ${LIBC_SRCTOP}/gen +SRCS+= getcap.c +# Add various libbc functions that are not available in glibc: +SRCS+= stringlist.c setmode.c +SRCS+= strtonum.c merge.c heapsort.c reallocf.c +.PATH: ${LIBC_SRCTOP}/locale +SRCS+= rpmatch.c + +.if ${.MAKE.OS} == "Linux" +# On Linux, glibc does not provide strlcpy,strlcat or strmode. +.PATH: ${LIBC_SRCTOP}/string +SRCS+= strlcpy.c strlcat.c strmode.c +# Compile the fgetln/fgetwln/closefrom fallback code from libbsd: +SRCS+= fgetln_fallback.c fgetwln_fallback.c closefrom.c +CFLAGS.closefrom.c+= -DSTDC_HEADERS -DHAVE_SYS_DIR_H -DHAVE_DIRENT_H \ + -DHAVE_DIRFD -DHAVE_SYSCONF +# Provide warnc/errc/getprogname/setprograme +SRCS+= err.c progname.c +.endif +# Provide the same arc4random implementation on Linux/macOS +CFLAGS.arc4random.c+= -I${SRCTOP}/sys/crypto/chacha20 -D__isthreaded=1 +SRCS+= arc4random.c arc4random_uniform.c + +# expand_number() is not provided by either Linux or MacOS libutil +.PATH: ${SRCTOP}/lib/libutil +SRCS+= expand_number.c +# Linux libutil also doesn't have fparseln +SRCS+= fparseln.c +# A dummy sysctl for tzsetup: +SRCS+= fake_sysctl.c + +# capsicum support +SYSINCS+= ${SRCTOP}/sys/sys/capsicum.h +SYSINCS+= ${SRCTOP}/sys/sys/caprights.h +SRCS+= capsicum_stubs.c +# XXX: we can't add ${SRCTOP}/sys/kern to .PATH since that will causes +# conflicts with other files. Instead copy subr_capability to the build dir. +subr_capability.c: ${SRCTOP}/sys/kern/subr_capability.c + cp ${.ALLSRC} ${.TARGET} +SRCS+= subr_capability.c +CLEANFILES+= subr_capability.c +.endif + CASPERINC+=${SRCTOP}/lib/libcasper/services/cap_fileargs/cap_fileargs.h .if empty(SRCS) @@ -97,9 +231,22 @@ SYSINCS+= ${SRCTOP}/sys/sys/elf32.h SYSINCS+= ${SRCTOP}/sys/sys/elf64.h SYSINCS+= ${SRCTOP}/sys/sys/elf_common.h SYSINCS+= ${SRCTOP}/sys/sys/elf_generic.h +SYSINCS+= ${SRCTOP}/sys/sys/queue.h +SYSINCS+= ${SRCTOP}/sys/sys/md5.h +SYSINCS+= ${SRCTOP}/sys/sys/sbuf.h +SYSINCS+= ${SRCTOP}/sys/sys/tree.h # vtfontcvt is using sys/font.h SYSINCS+= ${SRCTOP}/sys/sys/font.h +# For mkscrfil.c: +SYSINCS+= ${SRCTOP}/sys/sys/consio.h +# for gencat: +INCS+= ${SRCTOP}/include/nl_types.h +# for vtfontcvt: +SYSINCS+= ${SRCTOP}/sys/sys/fnv_hash.h +# opensolaris compatibility +INCS+= ${SRCTOP}/include/elf.h +SYSINCS+= ${SRCTOP}/sys/sys/elf.h # We want to run the build with only ${WORLDTMP} in $PATH to ensure we don't # accidentally run tools that are incompatible but happen to be in $PATH. @@ -121,6 +268,19 @@ _host_tools_to_symlink=basename bzip2 bunzip2 chmod c # since e.g. on Linux and MacOS that will be GNU make. _make_abs!=which "${MAKE}" _host_abs_tools_to_symlink=${_make_abs}:make ${_make_abs}:bmake + +.if ${.MAKE.OS} != "FreeBSD" +_make_abs!=which "${MAKE}" +_host_abs_tools_to_symlink+= ${_make_abs}:make ${_make_abs}:bmake +.if ${.MAKE.OS} == "Darwin" +# /usr/bin/cpp may invoke xcrun: +_host_tools_to_symlink+=xcrun +.endif # ${.MAKE.OS} == "Darwin" +# On Ubuntu /bin/sh is dash which is totally useless. Let's just link bash +# as the build sh since that will work fine. +_host_abs_tools_to_symlink+= /bin/bash:sh +_host_tools_to_symlink:=${_host_tools_to_symlink:Nsh} +.endif host-symlinks: @echo "Linking host tools into ${DESTDIR}/bin" Added: head/tools/build/cross-build/capsicum_stubs.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/cross-build/capsicum_stubs.c Tue Aug 25 13:23:31 2020(r364759) @@ -0,0 +1,67 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2018-2020 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation a
svn commit: r364763 - head
Author: arichardson Date: Tue Aug 25 13:30:14 2020 New Revision: 364763 URL: https://svnweb.freebsd.org/changeset/base/364763 Log: Use bootstrapped install(1) install of tools/install.sh in world stage This should be noticeably faster due to fewer processes being forked and also handles other flags such as -S or writing to METALOG. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D26039 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Aug 25 13:30:09 2020(r364762) +++ head/Makefile.inc1 Tue Aug 25 13:30:14 2020(r364763) @@ -765,7 +765,7 @@ KTMAKE= \ # world stage WMAKEENV= ${CROSSENV} \ - INSTALL="sh ${.CURDIR}/tools/install.sh" \ + INSTALL="${INSTALL_CMD} -U" \ PATH=${TMPPATH} \ SYSROOT=${WORLDTMP} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364762 - head
Author: arichardson Date: Tue Aug 25 13:30:09 2020 New Revision: 364762 URL: https://svnweb.freebsd.org/changeset/base/364762 Log: Fix running the builddtb target on a noexec file system Obtained from:CheriBSD Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Aug 25 13:30:03 2020(r364761) +++ head/Makefile.inc1 Tue Aug 25 13:30:09 2020(r364762) @@ -3260,7 +3260,7 @@ DTBOUTPUTPATH= ${.CURDIR} # builddtb: .PHONY @PATH=${TMPPATH} MACHINE=${TARGET} \ - ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ + sh ${.CURDIR}/sys/tools/fdt/make_dtb.sh ${.CURDIR}/sys \ "${FDT_DTS_FILE}" ${DTBOUTPUTPATH} ### ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364761 - in head: share/mk sys/conf sys/modules/cloudabi32 sys/modules/cloudabi64 sys/modules/linux sys/modules/linux64
Author: arichardson Date: Tue Aug 25 13:30:03 2020 New Revision: 364761 URL: https://svnweb.freebsd.org/changeset/base/364761 Log: Pass -fuse-ld=/path/to/ld if ${LD} != "ld" This is needed so that setting LD/XLD is not ignored when linking with $CC instead of directly using $LD. Currently only clang accepts an absolute path for -fuse-ld= (Clang 12+ will add a new --ld-path flag), so we now warn when building with GCC and $LD != "ld" since that might result in the wrong linker being used. We have been setting XLD=/path/to/cheri/ld.lld in CheriBSD for a long time and used a similar version of this patch to avoid linking with /usr/bin/ld. This change is also required when building FreeBSD on an Ubuntu with Clang: In that case we set XCC=/usr/lib/llvm-10/bin/clang and since /usr/lib/llvm-10/bin/ does not contain a "ld" binary the build fails with `clang: error: unable to execute command: Executable "ld" doesn't exist!` unless we pass -fuse-ld=/usr/lib/llvm-10/bin/ld.lld. This change passes -fuse-ld instead of copying ${XLD} to WOLRDTMP/bin/ld since then we would have to ensure that this file does not exist while building the bootstrap tools. The cross-linker might not be compatible with the host linker (e.g. when building on macos: host-linker= Mach-O /usr/bin/ld, cross-linker=LLVM ld.lld). Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D26055 Modified: head/share/mk/bsd.sys.mk head/sys/conf/kern.mk head/sys/conf/kern.post.mk head/sys/modules/cloudabi32/Makefile head/sys/modules/cloudabi64/Makefile head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile Modified: head/share/mk/bsd.sys.mk == --- head/share/mk/bsd.sys.mkTue Aug 25 13:29:57 2020(r364760) +++ head/share/mk/bsd.sys.mkTue Aug 25 13:30:03 2020(r364761) @@ -284,6 +284,19 @@ CFLAGS+= ERROR-tried-to-rebuild-during-make-install .endif .endif +# Please keep this if in sync with kern.mk +.if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld") +# Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld". +# Note: Clang 12+ will prefer --ld-path= over -fuse-ld=. +.if ${COMPILER_TYPE} == "clang" +LDFLAGS+= -fuse-ld=${LD:[1]} +.else +# GCC does not support an absolute path for -fuse-ld so we just print this +# warning instead and let the user add the required symlinks. +.warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported +.endif +.endif + # Tell bmake not to mistake standard targets for things to be searched for # or expect to ever be up-to-date. PHONY_NOTMAIN = analyze afterdepend afterinstall all beforedepend beforeinstall \ Modified: head/sys/conf/kern.mk == --- head/sys/conf/kern.mk Tue Aug 25 13:29:57 2020(r364760) +++ head/sys/conf/kern.mk Tue Aug 25 13:30:03 2020(r364761) @@ -270,6 +270,22 @@ CFLAGS+=-std=iso9899:1999 CFLAGS+=-std=${CSTD} .endif # CSTD +# Please keep this if in sync with bsd.sys.mk +.if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld") +# Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld". +# Note: Clang 12+ will prefer --ld-path= over -fuse-ld=. +.if ${COMPILER_TYPE} == "clang" +# Note: unlike bsd.sys.mk we can't use LDFLAGS here since that is used for the +# flags required when linking the kernel. We don't need those flags when +# building the vdsos. However, we do need -fuse-ld, so use ${CCLDFLAGS} instead. +CCLDFLAGS+=-fuse-ld=${LD:[1]} +.else +# GCC does not support an absolute path for -fuse-ld so we just print this +# warning instead and let the user add the required symlinks. +.warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported +.endif +.endif + # Set target-specific linker emulation name. LD_EMULATION_aarch64=aarch64elf LD_EMULATION_amd64=elf_x86_64_fbsd Modified: head/sys/conf/kern.post.mk == --- head/sys/conf/kern.post.mk Tue Aug 25 13:29:57 2020(r364760) +++ head/sys/conf/kern.post.mk Tue Aug 25 13:30:03 2020(r364761) @@ -228,7 +228,7 @@ kernel-clean: # in the a.out ld. For now, this works. hack.pico: Makefile :> hack.c - ${CC} -shared ${CFLAGS} -nostdlib hack.c -o hack.pico + ${CC} ${CCLDFLAGS} -shared ${CFLAGS} -nostdlib hack.c -o hack.pico rm -f hack.c offset.inc: $S/kern/genoffset.sh genoffset.o Modified: head/sys/modules/cloudabi32/Makefile == --- head/sys/modules/cloudabi32/MakefileTue Aug 25 13:29:57 2020 (r364760) +++ head/sys/modules/cloudabi32/MakefileTue Aug 25 13:30:03 2020 (r364761)
svn commit: r364760 - in head: . sys/conf tools/build tools/build/bootstrap-m4 tools/build/cross-build/fake_chflags usr.bin/m4
Author: arichardson Date: Tue Aug 25 13:29:57 2020 New Revision: 364760 URL: https://svnweb.freebsd.org/changeset/base/364760 Log: Add necessary Makefile.inc1 infrastructure for building on non-FreeBSD The most awkward bit in this patch is the bootstrapping of m4: We can't simply use the host version of m4 since that is not compatible with the flags passed by lex (at least on macOS, possibly also on Linux). Therefore we need to bootstrap m4, but lex needs m4 to build and m4 also depends on lex (which needs m4 to generate any files). To work around this cyclic dependency we can build a bootstrap version of m4 (with pre-generated files) then use that to build the real m4. This patch also changes the xz/unxz/dd tools to always use the host version since the version in the source tree cannot easily be bootstrapped on macOS or Linux. Reviewed By: brooks, imp (earlier version) Differential Revision: https://reviews.freebsd.org/D25992 Added: head/tools/build/bootstrap-m4/ head/tools/build/bootstrap-m4/Makefile (contents, props changed) head/tools/build/bootstrap-m4/inittokenizer.c (contents, props changed) head/tools/build/cross-build/fake_chflags/ head/tools/build/cross-build/fake_chflags/Makefile (contents, props changed) head/tools/build/cross-build/fake_chflags/chflags (contents, props changed) Modified: head/Makefile.inc1 head/sys/conf/kern.post.mk head/tools/build/Makefile head/usr.bin/m4/Makefile Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Tue Aug 25 13:23:31 2020(r364759) +++ head/Makefile.inc1 Tue Aug 25 13:29:57 2020(r364760) @@ -167,6 +167,19 @@ _t=${TARGET_ARCH}/${TARGET} .endif .endfor +.if ${.MAKE.OS} != "FreeBSD" +CROSSBUILD_HOST=${.MAKE.OS} +.if ${.MAKE.OS} != "Linux" && ${.MAKE.OS} != "Darwin" +.warning "Unsupported crossbuild system: ${.MAKE.OS}. Build will probably fail!" +.endif +# We need to force NO_ROOT/DB_FROM_SRC builds when building on other operating +# systems since the BSD.foo.dist specs contain users and groups that do not +# exist by default on a Linux/MacOS system. +NO_ROOT:= 1 +DB_FROM_SRC:= 1 +.export NO_ROOT +.endif + # If all targets are disabled for system llvm then don't expect it to work # for cross-builds. .if !defined(TOOLS_PREFIX) && ${MK_LLVM_TARGET_ALL} == "no" && \ @@ -568,13 +581,16 @@ _CPUTYPE!=MAKEFLAGS= CPUTYPE=${_TARGET_CPUTYPE} ${MAK .endif .if make(buildworld) BUILD_ARCH!= uname -p -.if ${MACHINE_ARCH} != ${BUILD_ARCH} +# On some Linux systems uname -p returns "unknown" so skip this check there. +# This check only exists to tell people to use TARGET_ARCH instead of +# MACHINE_ARCH so skipping it when crossbuilding on non-FreeBSD should be fine. +.if ${MACHINE_ARCH} != ${BUILD_ARCH} && ${.MAKE.OS} == "FreeBSD" .error To cross-build, set TARGET_ARCH. .endif .endif WORLDTMP?= ${OBJTOP}/tmp BPATH= ${CCACHE_WRAPPER_PATH_PFX}${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin:${WORLDTMP}/legacy/usr/libexec -XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin +XPATH= ${WORLDTMP}/bin:${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin # When building we want to find the cross tools before the host tools in ${BPATH}. # We also need to add UNIVERSE_TOOLCHAIN_PATH so that we can find the shared @@ -589,6 +605,13 @@ STRICTTMPPATH= ${XPATH}:${BPATH}:${UNIVERSE_TOOLCHAIN_ # USING_SYSTEM_LINKER/USING_SYSTEM_COMPILER. Once these issues have been # resolved it will be turned on by default. BUILD_WITH_STRICT_TMPPATH?=0 +.if defined(CROSSBUILD_HOST) +# When building on non-FreeBSD we can't rely on the tools in /usr/bin being compatible +# with what FreeBSD expects. Therefore we only use tools from STRICTTMPPATH +# during the world build stage. We build most tools during the bootstrap-tools +# phase but symlink host tools that are known to work instead of building them +BUILD_WITH_STRICT_TMPPATH:=1 +.endif .if ${BUILD_WITH_STRICT_TMPPATH} != 0 TMPPATH= ${STRICTTMPPATH} .else @@ -724,7 +747,9 @@ XMAKE= ${BMAKE} \ # kernel-tools stage KTMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${BPATH}:${PATH} \ - WORLDTMP=${WORLDTMP} + WORLDTMP=${WORLDTMP} \ + MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" + KTMAKE=\ TOOLS_PREFIX=${TOOLS_PREFIX_UNDEF:U${WORLDTMP}} \ ${KTMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ @@ -845,7 +870,13 @@ NO_META_IGNORE_HOST_HEADERS= 1 # allows tracking the oldest osreldate to force rebuilds via # META_MODE_BADABI_REVS above. host-osreldate.h: # DO NOT ADD /usr/include/osreldate.h here +.if !defined(CROSSBUILD_HOST) @cp -f /usr/include/osreldate.h ${.TARGET} +.else + @echo "#ifndef __FreeBSD_version" > ${.TARGET} +
svn commit: r364766 - head/share/man/man5
Author: arichardson Date: Tue Aug 25 13:30:29 2020 New Revision: 364766 URL: https://svnweb.freebsd.org/changeset/base/364766 Log: style.Makefile: list CSTD between WARNS and CFLAGS This was suggested by emaste in https://reviews.freebsd.org/D25928 and matches most uses in the tree. Modified: head/share/man/man5/style.Makefile.5 Modified: head/share/man/man5/style.Makefile.5 == --- head/share/man/man5/style.Makefile.5Tue Aug 25 13:30:24 2020 (r364765) +++ head/share/man/man5/style.Makefile.5Tue Aug 25 13:30:29 2020 (r364766) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 21, 2015 +.Dd August 25, 2020 .Dt STYLE.MAKEFILE 5 .Os .Sh NAME @@ -78,6 +78,7 @@ order is: .Va INCS .Va SRCS .Va WARNS +.Va CSTD .Va CFLAGS .Va DPADD .Va LDADD . @@ -87,6 +88,7 @@ order is: .Va PROG Ns / Ns Oo Va SH Oc Ns Va LIB Ns / Ns Va SCRIPTS .Va SRCS .Va WARNS +.Va CSTD .Va CFLAGS .Va DPADD .Va LDADD ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364767 - in head: contrib/lua/src lib/liblua
Author: arichardson Date: Tue Aug 25 13:30:34 2020 New Revision: 364767 URL: https://svnweb.freebsd.org/changeset/base/364767 Log: Fix -Wundef warnings when building liblua We need to define the LUA_FLOAT_INT64 macro even if we don't use it (copied from stand/luaconf.h). While touching luaconf.h.dist also sync it with the the 5.3.5 release version (matches the one in lib/liblua). Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D25977 Modified: head/contrib/lua/src/luaconf.h.dist head/lib/liblua/luaconf.h Modified: head/contrib/lua/src/luaconf.h.dist == --- head/contrib/lua/src/luaconf.h.dist Tue Aug 25 13:30:29 2020 (r364766) +++ head/contrib/lua/src/luaconf.h.dist Tue Aug 25 13:30:34 2020 (r364767) @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.259 2016/12/22 13:08:50 roberto Exp $ +** $Id: luaconf.h,v 1.259.1.1 2017/04/19 17:29:57 roberto Exp $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -114,6 +114,7 @@ #define LUA_FLOAT_FLOAT1 #define LUA_FLOAT_DOUBLE 2 #define LUA_FLOAT_LONGDOUBLE 3 +#define LUA_FLOAT_INT644 #if defined(LUA_32BITS)/* { */ /* @@ -618,6 +619,13 @@ #if !defined(LUA_USE_C89) #define lua_strx2number(s,p) lua_str2number(s,p) #endif + + +/* +@@ lua_pointer2str converts a pointer to a readable string in a +** non-specified way. +*/ +#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) /* Modified: head/lib/liblua/luaconf.h == --- head/lib/liblua/luaconf.h Tue Aug 25 13:30:29 2020(r364766) +++ head/lib/liblua/luaconf.h Tue Aug 25 13:30:34 2020(r364767) @@ -122,6 +122,7 @@ #define LUA_FLOAT_FLOAT1 #define LUA_FLOAT_DOUBLE 2 #define LUA_FLOAT_LONGDOUBLE 3 +#define LUA_FLOAT_INT644 #if defined(LUA_32BITS)/* { */ /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364764 - head
Author: arichardson Date: Tue Aug 25 13:30:19 2020 New Revision: 364764 URL: https://svnweb.freebsd.org/changeset/base/364764 Log: Fix typo in r364325 that broke tinderbox with -DBUILD_WITH_STRICT_TMPPATH ${TARGET_ARCH} is empty here which results in empy MAKE_PARAMS being passed to the buildkernel phase. This breaks the build when using the strict TMPPATH since cc will not be included in $PATH. Reviewed By: jhb Modified: head/Makefile Modified: head/Makefile == --- head/Makefile Tue Aug 25 13:30:14 2020(r364763) +++ head/Makefile Tue Aug 25 13:30:19 2020(r364764) @@ -734,7 +734,7 @@ universe_kernconf_${TARGET}_${kernel}: .MAKE ${SUB_MAKE} ${JFLAG} buildkernel \ TARGET=${TARGET} \ TARGET_ARCH=${TARGET_ARCH_${kernel}} \ - ${MAKE_PARAMS_${TARGET_ARCH}} \ + ${MAKE_PARAMS_${TARGET_ARCH_${kernel}}} \ KERNCONF=${kernel} \ > _.${TARGET}.${kernel} 2>&1 || \ (echo "${TARGET} ${kernel} kernel failed," \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364765 - in head: sbin/newfs_msdos usr.sbin/makefs
Author: arichardson Date: Tue Aug 25 13:30:24 2020 New Revision: 364765 URL: https://svnweb.freebsd.org/changeset/base/364765 Log: Fix makefs bootstrap on macOS after D25563 The macOS assert.h header does not define static_assert when compiling in C99 mode. To fix this compile with -std=c11. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D25928 Modified: head/sbin/newfs_msdos/Makefile head/usr.sbin/makefs/Makefile Modified: head/sbin/newfs_msdos/Makefile == --- head/sbin/newfs_msdos/Makefile Tue Aug 25 13:30:19 2020 (r364764) +++ head/sbin/newfs_msdos/Makefile Tue Aug 25 13:30:24 2020 (r364765) @@ -9,5 +9,6 @@ SRCS= newfs_msdos.c mkfs_msdos.c .if ${MACHINE_CPUARCH} == "arm" WARNS?= 3 .endif +CSTD= c11 .include Modified: head/usr.sbin/makefs/Makefile == --- head/usr.sbin/makefs/Makefile Tue Aug 25 13:30:19 2020 (r364764) +++ head/usr.sbin/makefs/Makefile Tue Aug 25 13:30:24 2020 (r364765) @@ -17,6 +17,7 @@ SRCS= cd9660.c \ MAN= makefs.8 WARNS?=2 +CSTD= c11 .include "${SRCDIR}/cd9660/Makefile.inc" .include "${SRCDIR}/ffs/Makefile.inc" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364807 - in head: share/mk sys/conf
Author: arichardson Date: Wed Aug 26 09:19:44 2020 New Revision: 364807 URL: https://svnweb.freebsd.org/changeset/base/364807 Log: Fix builds that set LD=ld.lld after r364761 When using relative paths for the linker we have to transform the name since clang does not like -fuse-ld=ld.lld and instead requires -fuse-ld=lld (the same also applies for ld.bfd). Modified: head/share/mk/bsd.sys.mk head/sys/conf/kern.mk Modified: head/share/mk/bsd.sys.mk == --- head/share/mk/bsd.sys.mkWed Aug 26 07:29:17 2020(r364806) +++ head/share/mk/bsd.sys.mkWed Aug 26 09:19:44 2020(r364807) @@ -289,7 +289,8 @@ CFLAGS+=ERROR-tried-to-rebuild-during-make-install # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld". # Note: Clang 12+ will prefer --ld-path= over -fuse-ld=. .if ${COMPILER_TYPE} == "clang" -LDFLAGS+= -fuse-ld=${LD:[1]} +# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld. +LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} .else # GCC does not support an absolute path for -fuse-ld so we just print this # warning instead and let the user add the required symlinks. Modified: head/sys/conf/kern.mk == --- head/sys/conf/kern.mk Wed Aug 26 07:29:17 2020(r364806) +++ head/sys/conf/kern.mk Wed Aug 26 09:19:44 2020(r364807) @@ -278,7 +278,8 @@ CFLAGS+=-std=${CSTD} # Note: unlike bsd.sys.mk we can't use LDFLAGS here since that is used for the # flags required when linking the kernel. We don't need those flags when # building the vdsos. However, we do need -fuse-ld, so use ${CCLDFLAGS} instead. -CCLDFLAGS+=-fuse-ld=${LD:[1]} +# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld. +CCLDFLAGS+=-fuse-ld=${LD:[1]:S/^ld.//1W} .else # GCC does not support an absolute path for -fuse-ld so we just print this # warning instead and let the user add the required symlinks. ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364808 - head/lib
Author: arichardson Date: Wed Aug 26 09:19:49 2020 New Revision: 364808 URL: https://svnweb.freebsd.org/changeset/base/364808 Log: Move libsqlite3 to the top of the SUBDIR list In parallel builds, this should allow sqlite to start building earlier and increase parallelism when building lib/. Looking at htop output during buildworld/tinderbox, there are long phases where only one CPU is active optimizing the massive sqlite3.c file since the build of libsqlite3 is started quite late. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D26169 Modified: head/lib/Makefile Modified: head/lib/Makefile == --- head/lib/Makefile Wed Aug 26 09:19:44 2020(r364807) +++ head/lib/Makefile Wed Aug 26 09:19:49 2020(r364808) @@ -23,9 +23,12 @@ SUBDIR_BOOTSTRAP= \ msun # The main list; please keep these sorted alphabetically. +# The only exception is sqlite3: we place it at the start of the list since it +# takes a long time to build and starting it first improves parallelism. SUBDIR=${SUBDIR_BOOTSTRAP} \ .WAIT \ + libsqlite3 \ geom \ libalias \ libarchive \ @@ -84,7 +87,6 @@ SUBDIR= ${SUBDIR_BOOTSTRAP} \ librtld_db \ libsbuf \ libsmb \ - libsqlite3 \ libstdbuf \ libstdthreads \ libsysdecode \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r364809 - head/share/mk
Author: arichardson Date: Wed Aug 26 10:21:38 2020 New Revision: 364809 URL: https://svnweb.freebsd.org/changeset/base/364809 Log: Avoid recomputing COMPILER_/LINKER_ variables when set explicitly I noticed that when we build libraries for a different ABI (in CheriBSD) we were calling ${XCC}/${LD} --version for every directory. It turns out that this was caused by bsd.compat.mk explicitly setting (X_)COMPILER variables for that build stage and this stops the _can_export logic from working. To fix this, we change the check to only set _can_export=no if the variable is set and it is set to a different value than the cached value. This noticeably speeds up the tree walk while building compat libraries. During an upstream amd64 buildworld this also removes 8 --version calls. Obtained from:CheriBSD Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D25986 Modified: head/share/mk/bsd.compiler.mk head/share/mk/bsd.linker.mk Modified: head/share/mk/bsd.compiler.mk == --- head/share/mk/bsd.compiler.mk Wed Aug 26 09:19:49 2020 (r364808) +++ head/share/mk/bsd.compiler.mk Wed Aug 26 10:21:38 2020 (r364809) @@ -146,10 +146,13 @@ _exported_vars= ${X_}COMPILER_TYPE ${X_}COMPILER_VERSI ${X_}COMPILER_FREEBSD_VERSION ${X_}COMPILER_RESOURCE_DIR ${X_}_cc_hash= ${${cc}}${MACHINE}${PATH} ${X_}_cc_hash:=${${X_}_cc_hash:hash} -# Only import if none of the vars are set somehow else. +# Only import if none of the vars are set differently somehow else. _can_export= yes .for var in ${_exported_vars} -.if defined(${var}) +.if defined(${var}) && (!defined(${var}__${${X_}_cc_hash}) || ${${var}__${${X_}_cc_hash}} != ${${var}}) +.if defined(${var}__${${X_}_ld_hash}) +.info "Cannot import ${X_}COMPILER variables since cached ${var} is different: ${${var}__${${X_}_cc_hash}} != ${${var}}" +.endif _can_export= no .endif .endfor Modified: head/share/mk/bsd.linker.mk == --- head/share/mk/bsd.linker.mk Wed Aug 26 09:19:49 2020(r364808) +++ head/share/mk/bsd.linker.mk Wed Aug 26 10:21:38 2020(r364809) @@ -41,10 +41,13 @@ _exported_vars= ${X_}LINKER_TYPE ${X_}LINKER_VERSION $ ${X_}LINKER_FREEBSD_VERSION ${X_}_ld_hash= ${${ld}}${MACHINE}${PATH} ${X_}_ld_hash:=${${X_}_ld_hash:hash} -# Only import if none of the vars are set somehow else. +# Only import if none of the vars are set differently somehow else. _can_export= yes .for var in ${_exported_vars} -.if defined(${var}) +.if defined(${var}) && (!defined(${var}__${${X_}_ld_hash}) || ${${var}__${${X_}_ld_hash}} != ${${var}}) +.if defined(${var}__${${X_}_ld_hash}) +.info "Cannot import ${X_}LINKER variables since cached ${var} is different: ${${var}__${${X_}_ld_hash}} != ${${var}}" +.endif _can_export= no .endif .endfor ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366664 - head/share/mk
Author: arichardson Date: Tue Oct 13 08:14:33 2020 New Revision: 34 URL: https://svnweb.freebsd.org/changeset/base/34 Log: Stop using -O instead of -O2 for MIPS Until clang 11 that was equivalent to -O2, but clang changed it to -O1 so generated MIPS code will now be unnecessarily slow. It also removes a weird special case from sys.mk. This is similar to the D26471 change for debug kernels and should not change anything since everything was previously building MIPS code at -O2 until the clang 11 update. Reviewed By: trasz Differential Revision: https://reviews.freebsd.org/D26749 Modified: head/share/mk/sys.mk Modified: head/share/mk/sys.mk == --- head/share/mk/sys.mkTue Oct 13 05:39:43 2020(r33) +++ head/share/mk/sys.mkTue Oct 13 08:14:33 2020(r34) @@ -166,11 +166,7 @@ CC ?= c89 CFLAGS ?= -O .else CC ?= cc -.if ${MACHINE_CPUARCH} == "mips" -CFLAGS ?= -O -pipe -.else CFLAGS ?= -O2 -pipe -.endif .if defined(NO_STRICT_ALIASING) CFLAGS += -fno-strict-aliasing .endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366697 - head/usr.bin/xinstall
Author: arichardson Date: Wed Oct 14 12:28:41 2020 New Revision: 366697 URL: https://svnweb.freebsd.org/changeset/base/366697 Log: install(1): Avoid unncessary fstatfs() calls and use mmap() based on size According to git blame the trymmap() function was added in 1996 to skip mmap() calls for NFS file systems. However, nowadays mmap() should be perfectly safe even on NFS. Importantly, onl ufs and cd9660 file systems were whitelisted so we don't use mmap() on ZFS. It also prevents the use of mmap() when bootstrapping from macOS/Linux since on those systems the trymmap() function was always returning zero due to the missing MFSNAMELEN define. This change keeps the trymmap() function but changes it to check whether using mmap() can reduce the number of system calls that are required. Using mmap() only reduces the number of system calls if we need multiple read() syscalls, i.e. if the file size is > MAXBSIZE. However, mmap() is more expensive than read() so this sets the threshold at 4 fewer syscalls. Additionally, for larger file size mmap() can significantly increase the number of page faults, so avoid it in that case. It's unclear whether using mmap() is ever faster than a read with an appropriate buffer size, but this change at least removes two unnecessary system calls for every file that is installed. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D26041 Modified: head/usr.bin/xinstall/xinstall.c Modified: head/usr.bin/xinstall/xinstall.c == --- head/usr.bin/xinstall/xinstall.cWed Oct 14 10:12:39 2020 (r366696) +++ head/usr.bin/xinstall/xinstall.cWed Oct 14 12:28:41 2020 (r366697) @@ -148,7 +148,7 @@ static void metadata_log(const char *, const char *, s const char *, const char *, off_t); static int parseid(const char *, id_t *); static int strip(const char *, int, const char *, char **); -static int trymmap(int); +static int trymmap(size_t); static voidusage(void); int @@ -1087,7 +1087,7 @@ compare(int from_fd, const char *from_name __unused, s if (do_digest) digest_init(&ctx); done_compare = 0; - if (trymmap(from_fd) && trymmap(to_fd)) { + if (trymmap(from_len) && trymmap(to_len)) { p = mmap(NULL, from_len, PROT_READ, MAP_SHARED, from_fd, (off_t)0); if (p == MAP_FAILED) @@ -1248,13 +1248,8 @@ copy(int from_fd, const char *from_name, int to_fd, co digest_init(&ctx); - /* -* Mmap and write if less than 8M (the limit is so we don't totally -* trash memory on big files. This is really a minor hack, but it -* wins some CPU back. -*/ done_copy = 0; - if (size <= 8 * 1048576 && trymmap(from_fd) && + if (trymmap((size_t)size) && (p = mmap(NULL, (size_t)size, PROT_READ, MAP_SHARED, from_fd, (off_t)0)) != MAP_FAILED) { nw = write(to_fd, p, size); @@ -1523,20 +1518,23 @@ usage(void) * return true (1) if mmap should be tried, false (0) if not. */ static int -trymmap(int fd) +trymmap(size_t filesize) { -/* - * The ifdef is for bootstrapping - f_fstypename doesn't exist in - * pre-Lite2-merge systems. - */ -#ifdef MFSNAMELEN - struct statfs stfs; - - if (fstatfs(fd, &stfs) != 0) - return (0); - if (strcmp(stfs.f_fstypename, "ufs") == 0 || - strcmp(stfs.f_fstypename, "cd9660") == 0) - return (1); -#endif - return (0); + /* +* This function existed to skip mmap() for NFS file systems whereas +* nowadays mmap() should be perfectly safe. Nevertheless, using mmap() +* only reduces the number of system calls if we need multiple read() +* syscalls, i.e. if the file size is > MAXBSIZE. However, mmap() is +* more expensive than read() so set the threshold at 4 fewer syscalls. +* Additionally, for larger file size mmap() can significantly increase +* the number of page faults, so avoid it in that case. +* +* Note: the 8MB limit is not based on any meaningful benchmarking +* results, it is simply reusing the same value that was used before +* and also matches bin/cp. +* +* XXX: Maybe we shouldn't bother with mmap() at all, since we use +* MAXBSIZE the syscall overhead of read() shouldn't be too high? +*/ + return (filesize > 4 * MAXBSIZE && filesize < 8 * 1024 * 1024); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366699 - in head: kerberos5/include tools/build tools/build/cross-build/include/common/sys
Author: arichardson Date: Wed Oct 14 12:28:54 2020 New Revision: 366699 URL: https://svnweb.freebsd.org/changeset/base/366699 Log: Fix more -Wundef warnings during bootstrap Modified: head/kerberos5/include/config.h head/tools/build/Makefile head/tools/build/cross-build/include/common/sys/cdefs.h Modified: head/kerberos5/include/config.h == --- head/kerberos5/include/config.h Wed Oct 14 12:28:48 2020 (r366698) +++ head/kerberos5/include/config.h Wed Oct 14 12:28:54 2020 (r366699) @@ -975,7 +975,7 @@ static /**/const char *const rcsid[] = { (const char * #define HAVE_STRVISX 1 /* Define to 1 if you have the `svis' function. */ -/* #undef HAVE_SVIS */ +#define HAVE_SVIS 1 /* Define if you have the function `swab'. */ #define HAVE_SWAB 1 Modified: head/tools/build/Makefile == --- head/tools/build/Makefile Wed Oct 14 12:28:48 2020(r366698) +++ head/tools/build/Makefile Wed Oct 14 12:28:54 2020(r366699) @@ -57,8 +57,8 @@ _WITH_STRSVIS!= grep -c strsvis ${HOST_INCLUDE_ROOT}/v .PATH: ${.CURDIR}/../../contrib/libc-vis INCS+= vis.h SRCS+= vis.c unvis.c -CFLAGS.vis.c+= -I${.CURDIR}/../../contrib/libc-vis -CFLAGS.unvis.c+= -I${.CURDIR}/../../contrib/libc-vis +CFLAGS.vis.c+= -I${.CURDIR}/../../contrib/libc-vis -DHAVE_VIS=0 -DHAVE_SVIS=0 +CFLAGS.unvis.c+= -I${.CURDIR}/../../contrib/libc-vis -DHAVE_VIS=0 -DHAVE_SVIS=0 .endif _WITH_REALLOCARRAY!= grep -c reallocarray ${HOST_INCLUDE_ROOT}/stdlib.h || true Modified: head/tools/build/cross-build/include/common/sys/cdefs.h == --- head/tools/build/cross-build/include/common/sys/cdefs.h Wed Oct 14 12:28:48 2020(r366698) +++ head/tools/build/cross-build/include/common/sys/cdefs.h Wed Oct 14 12:28:54 2020(r366699) @@ -190,11 +190,6 @@ typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; -/* This is needed so that BSNMP doesn't redeclare an incompatible version */ -#define HAVE_STRLCPY 1 -/* The compiler supports __func__ */ -#define HAVE_DECL___FUNC__ 1 - /* On MacOS __CONCAT is defined as x ## y, which won't expand macros */ #undef __CONCAT #define __CONCAT1(x, y) x##y ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366698 - head/sys/modules
Author: arichardson Date: Wed Oct 14 12:28:48 2020 New Revision: 366698 URL: https://svnweb.freebsd.org/changeset/base/366698 Log: Don't build the malo module with clang 10 Compiling it with LLVM 10 triggers https://bugs.llvm.org/show_bug.cgi?id=44351 While LLVM 11 is the default compiler, I regularly build with CROSS_TOOLCHAIN=llvm10 or use system packages for clang on Linux/macOS and those have not been updated to 11 yet. Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Wed Oct 14 12:28:41 2020(r366697) +++ head/sys/modules/Makefile Wed Oct 14 12:28:48 2020(r366698) @@ -224,7 +224,7 @@ SUBDIR= \ mac_seeotheruids \ mac_stub \ mac_test \ - malo \ + ${_malo} \ md \ mdio \ mem \ @@ -802,6 +802,12 @@ _cloudabi64= cloudabi64 .if ${MACHINE_ARCH:Marmv[67]*} != "" || ${MACHINE_CPUARCH} == "aarch64" _bcm283x_clkman= bcm283x_clkman _bcm283x_pwm= bcm283x_pwm +.endif + +.if !(${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 11) +# LLVM 10 crashes when building if_malo_pci.c, fixed in LLVM11: +# https://bugs.llvm.org/show_bug.cgi?id=44351 +_malo= malo .endif SUBDIR+=${MODULES_EXTRA} ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366708 - in head/sbin/pfctl/tests: . files
ctl/tests/files/Makefile == --- head/sbin/pfctl/tests/files/MakefileWed Oct 14 15:50:28 2020 (r366707) +++ head/sbin/pfctl/tests/files/MakefileWed Oct 14 17:39:50 2020 (r366708) @@ -7,6 +7,5 @@ BINDIR= ${TESTSDIR} # We use ${.CURDIR} as workaround so that the glob patterns work. FILES!=echo ${.CURDIR}/pf.in ${.CURDIR}/pf.include ${.CURDIR}/pf.ok -FILES+=${.CURDIR}/pfctl_test_descr.sh .include Added: head/sbin/pfctl/tests/pfctl_test.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/pfctl/tests/pfctl_test.c Wed Oct 14 17:39:50 2020 (r366708) @@ -0,0 +1,230 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2020 Alex Richardson + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory (Department of Computer Science and + * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the + * DARPA SSITH research programme. + * + * This work was supported by Innovate UK project 105694, "Digital Security by + * Design (DSbD) Technology Platform Prototype". + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + *this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + *this list of conditions and the following disclaimer in the documentation + *and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* + * Tests 0001-0999 are copied from OpenBSD's regress/sbin/pfctl. + * Tests 1001-1999 are ours (FreeBSD's own). + * + * pf: Run pfctl -nv on pf.in and check that the output matches pf.ok. + * Copied from OpenBSD. Main differences are some things not working + * in FreeBSD: + * * The action 'match' + * * The command 'set reassemble' + * * The 'from'/'to' options together with 'route-to' + * * The option 'scrub' (it is an action in FreeBSD) + * * Accepting undefined routing tables in actions (??: see pf0093.in) + * * The 'route' option + * * The 'set queue def' option + * selfpf: Feed pfctl output through pfctl again and verify it stays the same. + * Copied from OpenBSD. + */ + +static bool +check_pf_module_available() +{ + int modid; + struct module_stat stat; + + if ((modid = modfind("pf")) < 0) { + warn("pf module not found"); + return false; + } + stat.version = sizeof(struct module_stat); + if (modstat(modid, &stat) < 0) { + warn("can't stat pf module id %d", modid); + return false; + } + return (true); +} + +extern char **environ; + +static struct sbuf * +read_fd(int fd, size_t sizehint) +{ + struct sbuf *sb; + ssize_t count; + char buffer[MAXBSIZE]; + + sb = sbuf_new(NULL, NULL, sizehint, SBUF_AUTOEXTEND); + errno = 0; + while ((count = read(fd, buffer, sizeof(buffer) - 1)) > 0) { + sbuf_bcat(sb, buffer, count); + } + ATF_REQUIRE_ERRNO(0, count == 0 && "Should have reached EOF"); + sbuf_finish(sb); /* Ensure NULL-termination */ + return (sb); +} + +static struct sbuf * +read_file(const char *filename) +{ + struct stat s; + struct sbuf *result; + int fd; + + errno = 0; + ATF_REQUIRE_EQ_MSG(stat(filename, &s), 0, "cannot stat %s", filename); + fd
svn commit: r366815 - in head: . usr.bin/mkimg/tests
Author: arichardson Date: Sun Oct 18 18:35:23 2020 New Revision: 366815 URL: https://svnweb.freebsd.org/changeset/base/366815 Log: Significantly speed up mkimg_test It turns out that the majority of the test time for the mkimg tests isn't mkimg itself but rather the use of jot and hexdump which can be quite slow on emulated platforms such as QEMU. On QEMU-RISC-V this reduces the time for `kyua test mkimg_test` from 655 seconds to 200. And for CheriBSD on QEMU-CHERI this saves 4-5 hours (25% of the time for the entire testsuite!) since jot ends up triggering slow functions inside the QEMU emulation a lot. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D26796 Modified: head/Makefile.inc1 head/usr.bin/mkimg/tests/Makefile head/usr.bin/mkimg/tests/mkimg_test.sh Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Sun Oct 18 17:31:10 2020(r366814) +++ head/Makefile.inc1 Sun Oct 18 18:35:23 2020(r366815) @@ -2342,6 +2342,8 @@ _other_bootstrap_tools+=tools/build/cross-build/fake_c .endif # mkfifo is used by sys/conf/newvers.sh _basic_bootstrap_tools+=usr.bin/mkfifo +# jot is needed for the mkimg tests +_basic_bootstrap_tools+=usr.bin/jot .if ${MK_BOOT} != "no" # md5 is used by boot/beri (and possibly others) Modified: head/usr.bin/mkimg/tests/Makefile == --- head/usr.bin/mkimg/tests/Makefile Sun Oct 18 17:31:10 2020 (r366814) +++ head/usr.bin/mkimg/tests/Makefile Sun Oct 18 18:35:23 2020 (r366815) @@ -15,9 +15,25 @@ $f: $f.hex sed -e '/^#.*/D' < ${.ALLSRC} > ${.TARGET} .endfor +# Note: Pre-generating this test file saves a lot of time when building on +# emulated platforms such as QEMU. It can take about 2-5 seconds to generate +# the test file using jot (depending on the emulated architecture) and this +# is done for each of the 168 test configurations. +# The effect is even more pronounced on CHERI-RISCV QEMU (emulating CHERI inside +# QEMU adds additional run-time overhead): Running the apm_1x1_512_raw without +# the pre-generated file takes about 108 seconds of which 102 seconds (over 95%) +# were spent running jot -b. It's even worse on CHERI-MIPS QEMU: 187 seconds +# for jot -b P 2097152 > /dev/null. By using a pre-generated 4MB file, the +# slowest test variant (vtoc8_63x255_4096_vhdx) now only takes 29 seconds (of +# which 26s are spent in hexdump -C) instead of previously 2min30s. +${PACKAGE}FILES+= partition_data_4M.bin +partition_data_4M.bin: Makefile + jot -b P 2097152 > ${.TARGET} || rm -f ${.TARGET} + CLEANFILES+= ${${PACKAGE}FILES}} -rebase: .PHONY - (cd ${.CURDIR}; /usr/libexec/atf-sh ${_REBASE_SCRIPT}.sh rebase) +rebase: partition_data_4M.bin ${_REBASE_SCRIPT} .PHONY + cd ${.CURDIR}; PATH=${.OBJDIR}/..:$${PATH}:/usr/bin:/bin \ + /usr/libexec/atf-sh ${.OBJDIR}/${_REBASE_SCRIPT} -s ${.OBJDIR} rebase .include Modified: head/usr.bin/mkimg/tests/mkimg_test.sh == --- head/usr.bin/mkimg/tests/mkimg_test.sh Sun Oct 18 17:31:10 2020 (r366814) +++ head/usr.bin/mkimg/tests/mkimg_test.sh Sun Oct 18 18:35:23 2020 (r366815) @@ -56,7 +56,7 @@ makeimage() if test -z "$partarg"; then local swap ufs swap="-p freebsd-swap::128K" - ufs="-p freebsd-ufs:=`mkcontents P 4194304`" + ufs="-p freebsd-ufs:=$(atf_get_srcdir)/partition_data_4M.bin" partarg="$ufs $swap" fi ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r366850 - in head/lib/googletest: gmock gmock/tests gmock_main gmock_main/tests gtest gtest/tests gtest_main gtest_main/tests tests tests/gmock tests/gmock_main tests/gtest tests/gtest_...
Author: arichardson Date: Mon Oct 19 19:50:57 2020 New Revision: 366850 URL: https://svnweb.freebsd.org/changeset/base/366850 Log: Major improvement to build parallelism for googletest internal tests Currently the googletest internal tests build after the matching library. However, each of these is serialized at the top level makefile. Additionally some of the tests (e.g. the gmock-matches-test) take up to 90 seconds to build with clang -O2. Having to wait for this test to complete before continuing to the next directory seriously slows down the parllelism of a -j32 build. Before this change running `make -C lib/googletest -j32 -s` in buildenv took 202 seconds, now it's 153 due to improved parallelism. Reviewed By: emaste (no objection) Differential Revision: https://reviews.freebsd.org/D26748 Added: head/lib/googletest/tests/Makefile.inc (contents, props changed) head/lib/googletest/tests/gmock/ head/lib/googletest/tests/gmock/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gmock/tests/Makefile head/lib/googletest/tests/gmock_main/ head/lib/googletest/tests/gmock_main/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gmock_main/tests/Makefile head/lib/googletest/tests/gtest/ head/lib/googletest/tests/gtest/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gtest/tests/Makefile head/lib/googletest/tests/gtest_main/ head/lib/googletest/tests/gtest_main/Makefile (contents, props changed) - copied, changed from r366849, head/lib/googletest/gtest_main/tests/Makefile Deleted: head/lib/googletest/gmock/tests/Makefile head/lib/googletest/gmock_main/tests/Makefile head/lib/googletest/gtest/tests/Makefile head/lib/googletest/gtest_main/tests/Makefile Modified: head/lib/googletest/gmock/Makefile head/lib/googletest/gmock_main/Makefile head/lib/googletest/gtest/Makefile head/lib/googletest/gtest_main/Makefile head/lib/googletest/tests/Makefile Modified: head/lib/googletest/gmock/Makefile == --- head/lib/googletest/gmock/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gmock/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -42,7 +42,4 @@ INTERNAL_CUSTOM_INCS+=gmock/internal/custom/gmock-gen SRCS+= gmock-all.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/gmock_main/Makefile == --- head/lib/googletest/gmock_main/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gmock_main/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -19,7 +19,4 @@ LDFLAGS+= -L${LIBGMOCKDIR} SRCS+= gmock_main.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/gtest/Makefile == --- head/lib/googletest/gtest/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gtest/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -47,7 +47,4 @@ SRCS+=gtest-all.cc LIBADD+= pthread regex -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/gtest_main/Makefile == --- head/lib/googletest/gtest_main/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/gtest_main/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -17,7 +17,4 @@ LDFLAGS+= -L${LIBGTESTDIR} SRCS+= gtest_main.cc -HAS_TESTS= -SUBDIR.${MK_TESTS}+= tests - .include Modified: head/lib/googletest/tests/Makefile == --- head/lib/googletest/tests/Makefile Mon Oct 19 19:23:22 2020 (r366849) +++ head/lib/googletest/tests/Makefile Mon Oct 19 19:50:57 2020 (r366850) @@ -3,4 +3,10 @@ .PATH: ${SRCTOP}/tests KYUAFILE= yes +# Note: we start the gmock_main and gmock tests first since those take up to +# 60 seconds to build, so starting them late seriously reduces build parallism. +SUBDIR=gmock_main gmock gtest_main gtest + +SUBDIR_PARALLEL= + .include Added: head/lib/googletest/tests/Makefile.inc == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/googletest/tests/Makefile.inc Mon Oct 19 19:50:57 2020 (r366850) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +.include "../Makefile.inc" +# Keep the existing tests directory structure (with subdirs per component) +# rather than installing all of them to /usr/tests/lib/googletest +TESTSDIR= ${TESTSBASE}/lib/google
svn commit: r366851 - head/lib/googletest
Author: arichardson Date: Mon Oct 19 19:51:03 2020 New Revision: 366851 URL: https://svnweb.freebsd.org/changeset/base/366851 Log: Enable SUBDIR_PARALLEL for lib/googletest This saves a few seconds in a parallel build since we can build the gtest_main and gmock subdirectories in parallel. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D26760 Modified: head/lib/googletest/Makefile Modified: head/lib/googletest/Makefile == --- head/lib/googletest/MakefileMon Oct 19 19:50:57 2020 (r366850) +++ head/lib/googletest/MakefileMon Oct 19 19:51:03 2020 (r366851) @@ -3,12 +3,16 @@ .include SUBDIR+= gtest -SUBDIR+= .WAIT SUBDIR+= gmock -SUBDIR+= .WAIT SUBDIR+= gmock_main SUBDIR+= gtest_main SUBDIR.${MK_TESTS}+= tests + +SUBDIR_DEPEND_gtest_main= gtest +SUBDIR_DEPEND_gmock= gtest +SUBDIR_DEPEND_gmock_main= gmock +SUBDIR_DEPEND_tests= gmock_main +SUBDIR_PARALLEL= .include ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367101 - head/lib/googletest/tests
Author: arichardson Date: Wed Oct 28 11:54:04 2020 New Revision: 367101 URL: https://svnweb.freebsd.org/changeset/base/367101 Log: Significantly reduce compile time for googletest internal tests Clang's optimizer spends a really long time on these tests at -O2, so we now use -O0 instead. This reduces the -j32 time for lib/googletest/test from 131s to 29s. Using -O0 also reduces the disk usage from 144MB (at -O2) / 92MB (at -O1) to 82MB. Reviewed By: ngie, dim Differential Revision: https://reviews.freebsd.org/D26751 Modified: head/lib/googletest/tests/Makefile.inc Modified: head/lib/googletest/tests/Makefile.inc == --- head/lib/googletest/tests/Makefile.inc Wed Oct 28 11:54:00 2020 (r367100) +++ head/lib/googletest/tests/Makefile.inc Wed Oct 28 11:54:04 2020 (r367101) @@ -4,3 +4,15 @@ # Keep the existing tests directory structure (with subdirs per component) # rather than installing all of them to /usr/tests/lib/googletest TESTSDIR= ${TESTSBASE}/lib/googletest/${.CURDIR:T} + +# Clang's optimizer spends a really long time on these tests at -O2. Changing +# -O2 to -O1 reduces the -j32 time for lib/googletest/test from 131s to 71s. +# Using -O0 further reduces the time to 29s, and also reduces the disk usage +# from 144MB (at -O2) / 92MB (at -O1) to 82MB, so we use -O0. +# Note: Building without debug info saves about 10-15% of the build time, so we +# only enable debug info if DEBUG_FLAGS is not empty (71s -> 64s at -O1 and -j32). +CFLAGS.clang+= -O0 +.if empty(DEBUG_FLAGS) +MK_DEBUG_FILES:=no +CFLAGS.clang+= -g0 +.endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367099 - head
Author: arichardson Date: Wed Oct 28 11:53:55 2020 New Revision: 367099 URL: https://svnweb.freebsd.org/changeset/base/367099 Log: clang-format: place sys/systm.h immediately after sys/param.h Should fix one of the objections to r366993. See also https://reviews.freebsd.org/D26981. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D26979 Modified: head/.clang-format (contents, props changed) Modified: head/.clang-format == --- head/.clang-format Wed Oct 28 11:40:10 2020(r367098) +++ head/.clang-format Wed Oct 28 11:53:55 2020(r367099) @@ -102,9 +102,12 @@ IncludeCategories: - Regex: '^' Priority: 2 SortPriority: 22 - - Regex: '^' Priority: 2 SortPriority: 23 + - Regex: '^' Priority: 3 SortPriority: 30 ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367100 - head
Author: arichardson Date: Wed Oct 28 11:54:00 2020 New Revision: 367100 URL: https://svnweb.freebsd.org/changeset/base/367100 Log: clang-format: Avoid breaking after the opening paren of function definitions This depends on https://reviews.llvm.org/D90246 to have any effect, but once that has landed clang-format will no longer format code like this: ``` int myfunction( int param1, int param2, int param2) { ... } ``` and instead create the following: ``` int myfunction(int param1, int param2, int param2) { ... } ``` Reviewed By: emaste, cem Differential Revision: https://reviews.freebsd.org/D26978 Modified: head/.clang-format (contents, props changed) Modified: head/.clang-format == --- head/.clang-format Wed Oct 28 11:53:55 2020(r367099) +++ head/.clang-format Wed Oct 28 11:54:00 2020(r367100) @@ -8,6 +8,7 @@ AlignConsecutiveDeclarations: false AlignEscapedNewlines: Left AlignOperands: false AlignTrailingComments: true +AllowAllArgumentsOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false @@ -24,7 +25,20 @@ BreakBeforeBraces: WebKit BreakBeforeTernaryOperators: false # TODO: BreakStringLiterals can cause very strange formatting so turn it off? BreakStringLiterals: false -PenaltyBreakBeforeFirstCallParameter: 1000 +# Prefer: +# some_var = function(arg1, +#arg2) +# over: +# some_var = +# function(arg1, arg2) +PenaltyBreakAssignment: 100 +# Prefer: +# some_long_function(arg1, arg2 +# arg3) +# over: +# some_long_function( +# arg1, arg2, arg3) +PenaltyBreakBeforeFirstCallParameter: 100 CompactNamespaces: true DerivePointerAlignment: false DisableFormat: false ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367102 - head
Author: arichardson Date: Wed Oct 28 11:54:09 2020 New Revision: 367102 URL: https://svnweb.freebsd.org/changeset/base/367102 Log: Speed up Cirrus CI by using CROSS_TOOLCHAIN Installing the llvm11 package instead of bootstrapping it from the source tree reduces the build time by about 20 minutes. The last freebsd/freebsd build that was tested (r366629) took 1h 21m 22s, whereas my GitHub fork with this .cirrus.yml took 58m 6s. We could probably further reduce time by using images that have LLVM pre-installed: the pkg install step took 4 minutes 30s. Since the bootstrap toolchain is still tested by Jenkins, this should not reduce test coverage of the CI testing. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D26747 Modified: head/.cirrus.yml Modified: head/.cirrus.yml == --- head/.cirrus.ymlWed Oct 28 11:54:04 2020(r367101) +++ head/.cirrus.ymlWed Oct 28 11:54:09 2020(r367102) @@ -1,7 +1,9 @@ # $FreeBSD$ freebsd_instance: - image: freebsd-12-1-release-amd64 + # image: freebsd-12-1-stable-amd64 + # We need a newer image to install llvm11 + image_family: freebsd-12-1-snap cpu: 8 memory: 24G @@ -12,14 +14,14 @@ task: only_if: $CIRRUS_BRANCH != 'svn_head' timeout_in: 120m install_script: - - pkg install -y qemu-devel uefi-edk2-qemu-x86_64 + - pkg install -y qemu-devel uefi-edk2-qemu-x86_64 llvm11 setup_user_script: - pw useradd user - mkdir -p /usr/obj/$(pwd -P) - chown user:user /usr/obj/$(pwd -P) script: - - su user -c "make -j$(sysctl -n hw.ncpu) WITHOUT_TOOLCHAIN=yes buildworld buildkernel" + - su user -c "make -j$(sysctl -n hw.ncpu) CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes buildworld buildkernel" package_script: - - su user -c "make WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" + - su user -c "make CROSS_TOOLCHAIN=llvm11 WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages" test_script: - sh tools/boot/ci-qemu-test.sh ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367331 - head/usr.sbin/jls
Author: arichardson Date: Wed Nov 4 14:31:52 2020 New Revision: 367331 URL: https://svnweb.freebsd.org/changeset/base/367331 Log: Fix bad libbxo format strings in jls The existing format string for the empty case was trying to read varargs values that weren't passed to xo_emit. This appears to work on x86 (since the next argument is probably a pointer an empty string), but for CHERI we can bound variadic arguments and detect a read past the end. While touching these lines also use the libxo 'a' modifier to avoid having to construct the libxo format string using asprintf. Found by: CHERI Reviewed By: allanjude Differential Revision: https://reviews.freebsd.org/D26885 Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c == --- head/usr.sbin/jls/jls.c Wed Nov 4 14:13:29 2020(r367330) +++ head/usr.sbin/jls/jls.c Wed Nov 4 14:31:52 2020(r367331) @@ -505,17 +505,13 @@ quoted_print(int pflags, char *name, char *value) { int qc; char *p = value; - char *param_name_value; /* An empty string needs quoting. */ if (!*p) { - asprintf(¶m_name_value, "{k:%s}{d:%s/\"\"}", name, name); - xo_emit(param_name_value); - free(param_name_value); + xo_emit("{ea:/%s}{da:/\"\"}", name, value, name); return; } - asprintf(¶m_name_value, "{:%s/%%s}", name); /* * The value will be surrounded by quotes if it contains spaces * or quotes. @@ -528,9 +524,7 @@ quoted_print(int pflags, char *name, char *value) if (qc && pflags & PRINT_QUOTED) xo_emit("{P:/%c}", qc); - xo_emit(param_name_value, value); - - free(param_name_value); + xo_emit("{a:/%s}", name, value); if (qc && pflags & PRINT_QUOTED) xo_emit("{P:/%c}", qc); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367636 - head
Author: arichardson Date: Fri Nov 13 13:18:48 2020 New Revision: 367636 URL: https://svnweb.freebsd.org/changeset/base/367636 Log: Makefile.inc1: remove no-longer required variable This variable is unsed since r364760 but I forgot to delete it in that commit. Reported By: bdrewery Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Fri Nov 13 13:07:44 2020(r367635) +++ head/Makefile.inc1 Fri Nov 13 13:18:48 2020(r367636) @@ -2117,11 +2117,6 @@ update: .PHONY # which don't have the APIs required by the targets built in bootstrap-tools, # build-tools or cross-tools. # - -# libnv and libsbuf are requirements for config(8), which is an unconditional -# bootstrap-tool. -_config_deps= lib/libnv lib/libsbuf - legacy: .PHONY .if ${BOOTSTRAPPING} < ${MINIMUM_SUPPORTED_OSREL} && ${BOOTSTRAPPING} != 0 @echo "ERROR: Source upgrades from versions prior to ${MINIMUM_SUPPORTED_REL} are not supported."; \ ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r367720 - head/tools/build
Author: arichardson Date: Mon Nov 16 11:38:51 2020 New Revision: 367720 URL: https://svnweb.freebsd.org/changeset/base/367720 Log: Revert "When building on Ubuntu bootstrap bmake with bash as the default shell" This reverts r365950 since the latest bmake update includes fixes for the test failures that prompted the change. Modified: head/tools/build/make.py Modified: head/tools/build/make.py == --- head/tools/build/make.pyMon Nov 16 10:15:03 2020(r367719) +++ head/tools/build/make.pyMon Nov 16 11:38:51 2020(r367720) @@ -81,14 +81,6 @@ def bootstrap_bmake(source_root, objdir_prefix): "--with-default-sys-path=" + str(bmake_install_dir / "share/mk"), "--with-machine=amd64", # TODO? "--with-machine-arch=amd64", "--without-filemon", "--prefix=" + str(bmake_install_dir)] - -if Path("/bin/sh").resolve().name == "dash": -# Note: we have to avoid using dash as the default shell since it -# filters out variables containing characters such as '-' and that -# breaks the bmake bootstrap tests. -# TODO: remove this when the bootstrap tests have been fixed. -configure_args.append("--with-defshell=/bin/bash") - run(["sh", bmake_source_dir / "boot-strap"] + configure_args, cwd=str(bmake_build_dir), env=env) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368055 - head/contrib/netbsd-tests/lib/libpthread
Author: arichardson Date: Thu Nov 26 13:31:57 2020 New Revision: 368055 URL: https://svnweb.freebsd.org/changeset/base/368055 Log: Significantly speed up libthr/mutex_test and make more reliable Instead of using a simple global++ as the data race, with this change we perform the increment by loading the global, delaying for a bit and then storing back the incremented value. If I move the increment outside of the mutex protected range, I can now see the data race with only 100 iterations on amd64 in almost all cases. Before this change such a racy test almost always passed with < 100,000 iterations and only reliably failed with the current limit of 10 million. I noticed this poorly written test because the mutex:mutex{2,3} and timedmutex:mutex{2,3} tests were always timing out on our CheriBSD Jenkins. Writing good concurrency tests is hard so I won't attempt to do so, but this change should make the test more likely to fail if pthread_mutex_lock is not implemented correctly while also significantly reducing the time it takes to run these four tests. It will also reduce the time it takes for QEMU RISC-V testsuite runs by almost 40 minutes (out of currently 7 hours). Reviewed By: brooks, ngie Differential Revision: https://reviews.freebsd.org/D26473 Modified: head/contrib/netbsd-tests/lib/libpthread/t_mutex.c Modified: head/contrib/netbsd-tests/lib/libpthread/t_mutex.c == --- head/contrib/netbsd-tests/lib/libpthread/t_mutex.c Thu Nov 26 10:17:56 2020(r368054) +++ head/contrib/netbsd-tests/lib/libpthread/t_mutex.c Thu Nov 26 13:31:57 2020(r368055) @@ -35,6 +35,9 @@ __RCSID("$NetBSD: t_mutex.c,v 1.15 2017/01/16 16:23:41 #include /* For UINT16_MAX */ #include #include +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -128,16 +131,41 @@ ATF_TC_BODY(mutex1, tc) PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); } +#ifdef __FreeBSD__ +/* + * Increment the value using a noinline function that includes a small delay + * to increase the window for the RMW data race. + */ +__noinline static int +increment(int value) +{ + for (volatile int i = 0; i < 100; i++) { + /* Small delay between read+write to increase chance of race */ + __compiler_membar(); + } + return value + 1; +} + +static volatile bool thread2_started = false; +#endif + static void * mutex2_threadfunc(void *arg) { long count = *(int *)arg; +#ifdef __FreeBSD__ + thread2_started = true; +#endif printf("2: Second thread (%p). Count is %ld\n", pthread_self(), count); while (count--) { PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); +#ifdef __FreeBSD__ + global_x = increment(global_x); +#else global_x++; +#endif PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); } @@ -153,16 +181,13 @@ ATF_TC_HEAD(mutex2, tc) atf_tc_set_md_var(tc, "timeout", "40"); #endif #endif - -#ifdef __FreeBSD__ -#if defined(__riscv) - atf_tc_set_md_var(tc, "timeout", "600"); -#endif -#endif } ATF_TC_BODY(mutex2, tc) { int count, count2; +#ifdef __FreeBSD__ + int num_increments; +#endif pthread_t new; void *joinval; @@ -177,18 +202,39 @@ ATF_TC_BODY(mutex2, tc) PTHREAD_REQUIRE(pthread_mutex_init(&mutex, NULL)); global_x = 0; +#ifdef __FreeBSD__ + num_increments = count = count2 = 1000; + if (getenv("NUM_ITERATIONS") != NULL) { + num_increments = count = count2 = + MIN(INT_MAX, strtoul(getenv("NUM_ITERATIONS"), NULL, 10)); + } + printf("Will use %d iterations\n", num_increments); +#else count = count2 = 1000; +#endif PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); +#ifdef __FreeBSD__ + thread2_started = false; +#endif PTHREAD_REQUIRE(pthread_create(&new, NULL, mutex2_threadfunc, &count2)); printf("1: Thread %p\n", pthread_self()); - +#ifdef __FreeBSD__ + while (!thread2_started) { + /* Wait for thread 2 to start to increase chance of race */ + } + printf("1: Unlocking to start increment loop %p\n", pthread_self()); +#endif PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); while (count--) { PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); +#ifdef __FreeBSD__ + global_x = increment(global_x); +#else global_x++; +#endif PTHREAD_REQUIRE(pthread_mutex_unlock(&mutex)); } @@ -197,7 +243,14 @@ ATF_TC_BODY(mutex2, tc) PTHREAD_REQUIRE(mutex_lock(&mutex, &ts_lengthy)); printf("1: Thread joined. X was %d. Return value (long) was %ld\n", global_x, (long)joinval); +#ifdef __FreeBSD__ + ATF_REQUIRE_EQ_MSG(count, -1, "%d", count); + ATF_RE
svn commit: r368071 - head/share/mk
Author: arichardson Date: Thu Nov 26 17:37:27 2020 New Revision: 368071 URL: https://svnweb.freebsd.org/changeset/base/368071 Log: bsd.lib.mk: Work around build system raciness We are seeing regular build failures due to libc.so being installed again and another parallel make job tries to read the partially written libc.so at the same time. When building with -j32 or higher this almost always happens on the first clean build (subsequent incremental builds always work fine). Using -S should "fix" the "section header table goes past the end of the file: e_shoff = 0x..." errors that have started to plague our builds. We originally thought this only affected CheriBSD, but I just got the same error while building the latest upstream FreeBSD. The real fix should be to not install libraries twice, but until then this workaround is needed. Original patch by jrtc27@, I only made some minor changes to the comment. Obtained from: CheriBSD (https://github.com/CTSRD-CHERI/cheribsd/commit/49837edd3efd5d02a1b120c47f00cfc2d59a9a8e) Reviewed By: markj, bdrewery Differential Revision: https://reviews.freebsd.org/D27102 Modified: head/share/mk/bsd.lib.mk Modified: head/share/mk/bsd.lib.mk == --- head/share/mk/bsd.lib.mkThu Nov 26 17:37:22 2020(r368070) +++ head/share/mk/bsd.lib.mkThu Nov 26 17:37:27 2020(r368071) @@ -422,7 +422,17 @@ SHLINSTALLFLAGS+= -fschg # Install libraries with -S to avoid risk of modifying in-use libraries when # installing to a running system. It is safe to avoid this for NO_ROOT builds # that are only creating an image. -.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT) +# +# XXX: Since Makefile.inc1 ends up building lib/libc both as part of +# _startup_libs and as part of _generic_libs it ends up getting installed a +# second time during the parallel build, and although the .WAIT in lib/Makefile +# stops that mattering for lib, other directories like secure/lib are built in +# parallel at the top level and are unaffected by that, so can sometimes race +# with the libc.so.7 reinstall and see a missing or corrupt file. Ideally the +# build system would be fixed to not build/install libc to WORLDTMP the second +# time round, but for now using -S ensures the install is atomic and thus we +# never see a broken intermediate state, so use it even for NO_ROOT builds. +.if !defined(NO_SAFE_LIBINSTALL) #&& !defined(NO_ROOT) SHLINSTALLFLAGS+= -S SHLINSTALLSYMLINKFLAGS+= -S .endif ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368070 - head/sys/riscv/include
Author: arichardson Date: Thu Nov 26 17:37:22 2020 New Revision: 368070 URL: https://svnweb.freebsd.org/changeset/base/368070 Log: Add .cfi_{start,end}proc for RISC-V assembly functions This allows GDB to print more useful backtraces when setting a breakpoint on an assembly function. Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D27177 Modified: head/sys/riscv/include/asm.h Modified: head/sys/riscv/include/asm.h == --- head/sys/riscv/include/asm.hThu Nov 26 17:29:16 2020 (r368069) +++ head/sys/riscv/include/asm.hThu Nov 26 17:37:22 2020 (r368070) @@ -47,8 +47,8 @@ #define_C_LABEL(x) x #defineENTRY(sym) \ - .text; .globl sym; .type sym,@function; .align 4; sym: -#defineEND(sym) .size sym, . - sym + .text; .globl sym; .type sym,@function; .align 4; sym: .cfi_startproc; +#defineEND(sym) .cfi_endproc; .size sym, . - sym #defineEENTRY(sym) \ .globl sym; sym: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368337 - in head: . usr.sbin/crunch/crunchgen
Author: arichardson Date: Fri Dec 4 15:53:37 2020 New Revision: 368337 URL: https://svnweb.freebsd.org/changeset/base/368337 Log: crunchgen: fix NULL-deref bug introduced in r364647 While porting over the local changes from CheriBSD for upstreaming, I accidentally committed a broken version of find_entry_point(): we have to return NULL if the value is not found instead of a value with ep->name == NULL, since the checks in main were changed to check ep instead of ep->name for NULL. This only matters if the crunched tool cannot be found using normal lookup and one of the fallback paths is used, so it's unlikely to be triggered in rescue. However, I noticed that one of our CheriBSD test scripts was failing to run commands under `su` on minimal disk images where all binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen. This also updates the bootstrapping check in Makefile.inc1 to bootstrap crunchgen up to the next version bump. Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D27474 Modified: head/Makefile.inc1 head/usr.sbin/crunch/crunchgen/crunched_main.c Modified: head/Makefile.inc1 == --- head/Makefile.inc1 Fri Dec 4 15:50:44 2020(r368336) +++ head/Makefile.inc1 Fri Dec 4 15:53:37 2020(r368337) @@ -2270,7 +2270,7 @@ _bootstrap_tools_links+=crunchide # 1300115: Higher WARNS fixes .if ${BOOTSTRAPPING} < 1202502 || \ - (${BOOTSTRAPPING} > 130 && ${BOOTSTRAPPING} < 1300115) + (${BOOTSTRAPPING} > 130 && ${BOOTSTRAPPING} < 1300131) _crunchgen=usr.sbin/crunch/crunchgen .else _bootstrap_tools_links+=crunchgen Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c == --- head/usr.sbin/crunch/crunchgen/crunched_main.c Fri Dec 4 15:50:44 2020(r368336) +++ head/usr.sbin/crunch/crunchgen/crunched_main.c Fri Dec 4 15:53:37 2020(r368337) @@ -97,9 +97,9 @@ find_entry_point(const char *basename) for (ep = entry_points; ep->name != NULL; ep++) if (!strcmp(basename, ep->name)) - break; + return (ep); - return (ep); + return (NULL); } static const char * ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r368338 - head/tools/build
Author: arichardson Date: Fri Dec 4 15:53:44 2020 New Revision: 368338 URL: https://svnweb.freebsd.org/changeset/base/368338 Log: make.py: Also pass STRIPBIN This is required for cross-building to allow stripping the installed binaries. Submitted By: Henry Vogt Modified: head/tools/build/make.py Modified: head/tools/build/make.py == --- head/tools/build/make.pyFri Dec 4 15:53:37 2020(r368337) +++ head/tools/build/make.pyFri Dec 4 15:53:44 2020(r368338) @@ -219,6 +219,9 @@ if __name__ == "__main__": parsed_args.cross_bindir) check_required_make_env_var("XLD", "ld" if use_cross_gcc else "ld.lld", parsed_args.cross_bindir) +check_required_make_env_var("STRIPBIN", +"strip" if use_cross_gcc else "llvm-strip", +parsed_args.cross_bindir) bmake_binary = bootstrap_bmake(source_root, objdir_prefix) # at -j1 cleandir+obj is unbearably slow. AUTO_OBJ helps a lot ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r355582 - head/share/mk
Author: arichardson Date: Tue Dec 10 12:12:48 2019 New Revision: 355582 URL: https://svnweb.freebsd.org/changeset/base/355582 Log: Use ${.ALLSRC:Ninstalldirs-*} instead of assuming order of .ALLSRC This is a follow-up to https://reviews.freebsd.org/D22382 Suggested By: sjg Modified: head/share/mk/bsd.files.mk Modified: head/share/mk/bsd.files.mk == --- head/share/mk/bsd.files.mk Tue Dec 10 10:35:32 2019(r355581) +++ head/share/mk/bsd.files.mk Tue Dec 10 12:12:48 2019(r355582) @@ -116,7 +116,7 @@ installfiles-${group}: _${group}INS_${file} _${group}INS_${file}: ${file} installdirs-${_${group}DIR_${file}} ${INSTALL} ${${group}TAG_ARGS} -o ${${group}OWN_${file}} \ -g ${${group}GRP_${file}} -m ${${group}MODE_${file}} \ - ${.ALLSRC:[1]} ${${group}PREFIX_${file}}/${${group}NAME_${file}} + ${.ALLSRC:Ninstalldirs-*} ${${group}PREFIX_${file}}/${${group}NAME_${file}} .endfor # file in ${${group}} .endif # defined(${group}) && !empty(${group}) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r356790 - head/usr.bin/mkimg
Author: arichardson Date: Thu Jan 16 14:14:55 2020 New Revision: 356790 URL: https://svnweb.freebsd.org/changeset/base/356790 Log: Allow bootstrapping mkimg on macOS/Linux On these systems the (u)int64_t typedefs will not be implicitly defined by the previous includes, so include in the header that uses uint64_t. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D23202 Modified: head/usr.bin/mkimg/image.h Modified: head/usr.bin/mkimg/image.h == --- head/usr.bin/mkimg/image.h Thu Jan 16 14:14:50 2020(r356789) +++ head/usr.bin/mkimg/image.h Thu Jan 16 14:14:55 2020(r356790) @@ -29,6 +29,8 @@ #ifndef _MKIMG_IMAGE_H_ #define_MKIMG_IMAGE_H_ +#include + typedef int64_t lba_t; int image_copyin(lba_t blk, int fd, uint64_t *sizep); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r356789 - in head/contrib/llvm-project/llvm/lib: MC Object Target/Mips
Author: arichardson Date: Thu Jan 16 14:14:50 2020 New Revision: 356789 URL: https://svnweb.freebsd.org/changeset/base/356789 Log: Merge commit 894f742acb from llvm git (by me): [MIPS][ELF] Use PC-relative relocations in .eh_frame when possible When compiling position-independent executables, we now use DW_EH_PE_pcrel | DW_EH_PE_sdata4. However, the MIPS ABI does not define a 64-bit PC-relative ELF relocation so we cannot use sdata8 for the large code model case. When using the large code model, we fall back to the previous behaviour of generating absolute relocations. With this change clang-generated .o files can be linked by LLD without having to pass -Wl,-z,notext (which creates text relocations). This is simpler than the approach used by ld.bfd, which rewrites the .eh_frame section to convert absolute relocations into relative references. I saw in D13104 that apparently ld.bfd did not accept pc-relative relocations for MIPS ouput at some point. However, I also checked that recent ld.bfd can process the clang-generated .o files so this no longer seems true. Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D72228 Merge commit 8e8ccf47 from llvm git (by me) [MIPS] Don't emit R_(MICRO)MIPS_JALR relocations against data symbols The R_(MICRO)MIPS_JALR optimization only works when used against functions. Using the relocation against a data symbol (e.g. function pointer) will cause some linkers that don't ignore the hint in this case (e.g. LLD prior to commit 5bab291) to generate a relative branch to the data symbol which crashes at run time. Before this patch, LLVM was erroneously emitting these relocations against local-dynamic TLS function pointers and global function pointers with internal visibility. Reviewers: atanasyan, jrtc27, vstefanovic Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D72571 These two changes should allow using lld for MIPS64 (and maybe also MIPS32) by default. The second commit is not strictly necessary for clang+lld since LLD9 will not perform the R_MIPS_JALR optimization (it was only added for 10) but it is probably required in order to use recent ld.bfd. Reviewed By: dim, emaste MFC after:1 week Differential Revision: https://reviews.freebsd.org/D23203 Modified: head/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp head/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp head/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp Modified: head/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp == --- head/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp Thu Jan 16 11:33:15 2020(r356788) +++ head/contrib/llvm-project/llvm/lib/MC/MCObjectFileInfo.cpp Thu Jan 16 14:14:50 2020(r356789) @@ -303,9 +303,14 @@ void MCObjectFileInfo::initELFMCObjectFileInfo(const T case Triple::mipsel: case Triple::mips64: case Triple::mips64el: -FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4 - ? dwarf::DW_EH_PE_sdata4 - : dwarf::DW_EH_PE_sdata8; +// We cannot use DW_EH_PE_sdata8 for the large PositionIndependent case +// since there is no R_MIPS_PC64 relocation (only a 32-bit version). +if (PositionIndependent && !Large) + FDECFIEncoding = dwarf::DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4; +else + FDECFIEncoding = Ctx->getAsmInfo()->getCodePointerSize() == 4 + ? dwarf::DW_EH_PE_sdata4 + : dwarf::DW_EH_PE_sdata8; break; case Triple::ppc64: case Triple::ppc64le: Modified: head/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cpp == --- head/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cppThu Jan 16 11:33:15 2020(r356788) +++ head/contrib/llvm-project/llvm/lib/Object/RelocationResolver.cppThu Jan 16 14:14:50 2020(r356789) @@ -103,6 +103,7 @@ static bool supportsMips64(uint64_t Type) { case ELF::R_MIPS_32: case ELF::R_MIPS_64: case ELF::R_MIPS_TLS_DTPREL64: + case ELF::R_MIPS_PC32: return true; default: return false; @@ -117,6 +118,8 @@ static uint64_t resolveMips64(RelocationRef R, uint64_ return S + getELFAddend(R); case ELF::R_MIPS_TLS_DTPREL64: return S + getELFAddend(R) - 0x8000; + case ELF::R_MIPS_PC32: +return S + getELFAddend(R) - R.getOffset(); default: llvm_unreachable("Invalid relocation type"); } Modified: head/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp == --- head/contrib/llvm-project/llvm/lib/Target/Mips/MipsISelLowering.cpp Thu Jan 1
svn commit: r356791 - head/bin/cat
Author: arichardson Date: Thu Jan 16 14:15:00 2020 New Revision: 356791 URL: https://svnweb.freebsd.org/changeset/base/356791 Log: Allow building bin/cat on non-FreeBSD systems `cat -l` is needed during the installworld phase and other system's cat don't support that flag. To avoid portability issues when compiling on Linux/macOS (such as the the direct access to &fp->_mbstate), we disable the entire multibyte support when building as a boostrap tool. Reviewed By: brooks, emaste Differential Revision: https://reviews.freebsd.org/D13939 Modified: head/bin/cat/Makefile head/bin/cat/cat.c Modified: head/bin/cat/Makefile == --- head/bin/cat/Makefile Thu Jan 16 14:14:55 2020(r356790) +++ head/bin/cat/Makefile Thu Jan 16 14:15:00 2020(r356791) @@ -6,6 +6,12 @@ PACKAGE=runtime PROG= cat +.ifdef BOOTSTRAPPING +# For the bootstrap cat we disable all wide char support to allow building +# on Linux/macOS +CFLAGS+=-DBOOTSTRAP_CAT +.endif + HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Modified: head/bin/cat/cat.c == --- head/bin/cat/cat.c Thu Jan 16 14:14:55 2020(r356790) +++ head/bin/cat/cat.c Thu Jan 16 14:15:00 2020(r356791) @@ -96,6 +96,20 @@ static int udom_open(const char *path, int flags); */ #defineBUFSIZE_SMALL (MAXPHYS) + +/* + * For the bootstrapped cat binary (needed for locked appending to METALOG), we + * disable all flags except -l and -u to avoid non-portable function calls. + * In the future we may instead want to write a small portable bootstrap tool + * that locks the output file before writing to it. However, for now + * bootstrapping cat without multibyte support is the simpler solution. + */ +#ifdef BOOTSTRAP_CAT +#define SUPPORTED_FLAGS "lu" +#else +#define SUPPORTED_FLAGS "belnstuv" +#endif + int main(int argc, char *argv[]) { @@ -104,7 +118,7 @@ main(int argc, char *argv[]) setlocale(LC_CTYPE, ""); - while ((ch = getopt(argc, argv, "belnstuv")) != -1) + while ((ch = getopt(argc, argv, SUPPORTED_FLAGS)) != -1) switch (ch) { case 'b': bflag = nflag = 1; /* -b implies -n */ @@ -158,7 +172,7 @@ static void usage(void) { - fprintf(stderr, "usage: cat [-belnstuv] [file ...]\n"); + fprintf(stderr, "usage: cat [-" SUPPORTED_FLAGS "] [file ...]\n"); exit(1); /* NOTREACHED */ } @@ -187,6 +201,7 @@ scanfiles(char *argv[], int cooked) if (fd < 0) { warn("%s", path); rval = 1; +#ifndef BOOTSTRAP_CAT } else if (cooked) { if (fd == STDIN_FILENO) cook_cat(stdin); @@ -195,6 +210,7 @@ scanfiles(char *argv[], int cooked) cook_cat(fp); fclose(fp); } +#endif } else { raw_cat(fd); if (fd != STDIN_FILENO) @@ -206,6 +222,7 @@ scanfiles(char *argv[], int cooked) } } +#ifndef BOOTSTRAP_CAT static void cook_cat(FILE *fp) { @@ -295,6 +312,7 @@ ilseq: if (ferror(stdout)) err(1, "stdout"); } +#endif /* BOOTSTRAP_CAT */ static void raw_cat(int rfd) ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357170 - head/share/mk
Author: arichardson Date: Mon Jan 27 12:02:47 2020 New Revision: 357170 URL: https://svnweb.freebsd.org/changeset/base/357170 Log: Build hard-float lib32 for mips64hf/mips64elhf This should fix linker errors when building with clang+lld. After this change the lib32 compat libraries are now buildt with -mhard-float instead of -msoft-float Reviewed By: brooks, jhb Differential Revision: https://reviews.freebsd.org/D23229 Modified: head/share/mk/bsd.compat.mk Modified: head/share/mk/bsd.compat.mk == --- head/share/mk/bsd.compat.mk Mon Jan 27 12:02:41 2020(r357169) +++ head/share/mk/bsd.compat.mk Mon Jan 27 12:02:47 2020(r357170) @@ -79,11 +79,10 @@ LIB32CPUFLAGS= -target mips-unknown-freebsd13.0 .endif LIB32CPUFLAGS+= -mabi=32 LIB32_MACHINE= mips +LIB32_MACHINE_ARCH:= ${COMPAT_ARCH:S/64//} .if ${COMPAT_ARCH:Mmips64el*} != "" -LIB32_MACHINE_ARCH=mipsel _EMULATION=elf32ltsmip_fbsd .else -LIB32_MACHINE_ARCH=mips _EMULATION=elf32btsmip_fbsd .endif LIB32WMAKEFLAGS= LD="${XLD} -m ${_EMULATION}" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r357169 - in head: sbin/newfs_msdos sys/fs/msdosfs tools/build usr.sbin/makefs/msdos
Author: arichardson Date: Mon Jan 27 12:02:41 2020 New Revision: 357169 URL: https://svnweb.freebsd.org/changeset/base/357169 Log: Allow bootstrapping makefs on older FreeBSD hosts and Linux/macOS In order to do so we need to install the msdosfs headers to the bootstrap sysroot and avoid includes of kernel headers that may not exist on every host (e.g. sys/lockmgr.h). This change should allow bootstrapping of makefs on FreeBSD 11+ as well as Linux and macOS. We also have to avoid using the IO_SYNC macro since that may not be available. In makefs it is only used to switch between calling bwrite() and bdwrite() which both call the same function. Therefore we can simply always call bwrite(). For our CheriBSD builds we always bootstrap makefs by setting LOCAL_XTOOL_DIRS='lib/libnetbsd usr.sbin/makefs' and use the makefs binary from the build tree to create a bootable disk image. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D23201 Modified: head/sbin/newfs_msdos/mkfs_msdos.c head/sys/fs/msdosfs/msdosfsmount.h head/tools/build/Makefile head/usr.sbin/makefs/msdos/msdosfs_denode.c head/usr.sbin/makefs/msdos/msdosfs_vnops.c Modified: head/sbin/newfs_msdos/mkfs_msdos.c == --- head/sbin/newfs_msdos/mkfs_msdos.c Mon Jan 27 07:03:57 2020 (r357168) +++ head/sbin/newfs_msdos/mkfs_msdos.c Mon Jan 27 12:02:41 2020 (r357169) @@ -31,10 +31,15 @@ static const char rcsid[] = #endif /* not lint */ #include +#ifdef MAKEFS +/* In the makefs case we only want struct disklabel */ +#include +#else #include #include #include #include +#endif #include #include @@ -285,14 +290,18 @@ mkfs_msdos(const char *fname, const char *dtype, const if (!S_ISREG(sb.st_mode)) warnx("warning, %s is not a regular file", fname); } else { -#ifndef MAKEFS +#ifdef MAKEFS + errx(1, "o.create_size must be set!"); +#else if (!S_ISCHR(sb.st_mode)) warnx("warning, %s is not a character device", fname); #endif } +#ifndef MAKEFS if (!o.no_create) if (check_mounted(fname, sb.st_mode) == -1) goto done; +#endif if (o.offset && o.offset != lseek(fd, o.offset, SEEK_SET)) { warnx("cannot seek to %jd", (intmax_t)o.offset); goto done; @@ -621,10 +630,12 @@ mkfs_msdos(const char *fname, const char *dtype, const bpb.bpbBigFATsecs) * bpb.bpbFATs; memset(&si_sa, 0, sizeof(si_sa)); si_sa.sa_handler = infohandler; +#ifdef SIGINFO if (sigaction(SIGINFO, &si_sa, NULL) == -1) { warn("sigaction SIGINFO"); goto done; } +#endif for (lsn = 0; lsn < dir + (fat == 32 ? bpb.bpbSecPerClust : rds); lsn++) { if (got_siginfo) { fprintf(stderr,"%s: writing sector %u of %u (%u%%)\n", @@ -766,6 +777,11 @@ done: static int check_mounted(const char *fname, mode_t mode) { +/* + * If getmntinfo() is not available (e.g. Linux) don't check. This should + * not be a problem since we will only be using makefs to create images. + */ +#if !defined(MAKEFS) struct statfs *mp; const char *s1, *s2; size_t len; @@ -790,6 +806,7 @@ check_mounted(const char *fname, mode_t mode) return -1; } } +#endif return 0; } @@ -811,6 +828,23 @@ getstdfmt(const char *fmt, struct bpb *bpb) return 0; } +static void +compute_geometry_from_file(int fd, const char *fname, struct disklabel *lp) +{ + struct stat st; + off_t ms; + + if (fstat(fd, &st)) + err(1, "cannot get disk size"); + if (!S_ISREG(st.st_mode)) + errx(1, "%s is not a regular file", fname); + ms = st.st_size; + lp->d_secsize = 512; + lp->d_nsectors = 63; + lp->d_ntracks = 255; + lp->d_secperunit = ms / lp->d_secsize; +} + /* * Get disk slice, partition, and geometry information. */ @@ -819,8 +853,10 @@ getdiskinfo(int fd, const char *fname, const char *dty struct bpb *bpb) { struct disklabel *lp, dlp; +off_t hs = 0; +#ifndef MAKEFS +off_t ms; struct fd_type type; -off_t ms, hs = 0; lp = NULL; @@ -832,16 +868,8 @@ getdiskinfo(int fd, const char *fname, const char *dty /* Maybe it's a floppy drive */ if (lp == NULL) { if (ioctl(fd, DIOCGMEDIASIZE, &ms) == -1) { - struct stat st; - - if (fstat(fd, &st)) - err(1, "cannot get disk size"); /* create a fake geometry for a file image */ - ms = st.st_size; - dlp.d_secsize = 512; - dlp.d_nsectors = 63; - dlp.d_ntracks = 255; - dlp.d_secperunit = ms / dlp.d_secsize; + compute_geometry_from_file(fd, fname, &dlp); lp = &dlp; } else if (ioctl(fd, FD_GTYPE, &type) != -1) {