svn commit: r303852 - in user/alc/PQ_LAUNDRY: . contrib/binutils/bfd contrib/netbsd-tests/lib/libc/sys crypto/openssh lib/libc lib/libc/include lib/libc/stdlib lib/libc/tests/stdlib lib/libthr/arch...

Mark Johnston markj at FreeBSD.org
Mon Aug 8 20:01:59 UTC 2016


Author: markj
Date: Mon Aug  8 20:01:55 2016
New Revision: 303852
URL: https://svnweb.freebsd.org/changeset/base/303852

Log:
  MFH r303848

Added:
  user/alc/PQ_LAUNDRY/lib/libc/stdlib/cxa_thread_atexit.c
     - copied unchanged from r303851, head/lib/libc/stdlib/cxa_thread_atexit.c
  user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc
     - copied unchanged from r303851, head/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc
  user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc
     - copied unchanged from r303851, head/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc
  user/alc/PQ_LAUNDRY/sys/contrib/cloudabi/cloudabi_types.h
     - copied unchanged from r303851, head/sys/contrib/cloudabi/cloudabi_types.h
  user/alc/PQ_LAUNDRY/sys/contrib/cloudabi/cloudabi_vdso_aarch64.c
     - copied unchanged from r303851, head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.c
  user/alc/PQ_LAUNDRY/sys/contrib/cloudabi/cloudabi_vdso_x86_64.c
     - copied unchanged from r303851, head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl_pf_iov.c
     - copied unchanged from r303851, head/sys/dev/ixl/ixl_pf_iov.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl_pf_iov.h
     - copied unchanged from r303851, head/sys/dev/ixl/ixl_pf_iov.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl_pf_main.c
     - copied unchanged from r303851, head/sys/dev/ixl/ixl_pf_main.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl_pf_qmgr.c
     - copied unchanged from r303851, head/sys/dev/ixl/ixl_pf_qmgr.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl_pf_qmgr.h
     - copied unchanged from r303851, head/sys/dev/ixl/ixl_pf_qmgr.h
Deleted:
  user/alc/PQ_LAUNDRY/sys/dev/mlx5/mlx5_en/tcp_tlro.c
  user/alc/PQ_LAUNDRY/sys/dev/mlx5/mlx5_en/tcp_tlro.h
Modified:
  user/alc/PQ_LAUNDRY/Makefile
  user/alc/PQ_LAUNDRY/contrib/binutils/bfd/ppcboot.c
  user/alc/PQ_LAUNDRY/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
  user/alc/PQ_LAUNDRY/crypto/openssh/servconf.c
  user/alc/PQ_LAUNDRY/lib/libc/Versions.def
  user/alc/PQ_LAUNDRY/lib/libc/include/libc_private.h
  user/alc/PQ_LAUNDRY/lib/libc/stdlib/Makefile.inc
  user/alc/PQ_LAUNDRY/lib/libc/stdlib/Symbol.map
  user/alc/PQ_LAUNDRY/lib/libc/stdlib/exit.c
  user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile
  user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile.depend
  user/alc/PQ_LAUNDRY/lib/libthr/arch/mips/include/pthread_md.h
  user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_exit.c
  user/alc/PQ_LAUNDRY/lib/msun/tests/Makefile
  user/alc/PQ_LAUNDRY/libexec/rtld-elf/mips/reloc.c
  user/alc/PQ_LAUNDRY/release/Makefile.gce
  user/alc/PQ_LAUNDRY/sbin/ipfw/ipfw2.c
  user/alc/PQ_LAUNDRY/share/man/man3/queue.3
  user/alc/PQ_LAUNDRY/share/misc/organization.dot
  user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
  user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  user/alc/PQ_LAUNDRY/sys/cddl/dev/dtrace/powerpc/dtrace_asm.S
  user/alc/PQ_LAUNDRY/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c
  user/alc/PQ_LAUNDRY/sys/conf/files.amd64
  user/alc/PQ_LAUNDRY/sys/contrib/cloudabi/cloudabi_types_common.h
  user/alc/PQ_LAUNDRY/sys/dev/bxe/bxe.c
  user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitch.c
  user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitch_8327.c
  user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitch_phy.c
  user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitch_reg.c
  user/alc/PQ_LAUNDRY/sys/dev/etherswitch/arswitch/arswitchvar.h
  user/alc/PQ_LAUNDRY/sys/dev/fdt/fdt_common.c
  user/alc/PQ_LAUNDRY/sys/dev/fdt/fdt_common.h
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_heartbeat.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_kvp.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_shutdown.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_timesync.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_util.c
  user/alc/PQ_LAUNDRY/sys/dev/hyperv/utilities/hv_util.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_adminq.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_adminq.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_adminq_cmd.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_common.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_devids.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_nvm.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_osdep.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_osdep.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_prototype.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_register.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_type.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/i40e_virtchnl.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/if_ixl.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/if_ixlv.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl_pf.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixl_txrx.c
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixlv.h
  user/alc/PQ_LAUNDRY/sys/dev/ixl/ixlvc.c
  user/alc/PQ_LAUNDRY/sys/dev/mlx5/mlx5_en/en.h
  user/alc/PQ_LAUNDRY/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  user/alc/PQ_LAUNDRY/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c
  user/alc/PQ_LAUNDRY/sys/dev/ofw/ofw_fdt.c
  user/alc/PQ_LAUNDRY/sys/dev/pci/pci_pci.c
  user/alc/PQ_LAUNDRY/sys/dev/usb/usbdevs
  user/alc/PQ_LAUNDRY/sys/fs/ext2fs/ext2_dinode.h
  user/alc/PQ_LAUNDRY/sys/fs/ext2fs/ext2fs.h
  user/alc/PQ_LAUNDRY/sys/mips/atheros/if_arge.c
  user/alc/PQ_LAUNDRY/sys/mips/conf/std.AR934X
  user/alc/PQ_LAUNDRY/sys/mips/include/cpufunc.h
  user/alc/PQ_LAUNDRY/sys/mips/include/cpuinfo.h
  user/alc/PQ_LAUNDRY/sys/mips/include/cpuregs.h
  user/alc/PQ_LAUNDRY/sys/mips/mips/cpu.c
  user/alc/PQ_LAUNDRY/sys/mips/mips/genassym.c
  user/alc/PQ_LAUNDRY/sys/mips/mips/swtch.S
  user/alc/PQ_LAUNDRY/sys/mips/mips/sys_machdep.c
  user/alc/PQ_LAUNDRY/sys/mips/mips/trap.c
  user/alc/PQ_LAUNDRY/sys/mips/mips/vm_machdep.c
  user/alc/PQ_LAUNDRY/sys/modules/ixl/Makefile
  user/alc/PQ_LAUNDRY/sys/modules/ixlv/Makefile   (contents, props changed)
  user/alc/PQ_LAUNDRY/sys/modules/mlx5en/Makefile
  user/alc/PQ_LAUNDRY/sys/net/ethernet.h
  user/alc/PQ_LAUNDRY/sys/net/if_ethersubr.c
  user/alc/PQ_LAUNDRY/sys/net/if_gif.c
  user/alc/PQ_LAUNDRY/sys/net80211/ieee80211_input.c
  user/alc/PQ_LAUNDRY/sys/netgraph/ng_base.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_indata.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_input.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_output.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_pcb.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_ss_functions.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_structs.h
  user/alc/PQ_LAUNDRY/sys/netinet/sctp_usrreq.c
  user/alc/PQ_LAUNDRY/sys/netinet/sctputil.c
  user/alc/PQ_LAUNDRY/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c
  user/alc/PQ_LAUNDRY/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.h
  user/alc/PQ_LAUNDRY/sys/powerpc/include/hid.h
  user/alc/PQ_LAUNDRY/sys/powerpc/powerpc/busdma_machdep.c
  user/alc/PQ_LAUNDRY/tools/build/mk/OptionalObsoleteFiles.inc
  user/alc/PQ_LAUNDRY/usr.bin/getconf/getconf.1
  user/alc/PQ_LAUNDRY/usr.bin/getconf/progenv.gperf
  user/alc/PQ_LAUNDRY/usr.bin/sdiff/sdiff.c
  user/alc/PQ_LAUNDRY/usr.bin/systat/vmstat.c
  user/alc/PQ_LAUNDRY/usr.bin/tar/tests/Makefile
  user/alc/PQ_LAUNDRY/usr.bin/vmstat/vmstat.c
  user/alc/PQ_LAUNDRY/usr.sbin/Makefile
  user/alc/PQ_LAUNDRY/usr.sbin/etcupdate/etcupdate.sh
  user/alc/PQ_LAUNDRY/usr.sbin/pciconf/cap.c
