svn commit: r356920 - in projects/clang1000-import: . cddl/contrib/opensolaris/lib/libzfs/common gnu/usr.bin/binutils include lib/libbe lib/libc/stdlib lib/libc/tests/stdlib share/man/man5 share/ma...
Dimitry Andric
dim at FreeBSD.org
Mon Jan 20 17:55:56 UTC 2020
Author: dim
Date: Mon Jan 20 17:55:51 2020
New Revision: 356920
URL: https://svnweb.freebsd.org/changeset/base/356920
Log:
Merge ^/head r356848 through r356919.
Added:
projects/clang1000-import/lib/libc/stdlib/qsort_s.c
- copied unchanged from r356919, head/lib/libc/stdlib/qsort_s.c
projects/clang1000-import/lib/libc/tests/stdlib/qsort_r_test.c
- copied unchanged from r356919, head/lib/libc/tests/stdlib/qsort_r_test.c
projects/clang1000-import/lib/libc/tests/stdlib/qsort_s_test.c
- copied unchanged from r356919, head/lib/libc/tests/stdlib/qsort_s_test.c
projects/clang1000-import/sys/arm/xilinx/zy7_qspi.c
- copied unchanged from r356919, head/sys/arm/xilinx/zy7_qspi.c
projects/clang1000-import/sys/conf/sysent.mk
- copied unchanged from r356919, head/sys/conf/sysent.mk
projects/clang1000-import/sys/powerpc/amigaone/cpld.h
- copied unchanged from r356919, head/sys/powerpc/amigaone/cpld.h
projects/clang1000-import/sys/powerpc/amigaone/cpld_x5000.c
- copied unchanged from r356919, head/sys/powerpc/amigaone/cpld_x5000.c
Deleted:
projects/clang1000-import/tools/build/options/WITHOUT_PC_SYSINSTALL
Modified:
projects/clang1000-import/.cirrus.yml
projects/clang1000-import/Makefile.inc1
projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
projects/clang1000-import/gnu/usr.bin/binutils/Makefile
projects/clang1000-import/include/stdlib.h
projects/clang1000-import/lib/libbe/be_access.c
projects/clang1000-import/lib/libc/stdlib/Makefile.inc
projects/clang1000-import/lib/libc/stdlib/Symbol.map
projects/clang1000-import/lib/libc/stdlib/qsort.3
projects/clang1000-import/lib/libc/stdlib/qsort.c
projects/clang1000-import/lib/libc/tests/stdlib/Makefile
projects/clang1000-import/share/man/man5/src.conf.5
projects/clang1000-import/share/man/man7/hier.7
projects/clang1000-import/share/misc/committers-doc.dot
projects/clang1000-import/share/mk/src.opts.mk
projects/clang1000-import/stand/powerpc/uboot/start.S
projects/clang1000-import/sys/amd64/linux/Makefile
projects/clang1000-import/sys/amd64/linux32/Makefile
projects/clang1000-import/sys/arm/allwinner/a10/a10_padconf.c
projects/clang1000-import/sys/arm/allwinner/a13/a13_padconf.c
projects/clang1000-import/sys/arm/allwinner/a20/a20_padconf.c
projects/clang1000-import/sys/arm/allwinner/a31/a31_padconf.c
projects/clang1000-import/sys/arm/allwinner/a31/a31s_padconf.c
projects/clang1000-import/sys/arm/allwinner/a33/a33_padconf.c
projects/clang1000-import/sys/arm/allwinner/a64/a64_padconf.c
projects/clang1000-import/sys/arm/allwinner/a64/a64_r_padconf.c
projects/clang1000-import/sys/arm/allwinner/a83t/a83t_padconf.c
projects/clang1000-import/sys/arm/allwinner/allwinner_pinctrl.h
projects/clang1000-import/sys/arm/allwinner/aw_gpio.c
projects/clang1000-import/sys/arm/allwinner/h3/h3_padconf.c
projects/clang1000-import/sys/arm/allwinner/h3/h3_r_padconf.c
projects/clang1000-import/sys/arm/allwinner/h6/h6_padconf.c
projects/clang1000-import/sys/arm/allwinner/h6/h6_r_padconf.c
projects/clang1000-import/sys/arm/broadcom/bcm2835/bcm2835_vcbus.c
projects/clang1000-import/sys/arm/conf/GENERIC
projects/clang1000-import/sys/arm/conf/ZEDBOARD
projects/clang1000-import/sys/arm/linux/Makefile
projects/clang1000-import/sys/arm/xilinx/files.zynq7
projects/clang1000-import/sys/arm64/linux/Makefile
projects/clang1000-import/sys/arm64/rockchip/rk805.c
projects/clang1000-import/sys/compat/cloudabi32/Makefile
projects/clang1000-import/sys/compat/cloudabi64/Makefile
projects/clang1000-import/sys/compat/freebsd32/Makefile
projects/clang1000-import/sys/compat/linux/linux_file.c
projects/clang1000-import/sys/compat/linux/linux_file.h
projects/clang1000-import/sys/conf/files.powerpc
projects/clang1000-import/sys/dev/e1000/e1000_api.c
projects/clang1000-import/sys/dev/e1000/e1000_hw.h
projects/clang1000-import/sys/dev/e1000/if_em.c
projects/clang1000-import/sys/dev/flash/mx25lreg.h
projects/clang1000-import/sys/dev/md/md.c
projects/clang1000-import/sys/dev/mps/mps_pci.c
projects/clang1000-import/sys/dts/arm/zedboard.dts
projects/clang1000-import/sys/dts/arm/zybo.dts
projects/clang1000-import/sys/dts/arm/zynq-7000.dtsi
projects/clang1000-import/sys/fs/tmpfs/tmpfs_subr.c
projects/clang1000-import/sys/geom/label/g_label.c
projects/clang1000-import/sys/i386/linux/Makefile
projects/clang1000-import/sys/kern/Makefile
projects/clang1000-import/sys/kern/kern_sendfile.c
projects/clang1000-import/sys/kern/kern_synch.c
projects/clang1000-import/sys/kern/uipc_shm.c
projects/clang1000-import/sys/kern/vfs_cache.c
projects/clang1000-import/sys/kern/vfs_default.c
projects/clang1000-import/sys/kern/vfs_subr.c
projects/clang1000-import/sys/net/if.c
projects/clang1000-import/sys/net80211/ieee80211_amrr.c
projects/clang1000-import/sys/powerpc/aim/aim_machdep.c
projects/clang1000-import/sys/powerpc/aim/mmu_oea64.c
projects/clang1000-import/sys/powerpc/aim/moea64_if.m
projects/clang1000-import/sys/powerpc/aim/trap_subr32.S
projects/clang1000-import/sys/powerpc/aim/trap_subr64.S
projects/clang1000-import/sys/powerpc/booke/pmap.c
projects/clang1000-import/sys/powerpc/include/ofw_machdep.h
projects/clang1000-import/sys/powerpc/include/platform.h
projects/clang1000-import/sys/powerpc/include/trap.h
projects/clang1000-import/sys/powerpc/ofw/ofw_machdep.c
projects/clang1000-import/sys/powerpc/ofw/ofw_pcibus.c
projects/clang1000-import/sys/powerpc/powernv/platform_powernv.c
projects/clang1000-import/sys/powerpc/powerpc/mmu_if.m
projects/clang1000-import/sys/powerpc/powerpc/platform.c
projects/clang1000-import/sys/powerpc/powerpc/platform_if.m
projects/clang1000-import/sys/powerpc/powerpc/sigcode64.S
projects/clang1000-import/sys/sys/refcount.h
projects/clang1000-import/sys/tools/makeobjops.awk
projects/clang1000-import/sys/vm/device_pager.c
projects/clang1000-import/sys/vm/phys_pager.c
projects/clang1000-import/sys/vm/sg_pager.c
projects/clang1000-import/sys/vm/swap_pager.c
projects/clang1000-import/sys/vm/uma_core.c
projects/clang1000-import/sys/vm/vm_fault.c
projects/clang1000-import/sys/vm/vm_object.c
projects/clang1000-import/sys/vm/vm_object.h
projects/clang1000-import/sys/vm/vm_page.c
projects/clang1000-import/sys/vm/vm_pager.c
projects/clang1000-import/sys/vm/vm_swapout.c
projects/clang1000-import/sys/vm/vnode_pager.c
projects/clang1000-import/sys/x86/x86/mp_x86.c
projects/clang1000-import/tools/build/options/WITHOUT_BINUTILS
projects/clang1000-import/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP
projects/clang1000-import/tools/build/options/WITH_BINUTILS
projects/clang1000-import/tools/build/options/WITH_BINUTILS_BOOTSTRAP
projects/clang1000-import/usr.sbin/bsdinstall/partedit/partedit.c
Directory Properties:
projects/clang1000-import/ (props changed)
projects/clang1000-import/cddl/ (props changed)
projects/clang1000-import/cddl/contrib/opensolaris/ (props changed)
projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/ (props changed)
projects/clang1000-import/gnu/usr.bin/binutils/ (props changed)
Modified: projects/clang1000-import/.cirrus.yml
==============================================================================
--- projects/clang1000-import/.cirrus.yml Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/.cirrus.yml Mon Jan 20 17:55:51 2020 (r356920)
@@ -1,7 +1,7 @@
# $FreeBSD$
freebsd_instance:
- image: freebsd-12-0-release-amd64
+ image: freebsd-12-1-release-amd64
cpu: 8
memory: 24G
@@ -14,5 +14,7 @@ task:
- pkg install -y qemu-devel uefi-edk2-qemu-x86_64
script:
- make -j$(sysctl -n hw.ncpu) WITHOUT_TOOLCHAIN=yes buildworld buildkernel
+ package_script:
+ - make WITHOUT_TOOLCHAIN=yes PKG_FORMAT=tar packages
test_script:
- sh tools/boot/ci-qemu-test.sh
Modified: projects/clang1000-import/Makefile.inc1
==============================================================================
--- projects/clang1000-import/Makefile.inc1 Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/Makefile.inc1 Mon Jan 20 17:55:51 2020 (r356920)
@@ -1853,6 +1853,7 @@ PORTSDIR?= /usr/ports
WSTAGEDIR?= ${OBJTOP}/worldstage
KSTAGEDIR?= ${OBJTOP}/kernelstage
REPODIR?= ${OBJROOT}repo
+PKG_FORMAT?= txz
PKGSIGNKEY?= # empty
.ORDER: stage-packages create-packages
@@ -1925,6 +1926,10 @@ create-world-packages: _pkgbootstrap .PHONY
.include "${WSTAGEDIR}/packages.mk"
.endif
+.if make(create-world-packages-jobs) || make(create-kernel-packages*)
+PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI
+.endif
+
create-world-packages-jobs: .PHONY
.for pkgname in ${_PKGS}
create-world-packages-jobs: create-world-package-${pkgname}
@@ -1939,10 +1944,10 @@ create-world-package-${pkgname}: .PHONY
sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
fi
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname -o ALLOW_BASE_SHLIBS=yes \
- create -M ${WSTAGEDIR}/${pkgname}.ucl \
+ create -f ${PKG_FORMAT} -M ${WSTAGEDIR}/${pkgname}.ucl \
-p ${WSTAGEDIR}/${pkgname}.plist \
-r ${WSTAGEDIR} \
- -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION}
+ -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION}
.endfor
_default_flavor= -default
@@ -1971,10 +1976,11 @@ create-kernel-packages-flavor${flavor:C,^""$,${_defaul
/version/ {print $$2; next } ' \
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname -o ALLOW_BASE_SHLIBS=yes \
- create -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
+ create -f ${PKG_FORMAT} \
+ -M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
-p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
-r ${KSTAGEDIR}/${DISTDIR} \
- -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION}
+ -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION}
. endfor
.endif
.if ${BUILDKERNELS:[#]} > 1 && ${NO_INSTALLEXTRAKERNELS} != "yes"
@@ -2003,19 +2009,22 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_
/version/ {print $$2; next } ' \
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname -o ALLOW_BASE_SHLIBS=yes \
- create -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
+ create -f ${PKG_FORMAT} \
+ -M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
-p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
-r ${KSTAGEDIR}/kernel.${_kernel} \
- -o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION}
+ -o ${REPODIR}/${PKG_ABI}/${PKG_VERSION}
. endfor
. endif
. endfor
.endif
sign-packages: _pkgbootstrap .PHONY
+ printf "version = 2;\npacking_format = \"${PKG_FORMAT}\";\n" > ${WSTAGEDIR}/meta
@[ -L "${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest" ] && \
unlink ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/latest ; \
${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname repo \
+ -m ${WSTAGEDIR}/meta \
-o ${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION} \
${REPODIR}/$$(${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI)/${PKG_VERSION} \
${PKGSIGNKEY} ; \
Modified: projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==============================================================================
--- projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Jan 20 17:55:51 2020 (r356920)
@@ -769,6 +769,7 @@ extern ulong_t get_system_hostid(void);
extern boolean_t is_mounted(libzfs_handle_t *, const char *special, char **);
extern boolean_t zfs_is_mounted(zfs_handle_t *, char **);
extern int zfs_mount(zfs_handle_t *, const char *, int);
+extern int zfs_mount_at(zfs_handle_t *, const char *, int, const char *);
extern int zfs_unmount(zfs_handle_t *, const char *, int);
extern int zfs_unmountall(zfs_handle_t *, int);
Modified: projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
==============================================================================
--- projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Mon Jan 20 17:55:51 2020 (r356920)
@@ -301,6 +301,17 @@ zfs_is_mounted(zfs_handle_t *zhp, char **where)
return (is_mounted(zhp->zfs_hdl, zfs_get_name(zhp), where));
}
+static boolean_t
+zfs_is_mountable_internal(zfs_handle_t *zhp, const char *mountpoint)
+{
+
+ if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED) &&
+ getzoneid() == GLOBAL_ZONEID)
+ return (B_FALSE);
+
+ return (B_TRUE);
+}
+
/*
* Returns true if the given dataset is mountable, false otherwise. Returns the
* mountpoint in 'buf'.
@@ -325,8 +336,7 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t
if (zfs_prop_get_int(zhp, ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_OFF)
return (B_FALSE);
- if (zfs_prop_get_int(zhp, ZFS_PROP_ZONED) &&
- getzoneid() == GLOBAL_ZONEID)
+ if (!zfs_is_mountable_internal(zhp, buf))
return (B_FALSE);
if (source)
@@ -341,8 +351,19 @@ zfs_is_mountable(zfs_handle_t *zhp, char *buf, size_t
int
zfs_mount(zfs_handle_t *zhp, const char *options, int flags)
{
- struct stat buf;
char mountpoint[ZFS_MAXPROPLEN];
+
+ if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
+ return (0);
+
+ return (zfs_mount_at(zhp, options, flags, mountpoint));
+}
+
+int
+zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
+ const char *mountpoint)
+{
+ struct stat buf;
char mntopts[MNT_LINE_MAX];
libzfs_handle_t *hdl = zhp->zfs_hdl;
@@ -357,8 +378,8 @@ zfs_mount(zfs_handle_t *zhp, const char *options, int
if (zpool_get_prop_int(zhp->zpool_hdl, ZPOOL_PROP_READONLY, NULL))
flags |= MS_RDONLY;
- if (!zfs_is_mountable(zhp, mountpoint, sizeof (mountpoint), NULL))
- return (0);
+ if (!zfs_is_mountable_internal(zhp, mountpoint))
+ return (B_FALSE);
/* Create the directory if it doesn't already exist */
if (lstat(mountpoint, &buf) != 0) {
Modified: projects/clang1000-import/gnu/usr.bin/binutils/Makefile
==============================================================================
--- projects/clang1000-import/gnu/usr.bin/binutils/Makefile Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/gnu/usr.bin/binutils/Makefile Mon Jan 20 17:55:51 2020 (r356920)
@@ -8,8 +8,14 @@ SUBDIR= libiberty \
SUBDIR.${MK_BINUTILS}+= doc
SUBDIR.${MK_BINUTILS}+= libbinutils
-SUBDIR.${MK_BINUTILS}+= as
SUBDIR.${MK_BINUTILS}+= objdump
+
+# GNU as is used on x86 only, for a few files that cannot be assembled by
+# Clang IAS. Other archs either use Clang IAS for every assembly file, or
+# use external toolchain.
+.if ${TARGET} == "amd64" || ${TARGET} == "i386"
+SUBDIR.${MK_BINUTILS}+= as
+.endif
# All archs except powerpc either use lld or require external toolchain.
# powerpc still needs binutils ld to link 32-bit binaries.
Modified: projects/clang1000-import/include/stdlib.h
==============================================================================
--- projects/clang1000-import/include/stdlib.h Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/include/stdlib.h Mon Jan 20 17:55:51 2020 (r356920)
@@ -324,6 +324,11 @@ extern char *suboptarg; /* getsubopt(3) external var
#if __EXT1_VISIBLE
+#ifndef _RSIZE_T_DEFINED
+#define _RSIZE_T_DEFINED
+typedef size_t rsize_t;
+#endif
+
#ifndef _ERRNO_T_DEFINED
#define _ERRNO_T_DEFINED
typedef int errno_t;
@@ -339,6 +344,9 @@ _Noreturn void abort_handler_s(const char * __restrict
errno_t);
/* K3.6.1.3 */
void ignore_handler_s(const char * __restrict, void * __restrict, errno_t);
+/* K.3.6.3.2 */
+errno_t qsort_s(void *, rsize_t, rsize_t,
+ int (*)(const void *, const void *, void *), void *);
#endif /* __EXT1_VISIBLE */
__END_DECLS
Modified: projects/clang1000-import/lib/libbe/be_access.c
==============================================================================
--- projects/clang1000-import/lib/libbe/be_access.c Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/lib/libbe/be_access.c Mon Jan 20 17:55:51 2020 (r356920)
@@ -82,7 +82,6 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data)
char *mountpoint;
char tmp[BE_MAXPATHLEN], zfs_mnt[BE_MAXPATHLEN];
struct be_mount_info *info;
- char opt;
info = (struct be_mount_info *)data;
@@ -121,9 +120,7 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data)
mountpoint);
}
- opt = '\0';
- if ((err = zmount(zfs_get_name(zfs_hdl), tmp, info->mntflags,
- __DECONST(char *, MNTTYPE_ZFS), NULL, 0, &opt, 1)) != 0) {
+ if ((err = zfs_mount_at(zfs_hdl, NULL, info->mntflags, tmp)) != 0) {
switch (errno) {
case ENAMETOOLONG:
return (set_error(info->lbh, BE_ERR_PATHLEN));
Modified: projects/clang1000-import/lib/libc/stdlib/Makefile.inc
==============================================================================
--- projects/clang1000-import/lib/libc/stdlib/Makefile.inc Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/lib/libc/stdlib/Makefile.inc Mon Jan 20 17:55:51 2020 (r356920)
@@ -11,8 +11,8 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.
getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \
hsearch_r.c imaxabs.c imaxdiv.c \
insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \
- merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c quick_exit.c \
- radixsort.c rand.c \
+ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c qsort_s.c \
+ quick_exit.c radixsort.c rand.c \
random.c reallocarray.c reallocf.c realpath.c remque.c \
set_constraint_handler_s.c strfmon.c strtoimax.c \
strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \
@@ -51,7 +51,8 @@ MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 h
MLINKS+=insque.3 remque.3
MLINKS+=lsearch.3 lfind.3
MLINKS+=ptsname.3 grantpt.3 ptsname.3 unlockpt.3
-MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 qsort.3 qsort_r.3
+MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 qsort.3 qsort_r.3 \
+ qsort.3 qsort_s.3
MLINKS+=rand.3 rand_r.3 rand.3 srand.3
MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \
random.3 srandomdev.3
Modified: projects/clang1000-import/lib/libc/stdlib/Symbol.map
==============================================================================
--- projects/clang1000-import/lib/libc/stdlib/Symbol.map Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/lib/libc/stdlib/Symbol.map Mon Jan 20 17:55:51 2020 (r356920)
@@ -123,6 +123,10 @@ FBSD_1.5 {
set_constraint_handler_s;
};
+FBSD_1.6 {
+ qsort_s;
+};
+
FBSDprivate_1.0 {
__system;
_system;
Modified: projects/clang1000-import/lib/libc/stdlib/qsort.3
==============================================================================
--- projects/clang1000-import/lib/libc/stdlib/qsort.3 Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/lib/libc/stdlib/qsort.3 Mon Jan 20 17:55:51 2020 (r356920)
@@ -32,7 +32,7 @@
.\" @(#)qsort.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd February 20, 2013
+.Dd January 14, 2020
.Dt QSORT 3
.Os
.Sh NAME
@@ -98,6 +98,15 @@
.Fa "size_t size"
.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
.Fc
+.Fd #define __STDC_WANT_LIB_EXT1__ 1
+.Ft errno_t
+.Fo qsort_s
+.Fa "void *base"
+.Fa "rsize_t nmemb"
+.Fa "rsize_t size"
+.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *, void *\*[rp]"
+.Fa "void *thunk"
+.Fc
.Sh DESCRIPTION
The
.Fn qsort
@@ -238,6 +247,36 @@ is faster than
.Fn heapsort .
Memory availability and pre-existing order in the data can make this
untrue.
+.Pp
+The
+.Fn qsort_s
+function behaves the same as
+.Fn qsort_r , except that:
+.Bl -dash
+.It
+The order of arguments is different
+.It
+The order of arguments to
+.Fa compar
+is different
+.It
+if
+.Fa nmemb
+or
+.Fa size
+are greater than
+.Dv RSIZE_MAX ,
+or
+.Fa nmemb
+is not zero and
+.Fa compar
+is NULL, then the runtime-constraint handler is called, and
+.Fn qsort_s
+returns an error.
+Note that the handler is called before
+.Fn qsort_s
+returns the error, and the handler function might not return.
+.El
.Sh RETURN VALUES
The
.Fn qsort
@@ -245,6 +284,9 @@ and
.Fn qsort_r
functions
return no value.
+The
+.Fn qsort_s
+function returns zero on success, non-zero on error.
.Pp
.Rv -std heapsort mergesort
.Sh EXAMPLES
@@ -288,6 +330,19 @@ main(void)
}
.Ed
.Sh COMPATIBILITY
+The order of arguments for the comparison function used with
+.Fn qsort_r
+is different from the one used by
+.Fn qsort_s ,
+and the GNU libc implementation of
+.Fn qsort_r .
+When porting software written for GNU libc, it is usually possible
+to replace
+.Fn qsort_r
+with
+.Fn qsort_s
+to work around this problem.
+.Pp
Previous versions of
.Fn qsort
did not permit the comparison routine itself to call
@@ -366,6 +421,10 @@ The
function
conforms to
.St -isoC .
+.Fn qsort_s
+conforms to
+.St -isoC-2011
+K.3.6.3.2.
.Sh HISTORY
The variants of these functions that take blocks as arguments first appeared in
Mac OS X.
Modified: projects/clang1000-import/lib/libc/stdlib/qsort.c
==============================================================================
--- projects/clang1000-import/lib/libc/stdlib/qsort.c Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/lib/libc/stdlib/qsort.c Mon Jan 20 17:55:51 2020 (r356920)
@@ -35,10 +35,16 @@ static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include <errno.h>
+#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
+#include "libc_private.h"
-#ifdef I_AM_QSORT_R
+#if defined(I_AM_QSORT_R)
typedef int cmp_t(void *, const void *, const void *);
+#elif defined(I_AM_QSORT_S)
+typedef int cmp_t(const void *, const void *, void *);
#else
typedef int cmp_t(const void *, const void *);
#endif
@@ -65,15 +71,17 @@ swapfunc(char *a, char *b, size_t es)
#define vecswap(a, b, n) \
if ((n) > 0) swapfunc(a, b, n)
-#ifdef I_AM_QSORT_R
+#if defined(I_AM_QSORT_R)
#define CMP(t, x, y) (cmp((t), (x), (y)))
+#elif defined(I_AM_QSORT_S)
+#define CMP(t, x, y) (cmp((x), (y), (t)))
#else
#define CMP(t, x, y) (cmp((x), (y)))
#endif
static inline char *
med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk
-#ifndef I_AM_QSORT_R
+#if !defined(I_AM_QSORT_R) && !defined(I_AM_QSORT_S)
__unused
#endif
)
@@ -83,9 +91,12 @@ __unused
:(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c ));
}
-#ifdef I_AM_QSORT_R
+#if defined(I_AM_QSORT_R)
void
qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+#elif defined(I_AM_QSORT_S)
+errno_t
+qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk)
#else
#define thunk NULL
void
@@ -97,6 +108,24 @@ qsort(void *a, size_t n, size_t es, cmp_t *cmp)
int cmp_result;
int swap_cnt;
+#ifdef I_AM_QSORT_S
+ if (n > RSIZE_MAX) {
+ __throw_constraint_handler_s("qsort_s : n > RSIZE_MAX", EINVAL);
+ return (EINVAL);
+ } else if (es > RSIZE_MAX) {
+ __throw_constraint_handler_s("qsort_s : es > RSIZE_MAX", EINVAL);
+ return (EINVAL);
+ } else if (n != 0) {
+ if (a == NULL) {
+ __throw_constraint_handler_s("qsort_s : a == NULL", EINVAL);
+ return (EINVAL);
+ } else if (cmp == NULL) {
+ __throw_constraint_handler_s("qsort_s : cmp == NULL", EINVAL);
+ return (EINVAL);
+ }
+ }
+#endif
+
loop:
swap_cnt = 0;
if (n < 7) {
@@ -105,7 +134,11 @@ loop:
pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
pl -= es)
swapfunc(pl, pl - es, es);
+#ifdef I_AM_QSORT_S
+ return (0);
+#else
return;
+#endif
}
pm = (char *)a + (n / 2) * es;
if (n > 7) {
@@ -154,7 +187,11 @@ loop:
pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
pl -= es)
swapfunc(pl, pl - es, es);
+#ifdef I_AM_QSORT_S
+ return (0);
+#else
return;
+#endif
}
pn = (char *)a + n * es;
@@ -168,8 +205,10 @@ loop:
if (d1 <= d2) {
/* Recurse on left partition, then iterate on right partition */
if (d1 > es) {
-#ifdef I_AM_QSORT_R
+#if defined(I_AM_QSORT_R)
qsort_r(a, d1 / es, es, thunk, cmp);
+#elif defined(I_AM_QSORT_S)
+ qsort_s(a, d1 / es, es, cmp, thunk);
#else
qsort(a, d1 / es, es, cmp);
#endif
@@ -184,8 +223,10 @@ loop:
} else {
/* Recurse on right partition, then iterate on left partition */
if (d2 > es) {
-#ifdef I_AM_QSORT_R
+#if defined(I_AM_QSORT_R)
qsort_r(pn - d2, d2 / es, es, thunk, cmp);
+#elif defined(I_AM_QSORT_S)
+ qsort_s(pn - d2, d2 / es, es, cmp, thunk);
#else
qsort(pn - d2, d2 / es, es, cmp);
#endif
@@ -197,4 +238,8 @@ loop:
goto loop;
}
}
+
+#ifdef I_AM_QSORT_S
+ return (0);
+#endif
}
Copied: projects/clang1000-import/lib/libc/stdlib/qsort_s.c (from r356919, head/lib/libc/stdlib/qsort_s.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/clang1000-import/lib/libc/stdlib/qsort_s.c Mon Jan 20 17:55:51 2020 (r356920, copy of r356919, head/lib/libc/stdlib/qsort_s.c)
@@ -0,0 +1,8 @@
+/*
+ * This file is in the public domain. Originally written by Garrett
+ * A. Wollman.
+ *
+ * $FreeBSD$
+ */
+#define I_AM_QSORT_S
+#include "qsort.c"
Modified: projects/clang1000-import/lib/libc/tests/stdlib/Makefile
==============================================================================
--- projects/clang1000-import/lib/libc/tests/stdlib/Makefile Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/lib/libc/tests/stdlib/Makefile Mon Jan 20 17:55:51 2020 (r356920)
@@ -6,6 +6,8 @@ ATF_TESTS_C+= dynthr_test
ATF_TESTS_C+= heapsort_test
ATF_TESTS_C+= mergesort_test
ATF_TESTS_C+= qsort_test
+ATF_TESTS_C+= qsort_r_test
+ATF_TESTS_C+= qsort_s_test
ATF_TESTS_C+= set_constraint_handler_s_test
ATF_TESTS_C+= strfmon_test
ATF_TESTS_C+= tsearch_test
Copied: projects/clang1000-import/lib/libc/tests/stdlib/qsort_r_test.c (from r356919, head/lib/libc/tests/stdlib/qsort_r_test.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/clang1000-import/lib/libc/tests/stdlib/qsort_r_test.c Mon Jan 20 17:55:51 2020 (r356920, copy of r356919, head/lib/libc/tests/stdlib/qsort_r_test.c)
@@ -0,0 +1,92 @@
+/*-
+ * Copyright (C) 2020 Edward Tomasz Napierala <trasz at FreeBSD.org>
+ * Copyright (C) 2004 Maxim Sobolev <sobomax at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * Test for qsort_r(3) routine.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "test-sort.h"
+
+#define THUNK 42
+
+static int
+sorthelp_r(void *thunk, const void *a, const void *b)
+{
+ const int *oa, *ob;
+
+ ATF_REQUIRE_EQ(*(int *)thunk, THUNK);
+
+ oa = a;
+ ob = b;
+ /* Don't use "return *oa - *ob" since it's easy to cause overflow! */
+ if (*oa > *ob)
+ return (1);
+ if (*oa < *ob)
+ return (-1);
+ return (0);
+}
+
+ATF_TC_WITHOUT_HEAD(qsort_r_test);
+ATF_TC_BODY(qsort_r_test, tc)
+{
+ int testvector[IVEC_LEN];
+ int sresvector[IVEC_LEN];
+ int i, j;
+ int thunk = THUNK;
+
+ for (j = 2; j < IVEC_LEN; j++) {
+ /* Populate test vectors */
+ for (i = 0; i < j; i++)
+ testvector[i] = sresvector[i] = initvector[i];
+
+ /* Sort using qsort_r(3) */
+ qsort_r(testvector, j, sizeof(testvector[0]), &thunk,
+ sorthelp_r);
+ /* Sort using reference slow sorting routine */
+ ssort(sresvector, j);
+
+ /* Compare results */
+ for (i = 0; i < j; i++)
+ ATF_CHECK_MSG(testvector[i] == sresvector[i],
+ "item at index %d didn't match: %d != %d",
+ i, testvector[i], sresvector[i]);
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, qsort_r_test);
+
+ return (atf_no_error());
+}
Copied: projects/clang1000-import/lib/libc/tests/stdlib/qsort_s_test.c (from r356919, head/lib/libc/tests/stdlib/qsort_s_test.c)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/clang1000-import/lib/libc/tests/stdlib/qsort_s_test.c Mon Jan 20 17:55:51 2020 (r356920, copy of r356919, head/lib/libc/tests/stdlib/qsort_s_test.c)
@@ -0,0 +1,257 @@
+/*-
+ * Copyright (C) 2020 Edward Tomasz Napierala <trasz at FreeBSD.org>
+ * Copyright (c) 2017 Juniper Networks. All rights reserved.
+ * Copyright (C) 2004 Maxim Sobolev <sobomax at FreeBSD.org>
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * Test for qsort_s(3) routine.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define THUNK 42
+
+#include "test-sort.h"
+
+static errno_t e;
+
+static int
+sorthelp_s(const void *a, const void *b, void *thunk)
+{
+ const int *oa, *ob;
+
+ ATF_REQUIRE_EQ(*(int *)thunk, THUNK);
+
+ oa = a;
+ ob = b;
+ /* Don't use "return *oa - *ob" since it's easy to cause overflow! */
+ if (*oa > *ob)
+ return (1);
+ if (*oa < *ob)
+ return (-1);
+ return (0);
+}
+
+void
+h(const char * restrict msg __unused, void * restrict ptr __unused, errno_t error)
+{
+ e = error;
+}
+
+/* nmemb < 0 */
+ATF_TC_WITHOUT_HEAD(qsort_s_nmemb_lt_zero);
+ATF_TC_BODY(qsort_s_nmemb_lt_zero, tc)
+{
+ int thunk = THUNK;
+ int b;
+
+ ATF_CHECK(qsort_s(&b, -1, sizeof(int), sorthelp_s, &thunk) != 0);
+}
+
+/* nmemb > rmax */
+ATF_TC_WITHOUT_HEAD(qsort_s_nmemb_gt_rmax);
+ATF_TC_BODY(qsort_s_nmemb_gt_rmax, tc)
+{
+ int thunk = THUNK;
+ int b;
+
+ ATF_CHECK(qsort_s(&b, RSIZE_MAX + 1, sizeof(int), sorthelp_s, &thunk) != 0);
+}
+
+/* size < 0 */
+ATF_TC_WITHOUT_HEAD(qsort_s_size_lt_zero);
+ATF_TC_BODY(qsort_s_size_lt_zero, tc)
+{
+ int thunk = THUNK;
+ int b;
+
+ ATF_CHECK(qsort_s(&b, 1, -1, sorthelp_s, &thunk) != 0);
+}
+
+/* size > rmax */
+ATF_TC_WITHOUT_HEAD(qsort_s_size_gt_rmax);
+ATF_TC_BODY(qsort_s_size_gt_rmax, tc)
+{
+ int thunk = THUNK;
+ int b;
+
+ ATF_CHECK(qsort_s(&b, 1, RSIZE_MAX + 1, sorthelp_s, &thunk) != 0);
+}
+
+/* NULL compar */
+ATF_TC_WITHOUT_HEAD(qsort_s_null_compar);
+ATF_TC_BODY(qsort_s_null_compar, tc)
+{
+ int thunk = THUNK;
+ int b;
+
+ ATF_CHECK(qsort_s(&b, 1, sizeof(int), NULL, &thunk) != 0);
+}
+
+/* nmemb < 0, handler */
+ATF_TC_WITHOUT_HEAD(qsort_s_nmemb_lt_zero_h);
+ATF_TC_BODY(qsort_s_nmemb_lt_zero_h, tc)
+{
+ int thunk = THUNK;
+ int b[] = {81, 4, 7};
+
+ e = 0;
+ set_constraint_handler_s(h);
+ ATF_CHECK(qsort_s(&b, -1, sizeof(int), sorthelp_s, &thunk) != 0);
+ ATF_CHECK(e > 0);
+ ATF_CHECK_EQ(b[0], 81);
+ ATF_CHECK_EQ(b[1], 4);
+ ATF_CHECK_EQ(b[2], 7);
+}
+
+/* nmemb > rmax, handler */
+ATF_TC_WITHOUT_HEAD(qsort_s_nmemb_gt_rmax_h);
+ATF_TC_BODY(qsort_s_nmemb_gt_rmax_h, tc)
+{
+ int thunk = THUNK;
+ int b[] = {81, 4, 7};
+
+ e = 0;
+ set_constraint_handler_s(h);
+ ATF_CHECK(qsort_s(&b, RSIZE_MAX + 1, sizeof(int), sorthelp_s, &thunk) != 0);
+ ATF_CHECK(e > 0);
+ ATF_CHECK_EQ(b[0], 81);
+ ATF_CHECK_EQ(b[1], 4);
+ ATF_CHECK_EQ(b[2], 7);
+}
+
+/* size < 0, handler */
+ATF_TC_WITHOUT_HEAD(qsort_s_size_lt_zero_h);
+ATF_TC_BODY(qsort_s_size_lt_zero_h, tc)
+{
+ int thunk = THUNK;
+ int b[] = {81, 4, 7};
+
+ e = 0;
+ set_constraint_handler_s(h);
+ ATF_CHECK(qsort_s(&b, nitems(b), -1, sorthelp_s, &thunk) != 0);
+ ATF_CHECK(e > 0);
+ ATF_CHECK_EQ(b[0], 81);
+ ATF_CHECK_EQ(b[1], 4);
+ ATF_CHECK_EQ(b[2], 7);
+}
+
+/* size > rmax, handler */
+ATF_TC_WITHOUT_HEAD(qsort_s_size_gt_rmax_h);
+ATF_TC_BODY(qsort_s_size_gt_rmax_h, tc)
+{
+ int thunk = THUNK;
+ int b[] = {81, 4, 7};
+
+ e = 0;
+ set_constraint_handler_s(h);
+ ATF_CHECK(qsort_s(&b, nitems(b), RSIZE_MAX + 1, sorthelp_s, &thunk) != 0);
+ ATF_CHECK(e > 0);
+ ATF_CHECK_EQ(b[0], 81);
+ ATF_CHECK_EQ(b[1], 4);
+ ATF_CHECK_EQ(b[2], 7);
+}
+
+/* NULL compar, handler */
+ATF_TC_WITHOUT_HEAD(qsort_s_null_compar_h);
+ATF_TC_BODY(qsort_s_null_compar_h, tc)
+{
+ int thunk = THUNK;
+ int b[] = {81, 4, 7};
+
+ e = 0;
+ set_constraint_handler_s(h);
+ ATF_CHECK(qsort_s(&b, nitems(b), sizeof(int), NULL, &thunk) != 0);
+ ATF_CHECK(e > 0);
+ ATF_CHECK_EQ(b[0], 81);
+ ATF_CHECK_EQ(b[1], 4);
+ ATF_CHECK_EQ(b[2], 7);
+}
+
+ATF_TC_WITHOUT_HEAD(qsort_s_h);
+ATF_TC_BODY(qsort_s_h, tc)
+{
+ int thunk = THUNK;
+ int b[] = {81, 4, 7};
+
+ e = 0;
+ set_constraint_handler_s(h);
+ ATF_CHECK(qsort_s(&b, nitems(b), sizeof(int), sorthelp_s, &thunk) == 0);
+ ATF_CHECK(e == 0);
+ ATF_CHECK_EQ(b[0], 4);
+ ATF_CHECK_EQ(b[1], 7);
+ ATF_CHECK_EQ(b[2], 81);
+}
+
+ATF_TC_WITHOUT_HEAD(qsort_s_test);
+ATF_TC_BODY(qsort_s_test, tc)
+{
+ int testvector[IVEC_LEN];
+ int sresvector[IVEC_LEN];
+ int i, j;
+ int thunk = THUNK;
+
+ for (j = 2; j < IVEC_LEN; j++) {
+ /* Populate test vectors */
+ for (i = 0; i < j; i++)
+ testvector[i] = sresvector[i] = initvector[i];
+
+ /* Sort using qsort_s(3) */
+ qsort_s(testvector, j, sizeof(testvector[0]),
+ sorthelp_s, &thunk);
+ /* Sort using reference slow sorting routine */
+ ssort(sresvector, j);
+
+ /* Compare results */
+ for (i = 0; i < j; i++)
+ ATF_CHECK_MSG(testvector[i] == sresvector[i],
+ "item at index %d didn't match: %d != %d",
+ i, testvector[i], sresvector[i]);
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, qsort_s_nmemb_lt_zero);
+ ATF_TP_ADD_TC(tp, qsort_s_nmemb_gt_rmax);
+ ATF_TP_ADD_TC(tp, qsort_s_size_lt_zero);
+ ATF_TP_ADD_TC(tp, qsort_s_size_gt_rmax);
+ ATF_TP_ADD_TC(tp, qsort_s_null_compar);
+ ATF_TP_ADD_TC(tp, qsort_s_nmemb_lt_zero_h);
+ ATF_TP_ADD_TC(tp, qsort_s_nmemb_gt_rmax_h);
+ ATF_TP_ADD_TC(tp, qsort_s_size_lt_zero_h);
+ ATF_TP_ADD_TC(tp, qsort_s_size_gt_rmax_h);
+ ATF_TP_ADD_TC(tp, qsort_s_null_compar_h);
+ ATF_TP_ADD_TC(tp, qsort_s_h);
+ ATF_TP_ADD_TC(tp, qsort_s_test);
+
+ return (atf_no_error());
+}
Modified: projects/clang1000-import/share/man/man5/src.conf.5
==============================================================================
--- projects/clang1000-import/share/man/man5/src.conf.5 Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/share/man/man5/src.conf.5 Mon Jan 20 17:55:51 2020 (r356920)
@@ -1,6 +1,6 @@
.\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
.\" $FreeBSD$
-.Dd January 17, 2020
+.Dd January 19, 2020
.Dt SRC.CONF 5
.Os
.Sh NAME
@@ -185,37 +185,32 @@ Do not build or install GNU
.Xr objdump 1
as part
of the normal system build.
-The resulting system cannot build programs from source.
.Pp
This is a default setting on
arm64/aarch64, riscv/riscv64 and riscv/riscv64sf.
.It Va WITH_BINUTILS
-Set to build and install GNU
-.Xr as 1 ,
+Build and install GNU
+.Xr as 1
+on i386 and amd64,
.Xr objdump 1 ,
-and, on powerpc,
+and
.Xr ld.bfd 1
-as part
-of the normal system build.
+on powerpc as part of the normal system build.
.Pp
This is a default setting on
amd64/amd64, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64.
.It Va WITHOUT_BINUTILS_BOOTSTRAP
Do not build binutils (as, ld.bfd, and objdump)
as part of the bootstrap process.
-.Bf -symbolic
-The option does not work for build targets unless some alternative
-toolchain is provided.
-.Ef
.Pp
This is a default setting on
-arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64.
+arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, riscv/riscv64, riscv/riscv64sf and sparc64/sparc64.
.It Va WITH_BINUTILS_BOOTSTRAP
-Set build binutils (as, objdump, and on powerpc ld)
+Build binutils (as on i386 and amd64, objdump, and ld on powerpc)
as part of the bootstrap process.
.Pp
This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, i386/i386, powerpc/powerpc and powerpc/powerpc64.
+amd64/amd64, i386/i386, powerpc/powerpc and powerpc/powerpc64.
.It Va WITHOUT_BLACKLIST
Set this if you do not want to build
.Xr blacklistd 8
Modified: projects/clang1000-import/share/man/man7/hier.7
==============================================================================
--- projects/clang1000-import/share/man/man7/hier.7 Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/share/man/man7/hier.7 Mon Jan 20 17:55:51 2020 (r356920)
@@ -28,7 +28,7 @@
.\" @(#)hier.7 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$
.\"
-.Dd September 10, 2019
+.Dd January 20, 2020
.Dt HIER 7
.Os
.Sh NAME
@@ -420,12 +420,6 @@ for
.Pa /usr
should be used.
Exceptions are the
-.Pa man
-directory
-.Po directly under
-.Pa local/
-rather than under
-.Pa local/share/ Ns Pc ,
ports documentation
.Po in
.Pa share/doc/<port>/ Ns Pc ,
Modified: projects/clang1000-import/share/misc/committers-doc.dot
==============================================================================
--- projects/clang1000-import/share/misc/committers-doc.dot Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/share/misc/committers-doc.dot Mon Jan 20 17:55:51 2020 (r356920)
@@ -112,6 +112,7 @@ bcr -> bhd
bcr -> sevan
bcr -> dexter
bcr -> sg
+bcr -> carlavilla
blackend -> ale
Modified: projects/clang1000-import/share/mk/src.opts.mk
==============================================================================
--- projects/clang1000-import/share/mk/src.opts.mk Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/share/mk/src.opts.mk Mon Jan 20 17:55:51 2020 (r356920)
@@ -63,7 +63,6 @@ __DEFAULT_YES_OPTIONS = \
AUTOFS \
BHYVE \
BINUTILS \
- BINUTILS_BOOTSTRAP \
BLACKLIST \
BLUETOOTH \
BOOT \
@@ -313,6 +312,11 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_C
# In-tree binutils/gcc are older versions without modern architecture support.
.if ${__T} == "aarch64" || ${__T:Mriscv*} != ""
BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB
+.endif
+.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
+__DEFAULT_YES_OPTIONS+=BINUTILS_BOOTSTRAP
+.else
+__DEFAULT_NO_OPTIONS+=BINUTILS_BOOTSTRAP
.endif
.if ${__T:Mriscv*} != ""
BROKEN_OPTIONS+=OFED
Modified: projects/clang1000-import/stand/powerpc/uboot/start.S
==============================================================================
--- projects/clang1000-import/stand/powerpc/uboot/start.S Mon Jan 20 17:23:03 2020 (r356919)
+++ projects/clang1000-import/stand/powerpc/uboot/start.S Mon Jan 20 17:55:51 2020 (r356920)
@@ -38,10 +38,11 @@ _start:
lis %r11, uboot_address at ha
addi %r11, %r11, uboot_address at l
stw %r1, 0(%r11)
- /* Save U-Boot's r14 */
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list