Directory Properties:
  user/alc/PQ_LAUNDRY/   (props changed)
  user/alc/PQ_LAUNDRY/contrib/binutils/   (props changed)
  user/alc/PQ_LAUNDRY/crypto/openssh/   (props changed)
  user/alc/PQ_LAUNDRY/sys/cddl/contrib/opensolaris/   (props changed)

Modified: user/alc/PQ_LAUNDRY/Makefile
==============================================================================
--- user/alc/PQ_LAUNDRY/Makefile	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/Makefile	Mon Aug  8 20:01:55 2016	(r303852)
@@ -315,7 +315,7 @@ world: upgrade_checks .PHONY
 	${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
 .endif
 	${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
-	${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
+	${_+_}@cd ${.CURDIR}; ${_MAKE} installworld MK_META_MODE=no
 .if target(post-world)
 	@echo
 	@echo "--------------------------------------------------------------"

Modified: user/alc/PQ_LAUNDRY/contrib/binutils/bfd/ppcboot.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/binutils/bfd/ppcboot.c	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/contrib/binutils/bfd/ppcboot.c	Mon Aug  8 20:01:55 2016	(r303852)
@@ -419,7 +419,7 @@ ppcboot_bfd_print_private_bfd_data (abfd
   if (tdata->header.os_id)
     fprintf (f, "OS_ID               = 0x%.2x\n", tdata->header.os_id);
 
-  if (tdata->header.partition_name)
+  if (tdata->header.partition_name[0])
     fprintf (f, _("Partition name      = \"%s\"\n"), tdata->header.partition_name);
 
   for (i = 0; i < 4; i++)

Modified: user/alc/PQ_LAUNDRY/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c
==============================================================================
--- user/alc/PQ_LAUNDRY/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/contrib/netbsd-tests/lib/libc/sys/t_timer_create.c	Mon Aug  8 20:01:55 2016	(r303852)
@@ -116,6 +116,61 @@ timer_signal_create(clockid_t cid, bool 
 	ATF_REQUIRE(timer_delete(t) == 0);
 }
 
+#ifdef __FreeBSD__
+static void
+timer_callback(union sigval value)
+{
+	timer_t *tp;
+
+	tp = value.sival_ptr;
+
+	if (*tp == t)
+		fail = false;
+}
+
+static void
+timer_thread_create(clockid_t cid, bool expire)
+{
+	struct itimerspec tim;
+	struct sigevent evt;
+
+	t = 0;
+	fail = true;
+
+	(void)memset(&evt, 0, sizeof(struct sigevent));
+	(void)memset(&tim, 0, sizeof(struct itimerspec));
+
+	/*
+	 * Create the timer (SIGEV_THREAD).
+	 */
+	evt.sigev_notify_function = timer_callback;
+	evt.sigev_value.sival_ptr = &t;
+	evt.sigev_notify = SIGEV_THREAD;
+
+	ATF_REQUIRE(timer_create(cid, &evt, &t) == 0);
+
+	/*
+	 * Start the timer.
+	 */
+	tim.it_value.tv_sec = expire ? 5 : 1;
+	tim.it_value.tv_nsec = 0;
+
+	ATF_REQUIRE(timer_settime(t, 0, &tim, NULL) == 0);
+
+	(void)sleep(2);
+
+	if (expire) {
+		if (!fail)
+			atf_tc_fail("timer fired too soon");
+	} else {
+		if (fail)
+			atf_tc_fail("timer failed to fire");
+	}
+
+	ATF_REQUIRE(timer_delete(t) == 0);
+}
+#endif
+
 ATF_TC(timer_create_err);
 ATF_TC_HEAD(timer_create_err, tc)
 {
@@ -198,6 +253,64 @@ ATF_TC_BODY(timer_create_mono_expire, tc
 	timer_signal_create(CLOCK_MONOTONIC, true);
 }
 
+ATF_TC(timer_thread_create_real);
+ATF_TC_HEAD(timer_thread_create_real, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_REALTIME and sigevent(3), "
+	    "SIGEV_THREAD");
+}
+
+#ifdef __FreeBSD__
+ATF_TC_BODY(timer_thread_create_real, tc)
+{
+	timer_thread_create(CLOCK_REALTIME, false);
+}
+
+ATF_TC(timer_thread_create_mono);
+ATF_TC_HEAD(timer_thread_create_mono, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_MONOTONIC and sigevent(3), "
+	    "SIGEV_THREAD");
+}
+
+ATF_TC_BODY(timer_thread_create_mono, tc)
+{
+	timer_thread_create(CLOCK_MONOTONIC, false);
+}
+
+ATF_TC(timer_thread_create_real_expire);
+ATF_TC_HEAD(timer_thread_create_real_expire, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_REALTIME and sigevent(3), "
+	    "SIGEV_THREAD, with expiration");
+}
+
+ATF_TC_BODY(timer_thread_create_real_expire, tc)
+{
+	timer_thread_create(CLOCK_REALTIME, true);
+}
+
+ATF_TC(timer_thread_create_mono_expire);
+ATF_TC_HEAD(timer_thread_create_mono_expire, tc)
+{
+
+	atf_tc_set_md_var(tc, "descr",
+	    "Checks timer_create(2) with CLOCK_MONOTONIC and sigevent(3), "
+	    "SIGEV_THREAD, with expiration");
+}
+
+ATF_TC_BODY(timer_thread_create_mono_expire, tc)
+{
+	timer_thread_create(CLOCK_MONOTONIC, true);
+}
+#endif
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -206,6 +319,12 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, timer_create_mono);
 	ATF_TP_ADD_TC(tp, timer_create_real_expire);
 	ATF_TP_ADD_TC(tp, timer_create_mono_expire);
+#ifdef __FreeBSD__
+	ATF_TP_ADD_TC(tp, timer_thread_create_real);
+	ATF_TP_ADD_TC(tp, timer_thread_create_mono);
+	ATF_TP_ADD_TC(tp, timer_thread_create_real_expire);
+	ATF_TP_ADD_TC(tp, timer_thread_create_mono_expire);
+#endif
 
 	return atf_no_error();
 }

Modified: user/alc/PQ_LAUNDRY/crypto/openssh/servconf.c
==============================================================================
--- user/alc/PQ_LAUNDRY/crypto/openssh/servconf.c	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/crypto/openssh/servconf.c	Mon Aug  8 20:01:55 2016	(r303852)
@@ -22,6 +22,7 @@ __RCSID("$FreeBSD$");
 #include <netinet/ip.h>
 
 #include <ctype.h>
+#include <fcntl.h>
 #include <netdb.h>
 #include <pwd.h>
 #include <stdio.h>
@@ -206,24 +207,28 @@ fill_default_server_options(ServerOption
 	/* Standard Options */
 	if (options->protocol == SSH_PROTO_UNKNOWN)
 		options->protocol = SSH_PROTO_2;
+#define add_host_key_file(path)						\
+	do {								\
+		if (access((path), O_RDONLY) == 0)			\
+			options->host_key_files				\
+			    [options->num_host_key_files++] = (path);	\
+	} while (0)
 	if (options->num_host_key_files == 0) {
 		/* fill default hostkeys for protocols */
 		if (options->protocol & SSH_PROTO_1)
-			options->host_key_files[options->num_host_key_files++] =
-			    _PATH_HOST_KEY_FILE;
+			add_host_key_file(_PATH_HOST_KEY_FILE);
 		if (options->protocol & SSH_PROTO_2) {
-			options->host_key_files[options->num_host_key_files++] =
-			    _PATH_HOST_RSA_KEY_FILE;
-			options->host_key_files[options->num_host_key_files++] =
-			    _PATH_HOST_DSA_KEY_FILE;
+			add_host_key_file(_PATH_HOST_RSA_KEY_FILE);
+			add_host_key_file(_PATH_HOST_DSA_KEY_FILE);
 #ifdef OPENSSL_HAS_ECC
-			options->host_key_files[options->num_host_key_files++] =
-			    _PATH_HOST_ECDSA_KEY_FILE;
+			add_host_key_file(_PATH_HOST_ECDSA_KEY_FILE);
 #endif
-			options->host_key_files[options->num_host_key_files++] =
-			    _PATH_HOST_ED25519_KEY_FILE;
+			add_host_key_file(_PATH_HOST_ED25519_KEY_FILE);
 		}
 	}
+#undef add_host_key_file
+	if (options->num_host_key_files == 0)
+		fatal("No host key files found");
 	/* No certificates by default */
 	if (options->num_ports == 0)
 		options->ports[options->num_ports++] = SSH_DEFAULT_PORT;

Modified: user/alc/PQ_LAUNDRY/lib/libc/Versions.def
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/Versions.def	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libc/Versions.def	Mon Aug  8 20:01:55 2016	(r303852)
@@ -27,6 +27,10 @@ FBSD_1.3 {
 FBSD_1.4 {
 } FBSD_1.3;
 
+# This version was first added to 12.0-current.
+FBSD_1.5 {
+} FBSD_1.4;
+
 
 # This is our private namespace.  Any global interfaces that are
 # strictly for use only by other FreeBSD applications and libraries
@@ -35,4 +39,4 @@ FBSD_1.4 {
 #
 # Please do NOT increment the version of this namespace.
 FBSDprivate_1.0 {
-} FBSD_1.4;
+} FBSD_1.5;

Modified: user/alc/PQ_LAUNDRY/lib/libc/include/libc_private.h
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/include/libc_private.h	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libc/include/libc_private.h	Mon Aug  8 20:01:55 2016	(r303852)
@@ -267,6 +267,12 @@ extern const char *__progname;
 void _malloc_thread_cleanup(void);
 
 /*
+ * This function is used by the threading libraries to notify libc that a
+ * thread is exiting, so its thread-local dtors should be called.
+ */
+void __cxa_thread_call_dtors(void);
+
+/*
  * These functions are used by the threading libraries in order to protect
  * malloc across fork().
  */

Modified: user/alc/PQ_LAUNDRY/lib/libc/stdlib/Makefile.inc
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/stdlib/Makefile.inc	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdlib/Makefile.inc	Mon Aug  8 20:01:55 2016	(r303852)
@@ -5,7 +5,7 @@
 .PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib
 
 MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
-	bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \
+	bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \
 	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 \

Modified: user/alc/PQ_LAUNDRY/lib/libc/stdlib/Symbol.map
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/stdlib/Symbol.map	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdlib/Symbol.map	Mon Aug  8 20:01:55 2016	(r303852)
@@ -116,8 +116,13 @@ FBSD_1.4 {
 	reallocarray;
 };
 
+FBSD_1.5 {
+	__cxa_thread_atexit;
+};
+
 FBSDprivate_1.0 {
 	__system;
 	_system;
 	__libc_system;
+	__cxa_thread_call_dtors;
 };

Copied: user/alc/PQ_LAUNDRY/lib/libc/stdlib/cxa_thread_atexit.c (from r303851, head/lib/libc/stdlib/cxa_thread_atexit.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdlib/cxa_thread_atexit.c	Mon Aug  8 20:01:55 2016	(r303852, copy of r303851, head/lib/libc/stdlib/cxa_thread_atexit.c)
@@ -0,0 +1,140 @@
+/*-
+ * Copyright (c) 2016 Mahdi Mokhtari <mokhi64 at gmail.com>
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/queue.h>
+#include "namespace.h"
+#include <errno.h>
+#include <link.h>
+#include <pthread.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "un-namespace.h"
+#include "libc_private.h"
+
+/*
+ * C++11 introduces the thread_local scope (like __thread with some
+ * additions).  As a key-feature it should support non-trivial
+ * destructors, registered with __cxa_thread_atexit() to be executed
+ * at the thread termination.
+ *
+ * The implemention keeps a _Thread_local list of destructors per each
+ * thread, and calls __cxa_thread_call_dtors() on each thread's exit
+ * to do cleanup.  For a thread calling exit(3), in particular, for
+ * the initial thread returning from main(), we call
+ * __cxa_thread_call_dtors() inside exit().
+ *
+ * It could be possible that a dynamically loaded library, use
+ * thread_local variable but is dlclose()'d before thread exit.  The
+ * destructor of this variable will then try to access the address,
+ * for calling it but it's unloaded, so it'll crash.  We're using
+ * __elf_phdr_match_addr() to detect and prevent such cases and so
+ * prevent the crash.
+ */
+
+#define CXA_DTORS_ITERATIONS 4
+
+struct cxa_thread_dtor {
+	void *obj;
+	void (*func)(void *);
+	void *dso;
+	LIST_ENTRY(cxa_thread_dtor) entry;
+};
+static _Thread_local LIST_HEAD(dtor_list, cxa_thread_dtor) dtors =
+    LIST_HEAD_INITIALIZER(dtors);
+
+int
+__cxa_thread_atexit(void (*dtor_func)(void *), void *obj, void *dso_symbol)
+{
+	struct cxa_thread_dtor *new_dtor;
+
+	new_dtor = malloc(sizeof(*new_dtor));
+	if (new_dtor == NULL) {
+		errno = ENOMEM; /* forcibly override malloc(3) error */
+		return (-1);
+	}
+
+	new_dtor->obj = obj;
+	new_dtor->func = dtor_func;
+	new_dtor->dso = dso_symbol;
+	LIST_INSERT_HEAD(&dtors, new_dtor, entry);
+	return (0);
+}
+
+static void
+walk_cb_call(struct cxa_thread_dtor *dtor)
+{
+	struct dl_phdr_info phdr_info;
+
+	if (_rtld_addr_phdr(dtor->dso, &phdr_info) &&
+	    __elf_phdr_match_addr(&phdr_info, dtor->func))
+		dtor->func(dtor->obj);
+	else
+		fprintf(stderr, "__cxa_thread_call_dtors: dtr %p from "
+		    "unloaded dso, skipping\n", (void *)(dtor->func));
+}
+
+static void
+walk_cb_nocall(struct cxa_thread_dtor *dtor __unused)
+{
+}
+
+static void
+cxa_thread_walk(void (*cb)(struct cxa_thread_dtor *))
+{
+	struct cxa_thread_dtor *dtor, *tdtor;
+
+	LIST_FOREACH_SAFE(dtor, &dtors, entry, tdtor) {
+		LIST_REMOVE(dtor, entry);
+		cb(dtor);
+		free(dtor);
+	}
+}
+
+/*
+ * This is the callback function we use to call destructors, once for
+ * each thread.  It is called in exit(3) in libc/stdlib/exit.c and
+ * before exit_thread() in libthr/thread/thr_exit.c.
+ */
+void
+__cxa_thread_call_dtors(void)
+{
+	int i;
+
+	for (i = 0; i < CXA_DTORS_ITERATIONS && !LIST_EMPTY(&dtors); i++)
+		cxa_thread_walk(walk_cb_call);
+
+	if (!LIST_EMPTY(&dtors)) {
+		fprintf(stderr, "Thread %p is exiting with more "
+		    "thread-specific dtors created after %d iterations "
+		    "of destructor calls\n",
+		    _pthread_self(), i);
+		cxa_thread_walk(walk_cb_nocall);
+	}
+}

Modified: user/alc/PQ_LAUNDRY/lib/libc/stdlib/exit.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/stdlib/exit.c	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libc/stdlib/exit.c	Mon Aug  8 20:01:55 2016	(r303852)
@@ -63,6 +63,12 @@ exit(int status)
 
 	_thread_autoinit_dummy_decl = 1;
 
+	/*
+	 * We're dealing with cleaning up thread_local destructors in the case of
+	 * the process termination through main() exit.
+	 * Other cases are handled elsewhere.
+	 */
+	__cxa_thread_call_dtors();
 	__cxa_finalize(NULL);
 	if (__cleanup)
 		(*__cleanup)();

Modified: user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile	Mon Aug  8 20:01:55 2016	(r303852)
@@ -1,9 +1,15 @@
 # $FreeBSD$
 
+.include <src.opts.mk>
+
 ATF_TESTS_C+=		heapsort_test
 ATF_TESTS_C+=		mergesort_test
 ATF_TESTS_C+=		qsort_test
 ATF_TESTS_C+=		tsearch_test
+.if ${COMPILER_FEATURES:Mc++11}
+ATF_TESTS_CXX+=		cxa_thread_atexit_test
+ATF_TESTS_CXX+=		cxa_thread_atexit_nothr_test
+.endif
 
 # TODO: t_getenv_thread, t_mi_vector_hash
 NETBSD_ATF_TESTS_C+=	abs_test
@@ -33,6 +39,10 @@ PROGS+=		h_getopt h_getopt_long
 
 CFLAGS+=	-I${.CURDIR}
 
+CXXFLAGS.cxa_thread_atexit_test+=	-std=c++11
+CXXFLAGS.cxa_thread_atexit_nothr_test+=	-std=c++11
+LIBADD.cxa_thread_atexit_test+=		pthread
+
 .for t in h_getopt h_getopt_long
 CFLAGS.$t+=	-I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests
 LDFLAGS.$t+=	-L${LIBNETBSD_OBJDIR}

Modified: user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile.depend
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile.depend	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/Makefile.depend	Mon Aug  8 20:01:55 2016	(r303852)
@@ -8,7 +8,10 @@ DIRDEPS = \
 	include/xlocale \
 	lib/${CSU_DIR} \
 	lib/atf/libatf-c \
+	lib/atf/libatf-c++ \
 	lib/libc \
+	lib/libc++ \
+	lib/libthr \
 	lib/libcompiler_rt \
 	lib/libnetbsd \
 	lib/libutil \

Copied: user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc (from r303851, head/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc	Mon Aug  8 20:01:55 2016	(r303852, copy of r303851, head/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc)
@@ -0,0 +1,102 @@
+/*-
+ * Copyright (c) 2016 Mahdi Mokhtari <mokhi64 at gmail.com>
+ * Copyright (c) 2016 The FreeBSD Foundation
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <dlfcn.h>
+#include <atf-c++.hpp>
+#include <cstdio>
+#include <cstdlib>
+
+static FILE *output = NULL;
+
+struct Foo {
+	Foo() { ATF_REQUIRE(fprintf(output, "Created\n") > 0); }
+	~Foo() { ATF_REQUIRE(fprintf(output, "Destroyed\n") > 0); }
+	void use() { ATF_REQUIRE(fprintf(output, "Used\n") > 0); }
+};
+
+static thread_local Foo f;
+
+/*
+ * This test must not be linked to libpthread.
+ */
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__nothr);
+ATF_TEST_CASE_BODY(cxx__nothr)
+{
+	void *libthr_handle;
+
+	/* Avoid coredump during f construction. */
+	output = stderr;
+
+	libthr_handle = dlopen("libthr.so.3", RTLD_LAZY | RTLD_GLOBAL |
+	    RTLD_NOLOAD);
+	ATF_REQUIRE(libthr_handle == NULL);
+}
+
+static void
+check_local_main(void)
+{
+	static const char out_log[] = "Created\nUsed\nDestroyed\n";
+
+	fflush(output);
+	ATF_REQUIRE(atf::utils::compare_file("test_main.txt", out_log));
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_main);
+ATF_TEST_CASE_BODY(cxx__thread_local_main)
+{
+
+	ATF_REQUIRE((output = fopen("test_main.txt", "w")) != NULL);
+	f.use();
+	atexit(check_local_main);
+}
+
+extern "C" int __cxa_thread_atexit(void (*)(void *), void *, void *);
+
+static void
+again(void *arg)
+{
+
+	__cxa_thread_atexit(again, arg, &output);
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_inf_dtors);
+ATF_TEST_CASE_BODY(cxx__thread_inf_dtors)
+{
+
+	again(NULL);
+}
+
+ATF_INIT_TEST_CASES(tcs)
+{
+
+	ATF_ADD_TEST_CASE(tcs, cxx__nothr);
+	ATF_ADD_TEST_CASE(tcs, cxx__thread_local_main);
+	ATF_ADD_TEST_CASE(tcs, cxx__thread_inf_dtors);
+}

Copied: user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc (from r303851, head/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/alc/PQ_LAUNDRY/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc	Mon Aug  8 20:01:55 2016	(r303852, copy of r303851, head/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc)
@@ -0,0 +1,180 @@
+/*-
+ * Copyright (c) 2016 Mahdi Mokhtari <mokhi64 at gmail.com>
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <dlfcn.h>
+#include <atf-c++.hpp>
+#include <cstdio>
+#include <cstdlib>
+#include <thread>
+
+static FILE *output = NULL;
+
+struct Foo {
+	Foo() { ATF_REQUIRE(fprintf(output, "Created\n") > 0); }
+	~Foo() { ATF_REQUIRE(fprintf(output, "Destroyed\n") > 0); }
+	void use() { ATF_REQUIRE(fprintf(output, "Used\n") > 0); }
+};
+
+struct Bar {
+	Bar() {}
+	~Bar() {
+		thread_local static Foo foo;
+		ATF_REQUIRE(fprintf(output, "DIED\n") > 0);
+	}
+	void use() {}
+};
+
+extern "C" int __cxa_thread_atexit(void (*)(void *), void *, void *);
+
+static void
+again(void *arg)
+{
+
+	__cxa_thread_atexit(again, arg, &output);
+}
+
+struct Baz {
+	Baz() {}
+	~Baz() {
+		again(NULL);
+	}
+	void use() {}
+};
+
+static thread_local Foo f;
+static thread_local Foo g;
+static thread_local Bar h;
+static thread_local Baz e;
+
+/*
+ * This test must be linked to libpthread.
+ */
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__thr);
+ATF_TEST_CASE_BODY(cxx__thr)
+{
+	void *libthr_handle;
+
+	/* Avoid coredump during f construction. */
+	output = stderr;
+
+	libthr_handle = dlopen("libthr.so.3", RTLD_LAZY | RTLD_GLOBAL |
+	    RTLD_NOLOAD);
+	ATF_REQUIRE(libthr_handle != NULL);
+	dlclose(libthr_handle);
+}
+
+/*
+ * In this test f.use() will test cxa_thread_atexit() in non-threaded mode.
+ * After f.use() main will be threaded and we'll have one additional thread
+ * with its own TLS data.
+ */
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_before);
+ATF_TEST_CASE_BODY(cxx__thread_local_before)
+{
+	static const char out_log[] = "Created\nCreated\nUsed\nCreated\n"
+	    "Created\nUsed\nCreated\nDIED\nDestroyed\nDestroyed\nDestroyed\n";
+
+	ATF_REQUIRE((output = fopen("test_before.txt", "w")) != NULL);
+
+	f.use();
+	std::thread t([]() { f.use(); });
+	t.join();
+
+	fflush(output);
+
+	ATF_REQUIRE(atf::utils::compare_file("test_before.txt", out_log));
+}
+
+/*
+ * In this test, f.use() will test __cxa_thread_atexit()
+ * in threaded mode (but still in main-threaed).
+ */
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_after);
+ATF_TEST_CASE_BODY(cxx__thread_local_after)
+{
+	static const char out_log[] = "Created\nCreated\nUsed\nCreated\n"
+	    "DIED\nDestroyed\nDestroyed\nDestroyed\nCreated\nCreated\nUsed\n";
+
+	ATF_REQUIRE((output = fopen("test_after.txt", "w")) != NULL);
+
+	std::thread t([]() { g.use(); });
+	t.join();
+	sleep(1);
+	g.use();
+
+	fflush(output);
+
+	ATF_REQUIRE(atf::utils::compare_file("test_after.txt", out_log));
+}
+
+/*
+ * In this test, we register a new dtor while dtors are being run
+ * in __cxa_thread_atexit().
+ */
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_local_add_while_calling_dtors);
+ATF_TEST_CASE_BODY(cxx__thread_local_add_while_calling_dtors)
+{
+	static const char out_log[] = "Created\nCreated\nCreated\nDIED\n"
+	    "Destroyed\nDestroyed\nDestroyed\n";
+
+	ATF_REQUIRE((output = fopen("test_add_meanwhile.txt", "w")) != NULL);
+
+	std::thread t([]() { h.use(); });
+	t.join();
+	sleep(1);
+
+	fflush(output);
+
+	ATF_REQUIRE(atf::utils::compare_file("test_add_meanwhile.txt", out_log));
+}
+
+ATF_TEST_CASE_WITHOUT_HEAD(cxx__thread_inf_dtors);
+ATF_TEST_CASE_BODY(cxx__thread_inf_dtors)
+{
+
+	/*
+	 * Only added to make isolated run of this test not
+	 * coredumping.  Construction of Foo objects require filled
+	 * output.
+	 */
+	output = stderr;
+
+	std::thread t([]() { e.use(); });
+	t.join();
+}
+
+ATF_INIT_TEST_CASES(tcs)
+{
+
+	ATF_ADD_TEST_CASE(tcs, cxx__thr);
+	ATF_ADD_TEST_CASE(tcs, cxx__thread_local_before);
+	ATF_ADD_TEST_CASE(tcs, cxx__thread_local_after);
+	ATF_ADD_TEST_CASE(tcs, cxx__thread_local_add_while_calling_dtors);
+	ATF_ADD_TEST_CASE(tcs, cxx__thread_inf_dtors);
+}

Modified: user/alc/PQ_LAUNDRY/lib/libthr/arch/mips/include/pthread_md.h
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libthr/arch/mips/include/pthread_md.h	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libthr/arch/mips/include/pthread_md.h	Mon Aug  8 20:01:55 2016	(r303852)
@@ -61,6 +61,7 @@ _tcb_set(struct tcb *tcb)
 /*
  * Get the current tcb.
  */
+#ifdef TLS_USE_SYSARCH
 static __inline struct tcb *
 _tcb_get(void)
 {
@@ -70,6 +71,55 @@ _tcb_get(void)
 	return tcb;
 }
 
+#else /* ! TLS_USE_SYSARCH */
+
+#  if defined(__mips_n64)
+static __inline struct tcb *
+_tcb_get(void)
+{
+	uint64_t _rv;
+
+	__asm__ __volatile__ (
+	    ".set\tpush\n\t"
+	    ".set\tmips64r2\n\t"
+	    "rdhwr\t%0, $29\n\t"
+	    ".set\tpop"
+	    : "=v" (_rv));
+
+	/*
+	 * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
+	 *
+	 * Remove the offset since this really a request to get the TLS
+	 * pointer via sysarch() (in theory).  Of course, this may go away
+	 * once the TLS code is rewritten.
+	 */
+	return (struct tcb *)(_rv - TLS_TP_OFFSET - TLS_TCB_SIZE);
+}
+#  else /* mips 32 */
+static __inline struct tcb *
+_tcb_get(void)
+{
+	uint32_t _rv;
+
+	__asm__ __volatile__ (
+	    ".set\tpush\n\t"
+	    ".set\tmips32r2\n\t"
+	    "rdhwr\t%0, $29\n\t"
+	    ".set\tpop"
+	    : "=v" (_rv));
+
+	/*
+	 * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
+	 *
+	 * Remove the offset since this really a request to get the TLS
+	 * pointer via sysarch() (in theory).  Of course, this may go away
+	 * once the TLS code is rewritten.
+	 */
+	return (struct tcb *)(_rv - TLS_TP_OFFSET - TLS_TCB_SIZE);
+}
+#  endif /* ! __mips_n64 */
+#endif /* ! TLS_USE_SYSARCH */
+
 extern struct pthread *_thr_initial;
 
 static __inline struct pthread *

Modified: user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_exit.c
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_exit.c	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/libthr/thread/thr_exit.c	Mon Aug  8 20:01:55 2016	(r303852)
@@ -153,8 +153,12 @@ thread_unwind_stop(int version, _Unwind_
 		__pthread_cleanup_pop_imp(1);
 	}
 
-	if (done)
+	if (done) {
+		/* Tell libc that it should call non-trivial TLS dtors. */
+		__cxa_thread_call_dtors();
+
 		exit_thread(); /* Never return! */
+	}
 
 	return (_URC_NO_REASON);
 }
@@ -258,6 +262,8 @@ cleanup:
 		while (curthread->cleanup != NULL) {
 			__pthread_cleanup_pop_imp(1);
 		}
+		__cxa_thread_call_dtors();
+
 		exit_thread();
 	}
 
@@ -265,6 +271,7 @@ cleanup:
 	while (curthread->cleanup != NULL) {
 		__pthread_cleanup_pop_imp(1);
 	}
+	__cxa_thread_call_dtors();
 
 	exit_thread();
 #endif /* _PTHREAD_FORCED_UNWIND */

Modified: user/alc/PQ_LAUNDRY/lib/msun/tests/Makefile
==============================================================================
--- user/alc/PQ_LAUNDRY/lib/msun/tests/Makefile	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/lib/msun/tests/Makefile	Mon Aug  8 20:01:55 2016	(r303852)
@@ -50,15 +50,9 @@ TAP_TESTS_C+=	exponential_test
 TAP_TESTS_C+=	fenv_test
 TAP_TESTS_C+=	fma_test
 # clang 3.8.0 fails always fails this test. See: bug 208703
-#
-# XXX: depending on this compiler version check doesn't work at
-# buildworld/installworld time, which results in jenkins failures (bug 208963)
-# because the build is run on a 10.x instance, which has an older clang
-# compiler.
-#
-#.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800)
-#TAP_TESTS_C+=	fmaxmin_test
-#.endif
+.if ! (${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} == 30800)
+TAP_TESTS_C+=	fmaxmin_test
+.endif
 TAP_TESTS_C+=	ilogb_test
 TAP_TESTS_C+=	invtrig_test
 TAP_TESTS_C+=	invctrig_test

Modified: user/alc/PQ_LAUNDRY/libexec/rtld-elf/mips/reloc.c
==============================================================================
--- user/alc/PQ_LAUNDRY/libexec/rtld-elf/mips/reloc.c	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/libexec/rtld-elf/mips/reloc.c	Mon Aug  8 20:01:55 2016	(r303852)
@@ -634,13 +634,67 @@ allocate_initial_tls(Obj_Entry *objs)
 	sysarch(MIPS_SET_TLS, tls);
 }
 
+#ifdef __mips_n64
+void *
+_mips_get_tls(void)
+{
+	uint64_t _rv;
+
+	__asm__ __volatile__ (
+	    ".set\tpush\n\t"
+	    ".set\tmips64r2\n\t"
+	    "rdhwr\t%0, $29\n\t"
+	    ".set\tpop"
+	    : "=v" (_rv));
+	/*
+	 * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
+	 *
+	 * Remove the offset since this really a request to get the TLS
+	 * pointer via sysarch() (in theory).  Of course, this may go away
+	 * once the TLS code is rewritten.
+	 */
+	_rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE;
+
+	return (void *)_rv;
+}
+
+#else /* mips 32 */
+
+void *
+_mips_get_tls(void)
+{
+	uint32_t _rv;
+
+	__asm__ __volatile__ (
+	    ".set\tpush\n\t"
+	    ".set\tmips32r2\n\t"
+	    "rdhwr\t%0, $29\n\t"
+	    ".set\tpop"
+	    : "=v" (_rv));
+	/*
+	 * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
+	 *
+	 * Remove the offset since this really a request to get the TLS
+	 * pointer via sysarch() (in theory).  Of course, this may go away
+	 * once the TLS code is rewritten.
+	 */
+	_rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE;
+
+	return (void *)_rv;
+}
+#endif /* ! __mips_n64 */
+
 void *
 __tls_get_addr(tls_index* ti)
 {
 	Elf_Addr** tls;
 	char *p;
 
+#ifdef TLS_USE_SYSARCH
 	sysarch(MIPS_GET_TLS, &tls);
+#else
+	tls = _mips_get_tls();
+#endif
 
 	p = tls_get_addr_common(tls, ti->ti_module, ti->ti_offset + TLS_DTP_OFFSET);
 

Modified: user/alc/PQ_LAUNDRY/release/Makefile.gce
==============================================================================
--- user/alc/PQ_LAUNDRY/release/Makefile.gce	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/release/Makefile.gce	Mon Aug  8 20:01:55 2016	(r303852)
@@ -35,7 +35,7 @@ gce-check-depends:
 	@false
 . endif
 .endfor
-.if !exists(/usr/local/bin/gcutil)
+.if !exists(/usr/local/bin/gcloud)
 . if !exists(${PORTSDIR}/net/google-cloud-sdk/Makefile)
 .  if !exists(/usr/local/sbin/pkg-static)
 	env ASSUME_ALWAYS_YES=yes pkg bootstrap -yf
@@ -63,7 +63,7 @@ gce-do-upload:
 	/usr/local/bin/gsutil mb gs://${GCE_BUCKET} || true
 	/usr/local/bin/gsutil cp ${.OBJDIR}/${GCE_TARGET}.tar.gz \
 		gs://${GCE_BUCKET}/
-	/usr/local/bin/gcutil addimage ${GCE_TARGET} \
-		gs://${GCE_BUCKET}/${GCE_TARGET}.tar.gz
+	/usr/local/bin/gcloud compute images create ${GCE_TARGET} \
+		--source-uri gs://${GCE_BUCKET}/${GCE_TARGET}.tar.gz
 	touch ${.OBJDIR}/${.TARGET}
 

Modified: user/alc/PQ_LAUNDRY/sbin/ipfw/ipfw2.c
==============================================================================
--- user/alc/PQ_LAUNDRY/sbin/ipfw/ipfw2.c	Mon Aug  8 19:59:08 2016	(r303851)
+++ user/alc/PQ_LAUNDRY/sbin/ipfw/ipfw2.c	Mon Aug  8 20:01:55 2016	(r303852)
@@ -1590,8 +1590,11 @@ show_static_rule(struct cmdline_opts *co
 			break;
 
 		case O_SETFIB:
-			bprint_uint_arg(bp, "setfib ", cmd->arg1 & 0x7FFF);
- 			break;
+			if (cmd->arg1 == IP_FW_TARG)
+				bprint_uint_arg(bp, "setfib ", cmd->arg1);
+			else
+				bprintf(bp, "setfib %u", cmd->arg1 & 0x7FFF);
+			break;
 
 		case O_EXTERNAL_ACTION: {
 			/*
@@ -3957,15 +3960,19 @@ chkarg:
 		NEED1("missing DSCP code");
 		if (_substrcmp(*av, "tablearg") == 0) {
 			action->arg1 = IP_FW_TARG;
-		} else if (isalpha(*av[0])) {
-			if ((code = match_token(f_ipdscp, *av)) == -1)
-				errx(EX_DATAERR, "Unknown DSCP code");
-			action->arg1 = code;
-		} else
-		        action->arg1 = strtoul(*av, NULL, 10);
-		/* Add high-order bit to DSCP to make room for tablearg */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-user mailing list