Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Mar 2019 18:51:15 +0000 (UTC)
From:      Enji Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r345710 - in projects/capsicum-test: lib/clang lib/libc++ lib/libc++experimental lib/libc++fs lib/libc/aarch64 lib/libc/amd64 lib/libc/arm lib/libc/gen lib/libc/i386 lib/libc/include li...
Message-ID:  <201903291851.x2TIpF5X092952@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Mar 29 18:51:14 2019
New Revision: 345710
URL: https://svnweb.freebsd.org/changeset/base/345710

Log:
  MFhead@r345709

Added:
  projects/capsicum-test/lib/libc/aarch64/static_tls.h
     - copied unchanged from r345709, head/lib/libc/aarch64/static_tls.h
  projects/capsicum-test/lib/libc/amd64/static_tls.h
     - copied unchanged from r345709, head/lib/libc/amd64/static_tls.h
  projects/capsicum-test/lib/libc/arm/static_tls.h
     - copied unchanged from r345709, head/lib/libc/arm/static_tls.h
  projects/capsicum-test/lib/libc/i386/static_tls.h
     - copied unchanged from r345709, head/lib/libc/i386/static_tls.h
  projects/capsicum-test/lib/libc/mips/static_tls.h
     - copied unchanged from r345709, head/lib/libc/mips/static_tls.h
  projects/capsicum-test/lib/libc/powerpc/static_tls.h
     - copied unchanged from r345709, head/lib/libc/powerpc/static_tls.h
  projects/capsicum-test/lib/libc/powerpc64/static_tls.h
     - copied unchanged from r345709, head/lib/libc/powerpc64/static_tls.h
  projects/capsicum-test/lib/libc/riscv/static_tls.h
     - copied unchanged from r345709, head/lib/libc/riscv/static_tls.h
  projects/capsicum-test/lib/libc/sparc64/static_tls.h
     - copied unchanged from r345709, head/lib/libc/sparc64/static_tls.h
  projects/capsicum-test/lib/libthr/arch/aarch64/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/aarch64/include/pthread_tls.h
  projects/capsicum-test/lib/libthr/arch/amd64/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/amd64/include/pthread_tls.h
  projects/capsicum-test/lib/libthr/arch/arm/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/arm/include/pthread_tls.h
  projects/capsicum-test/lib/libthr/arch/i386/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/i386/include/pthread_tls.h
  projects/capsicum-test/lib/libthr/arch/mips/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/mips/include/pthread_tls.h
  projects/capsicum-test/lib/libthr/arch/powerpc/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/powerpc/include/pthread_tls.h
  projects/capsicum-test/lib/libthr/arch/riscv/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/riscv/include/pthread_tls.h
  projects/capsicum-test/lib/libthr/arch/sparc64/include/pthread_tls.h
     - copied unchanged from r345709, head/lib/libthr/arch/sparc64/include/pthread_tls.h
Deleted:
  projects/capsicum-test/sys/fs/fuse/fuse_debug.h
Modified:
  projects/capsicum-test/lib/clang/llvm.build.mk
  projects/capsicum-test/lib/libc++/Makefile
  projects/capsicum-test/lib/libc++experimental/Makefile
  projects/capsicum-test/lib/libc++fs/Makefile
  projects/capsicum-test/lib/libc/gen/Symbol.map
  projects/capsicum-test/lib/libc/gen/elf_utils.c
  projects/capsicum-test/lib/libc/include/libc_private.h
  projects/capsicum-test/lib/libc/sys/interposing_table.c
  projects/capsicum-test/lib/libc/tests/stdlib/Makefile
  projects/capsicum-test/lib/libclang_rt/Makefile.inc
  projects/capsicum-test/lib/libcxxrt/Makefile
  projects/capsicum-test/lib/libgcc_eh/Makefile.inc
  projects/capsicum-test/lib/libomp/Makefile
  projects/capsicum-test/lib/libthr/Makefile
  projects/capsicum-test/lib/libthr/pthread.map
  projects/capsicum-test/lib/libthr/thread/thr_list.c
  projects/capsicum-test/lib/libthr/thread/thr_private.h
  projects/capsicum-test/lib/libvgl/main.c
  projects/capsicum-test/lib/libvgl/mouse.c
  projects/capsicum-test/lib/ofed/libibnetdisc/Makefile
  projects/capsicum-test/libexec/rtld-elf/arm/reloc.c
  projects/capsicum-test/libexec/rtld-elf/mips/reloc.c
  projects/capsicum-test/libexec/rtld-elf/rtld.c
  projects/capsicum-test/libexec/rtld-elf/rtld.h
  projects/capsicum-test/share/man/man9/Makefile
  projects/capsicum-test/share/man/man9/VOP_FSYNC.9
  projects/capsicum-test/share/mk/bsd.progs.mk
  projects/capsicum-test/share/mk/bsd.sys.mk
  projects/capsicum-test/share/mk/googletest.test.inc.mk
  projects/capsicum-test/sys/cam/cam_periph.c
  projects/capsicum-test/sys/cam/cam_periph.h
  projects/capsicum-test/sys/conf/NOTES
  projects/capsicum-test/sys/conf/ldscript.powerpc64
  projects/capsicum-test/sys/dev/cxgbe/adapter.h
  projects/capsicum-test/sys/dev/cxgbe/offload.h
  projects/capsicum-test/sys/dev/cxgbe/t4_main.c
  projects/capsicum-test/sys/dev/cxgbe/t4_sge.c
  projects/capsicum-test/sys/dev/cxgbe/tom/t4_cpl_io.c
  projects/capsicum-test/sys/dev/cxgbe/tom/t4_ddp.c
  projects/capsicum-test/sys/dev/cxgbe/tom/t4_tls.c
  projects/capsicum-test/sys/fs/fuse/fuse.h
  projects/capsicum-test/sys/fs/fuse/fuse_device.c
  projects/capsicum-test/sys/fs/fuse/fuse_file.c
  projects/capsicum-test/sys/fs/fuse/fuse_internal.c
  projects/capsicum-test/sys/fs/fuse/fuse_internal.h
  projects/capsicum-test/sys/fs/fuse/fuse_io.c
  projects/capsicum-test/sys/fs/fuse/fuse_ipc.c
  projects/capsicum-test/sys/fs/fuse/fuse_ipc.h
  projects/capsicum-test/sys/fs/fuse/fuse_main.c
  projects/capsicum-test/sys/fs/fuse/fuse_node.c
  projects/capsicum-test/sys/fs/fuse/fuse_vfsops.c
  projects/capsicum-test/sys/fs/fuse/fuse_vnops.c
  projects/capsicum-test/sys/kern/imgact_elf.c
  projects/capsicum-test/sys/net/if_lagg.c
  projects/capsicum-test/sys/net/iflib.c
  projects/capsicum-test/sys/powerpc/aim/trap_subr64.S
  projects/capsicum-test/sys/powerpc/booke/locore.S
  projects/capsicum-test/sys/powerpc/include/mmuvar.h
  projects/capsicum-test/sys/powerpc/ofw/ofwcall64.S
  projects/capsicum-test/sys/powerpc/powernv/opalcall.S
  projects/capsicum-test/sys/powerpc/powerpc/swtch64.S
  projects/capsicum-test/sys/vm/vm_kern.c
  projects/capsicum-test/sys/vm/vm_map.c
  projects/capsicum-test/sys/vm/vm_map.h
  projects/capsicum-test/tests/sys/capsicum/Makefile
  projects/capsicum-test/tests/sys/capsicum/ioctls_test.c
  projects/capsicum-test/usr.bin/dtc/Makefile
  projects/capsicum-test/usr.sbin/iostat/iostat.c
  projects/capsicum-test/usr.sbin/pmc/Makefile
Directory Properties:
  projects/capsicum-test/   (props changed)

Modified: projects/capsicum-test/lib/clang/llvm.build.mk
==============================================================================
--- projects/capsicum-test/lib/clang/llvm.build.mk	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/clang/llvm.build.mk	Fri Mar 29 18:51:14 2019	(r345710)
@@ -95,7 +95,7 @@ CFLAGS+=	-ffunction-sections
 CFLAGS+=	-fdata-sections
 LDFLAGS+=	-Wl,--gc-sections
 
-CXXFLAGS+=	-std=c++11
+CXXSTD?=	c++11
 CXXFLAGS+=	-fno-exceptions
 CXXFLAGS+=	-fno-rtti
 CXXFLAGS.clang+= -stdlib=libc++

Modified: projects/capsicum-test/lib/libc++/Makefile
==============================================================================
--- projects/capsicum-test/lib/libc++/Makefile	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc++/Makefile	Fri Mar 29 18:51:14 2019	(r345710)
@@ -76,9 +76,7 @@ CFLAGS+=	-nostdinc++
 CFLAGS+=	-nostdlib
 CFLAGS+=	-D_LIBCPP_BUILDING_LIBRARY
 CFLAGS+=	-DLIBCXXRT
-.if empty(CXXFLAGS:M-std=*)
-CXXFLAGS+=	-std=c++11
-.endif
+CXXSTD=		c++11
 
 LIBADD+=	cxxrt
 INCSGROUPS=	STD EXP EXT

Modified: projects/capsicum-test/lib/libc++experimental/Makefile
==============================================================================
--- projects/capsicum-test/lib/libc++experimental/Makefile	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc++experimental/Makefile	Fri Mar 29 18:51:14 2019	(r345710)
@@ -20,8 +20,6 @@ CXXFLAGS+=	-nostdinc++
 CXXFLAGS+=	-nostdlib
 CXXFLAGS+=	-D_LIBCPP_BUILDING_LIBRARY
 CXXFLAGS+=	-DLIBCXXRT
-.if empty(CXXFLAGS:M-std=*)
-CXXFLAGS+=	-std=c++14
-.endif
+CXXSTD=		c++14
 
 .include <bsd.lib.mk>

Modified: projects/capsicum-test/lib/libc++fs/Makefile
==============================================================================
--- projects/capsicum-test/lib/libc++fs/Makefile	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc++fs/Makefile	Fri Mar 29 18:51:14 2019	(r345710)
@@ -22,8 +22,6 @@ CXXFLAGS+=	-nostdinc++
 CXXFLAGS+=	-nostdlib
 CXXFLAGS+=	-D_LIBCPP_BUILDING_LIBRARY
 CXXFLAGS+=	-DLIBCXXRT
-.if empty(CXXFLAGS:M-std=*)
-CXXFLAGS+=	-std=c++14
-.endif
+CXXSTD=		c++14
 
 .include <bsd.lib.mk>

Copied: projects/capsicum-test/lib/libc/aarch64/static_tls.h (from r345709, head/lib/libc/aarch64/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/aarch64/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/aarch64/static_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_AARCH64_STATIC_TLS_H
+#define _LIBC_AARCH64_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+	__asm __volatile("mrs	%x0, tpidr_el0" : "=r" (tlsbase));
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libc/amd64/static_tls.h (from r345709, head/lib/libc/amd64/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/amd64/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/amd64/static_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_AMD64_STATIC_TLS_H
+#define	_LIBC_AMD64_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+	__asm __volatile("movq %%fs:0, %0" : "=r" (tlsbase));
+	tlsbase -= offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libc/arm/static_tls.h (from r345709, head/lib/libc/arm/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/arm/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/arm/static_tls.h)
@@ -0,0 +1,51 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_ARM_STATIC_TLS_H
+#define _LIBC_ARM_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+#ifdef ARM_TP_ADDRESS
+	tlsbase = *(uintptr_t *)ARM_TP_ADDRESS;
+#else
+	__asm __volatile("mrc  p15, 0, %0, c13, c0, 3" : "=r" (tlsbase));
+#endif
+
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Modified: projects/capsicum-test/lib/libc/gen/Symbol.map
==============================================================================
--- projects/capsicum-test/lib/libc/gen/Symbol.map	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc/gen/Symbol.map	Fri Mar 29 18:51:14 2019	(r345710)
@@ -542,6 +542,7 @@ FBSDprivate_1.0 {
 	__libc_tcdrain;
 
 	__elf_aux_vector;
+	__pthread_distribute_static_tls;
 	__pthread_map_stacks_exec;
 	__fillcontextx;
 	__fillcontextx2;

Modified: projects/capsicum-test/lib/libc/gen/elf_utils.c
==============================================================================
--- projects/capsicum-test/lib/libc/gen/elf_utils.c	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc/gen/elf_utils.c	Fri Mar 29 18:51:14 2019	(r345710)
@@ -34,10 +34,13 @@
 #include <sys/sysctl.h>
 #include <link.h>
 #include <stddef.h>
+#include <string.h>
 #include "libc_private.h"
+#include "static_tls.h"
 
 int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
 void __pthread_map_stacks_exec(void);
+void __pthread_distribute_static_tls(size_t, void *, size_t, size_t);
 
 int
 __elf_phdr_match_addr(struct dl_phdr_info *phdr_info, void *addr)
@@ -96,4 +99,25 @@ __pthread_map_stacks_exec(void)
 {
 
 	((void (*)(void))__libc_interposing[INTERPOS_map_stacks_exec])();
+}
+
+void
+__libc_distribute_static_tls(size_t offset, void *src, size_t len,
+    size_t total_len)
+{
+	uintptr_t tlsbase;
+
+	tlsbase = _libc_get_static_tls_base(offset);
+	memcpy((void *)tlsbase, src, len);
+	memset((char *)tlsbase + len, 0, total_len - len);
+}
+
+#pragma weak __pthread_distribute_static_tls
+void
+__pthread_distribute_static_tls(size_t offset, void *src, size_t len,
+    size_t total_len)
+{
+
+	((void (*)(size_t, void *, size_t, size_t))__libc_interposing[
+	    INTERPOS_distribute_static_tls])(offset, src, len, total_len);
 }

Copied: projects/capsicum-test/lib/libc/i386/static_tls.h (from r345709, head/lib/libc/i386/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/i386/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/i386/static_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_I386_STATIC_TLS_H
+#define _LIBC_I386_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+	__asm __volatile("movl %%gs:0, %0" : "=r" (tlsbase));
+	tlsbase -= offset;
+	return (tlsbase);
+}
+
+#endif

Modified: projects/capsicum-test/lib/libc/include/libc_private.h
==============================================================================
--- projects/capsicum-test/lib/libc/include/libc_private.h	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc/include/libc_private.h	Fri Mar 29 18:51:14 2019	(r345710)
@@ -235,6 +235,7 @@ enum {
 	INTERPOS_map_stacks_exec,
 	INTERPOS_fdatasync,
 	INTERPOS_clock_nanosleep,
+	INTERPOS_distribute_static_tls,
 	INTERPOS_MAX
 };
 
@@ -413,6 +414,8 @@ struct dl_phdr_info;
 int __elf_phdr_match_addr(struct dl_phdr_info *, void *);
 void __init_elf_aux_vector(void);
 void __libc_map_stacks_exec(void);
+void __libc_distribute_static_tls(__size_t, void *, __size_t, __size_t);
+__uintptr_t __libc_static_tls_base(__size_t);
 
 void	_pthread_cancel_enter(int);
 void	_pthread_cancel_leave(int);

Copied: projects/capsicum-test/lib/libc/mips/static_tls.h (from r345709, head/lib/libc/mips/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/mips/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/mips/static_tls.h)
@@ -0,0 +1,64 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_MIPS_STATIC_TLS_H
+#define _LIBC_MIPS_STATIC_TLS_H
+
+#include <machine/tls.h>
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+#if defined(__mips_n64)
+	__asm__ __volatile__ (
+	    ".set\tpush\n\t"
+	    ".set\tmips64r2\n\t"
+	    "rdhwr\t%0, $29\n\t"
+	    ".set\tpop"
+	    : "=r" (tlsbase));
+	tlsbase -= TLS_TP_OFFSET + TLS_TCB_SIZE;
+#else /* mips 32 */
+	__asm__ __volatile__ (
+	    ".set\tpush\n\t"
+	    ".set\tmips32r2\n\t"
+	    "rdhwr\t%0, $29\n\t"
+	    ".set\tpop"
+	    : "=r" (tlsbase));
+	tlsbase -= TLS_TP_OFFSET + TLS_TCB_SIZE;
+#endif /* ! __mips_n64 */
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libc/powerpc/static_tls.h (from r345709, head/lib/libc/powerpc/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/powerpc/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/powerpc/static_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_POWERPC_STATIC_TLS_H
+#define _LIBC_POWERPC_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+	__asm __volatile("mr %0,2" : "=r"(tlsbase));
+	tlsbase += offset - 0x7008;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libc/powerpc64/static_tls.h (from r345709, head/lib/libc/powerpc64/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/powerpc64/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/powerpc64/static_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_POWERPC64_STATIC_TLS_H
+#define _LIBC_POWERPC64_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+	__asm __volatile("mr %0,13" : "=r"(tlsbase));
+	tlsbase += offset - 0x7010;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libc/riscv/static_tls.h (from r345709, head/lib/libc/riscv/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/riscv/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/riscv/static_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_RISCV_STATIC_TLS_H
+#define _LIBC_RISCV_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	uintptr_t tlsbase;
+
+	__asm __volatile("mv %0, tp" : "=r"(tlsbase));
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libc/sparc64/static_tls.h (from r345709, head/lib/libc/sparc64/static_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libc/sparc64/static_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libc/sparc64/static_tls.h)
@@ -0,0 +1,44 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _LIBC_SPARC64_STATIC_TLS_H
+#define _LIBC_SPARC64_STATIC_TLS_H
+
+static __inline uintptr_t
+_libc_get_static_tls_base(size_t offset)
+{
+	register uintptr_t tlsbase __asm("%g7");
+
+	return (tlsbase + offset);
+}
+
+#endif

Modified: projects/capsicum-test/lib/libc/sys/interposing_table.c
==============================================================================
--- projects/capsicum-test/lib/libc/sys/interposing_table.c	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc/sys/interposing_table.c	Fri Mar 29 18:51:14 2019	(r345710)
@@ -81,6 +81,7 @@ interpos_func_t __libc_interposing[INTERPOS_MAX] = {
 	SLOT(map_stacks_exec, __libc_map_stacks_exec),
 	SLOT(fdatasync, __sys_fdatasync),
 	SLOT(clock_nanosleep, __sys_clock_nanosleep),
+	SLOT(distribute_static_tls, __libc_distribute_static_tls),
 };
 #undef SLOT
 

Modified: projects/capsicum-test/lib/libc/tests/stdlib/Makefile
==============================================================================
--- projects/capsicum-test/lib/libc/tests/stdlib/Makefile	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libc/tests/stdlib/Makefile	Fri Mar 29 18:51:14 2019	(r345710)
@@ -50,8 +50,8 @@ 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
+CXXSTD.cxa_thread_atexit_test=	c++11
+CXXSTD.cxa_thread_atexit_nothr_test=	c++11
 LIBADD.cxa_thread_atexit_test+=		pthread
 
 .for t in h_getopt h_getopt_long

Modified: projects/capsicum-test/lib/libclang_rt/Makefile.inc
==============================================================================
--- projects/capsicum-test/lib/libclang_rt/Makefile.inc	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libclang_rt/Makefile.inc	Fri Mar 29 18:51:14 2019	(r345710)
@@ -41,4 +41,4 @@ CFLAGS+=	-funwind-tables
 CXXFLAGS+=	-fvisibility-inlines-hidden
 CXXFLAGS+=	-fvisibility=hidden
 CFLAGS+=	-I${CRTSRC}/lib
-CXXFLAGS+=	-std=c++11
+CXXSTD=		c++11

Modified: projects/capsicum-test/lib/libcxxrt/Makefile
==============================================================================
--- projects/capsicum-test/lib/libcxxrt/Makefile	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libcxxrt/Makefile	Fri Mar 29 18:51:14 2019	(r345710)
@@ -22,9 +22,7 @@ SRCS+=		libelftc_dem_gnu3.c\
 
 WARNS=		0
 CFLAGS+=	-isystem ${SRCDIR} -nostdinc++
-.if empty(CXXFLAGS:M-std=*)
-CXXFLAGS+=	-std=c++11
-.endif
+CXXSTD=		c++11
 VERSION_MAP=	${.CURDIR}/Version.map
 
 .include <bsd.lib.mk>

Modified: projects/capsicum-test/lib/libgcc_eh/Makefile.inc
==============================================================================
--- projects/capsicum-test/lib/libgcc_eh/Makefile.inc	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libgcc_eh/Makefile.inc	Fri Mar 29 18:51:14 2019	(r345710)
@@ -27,10 +27,8 @@ CXXFLAGS.${file}+=	-fno-exceptions -funwind-tables
 .endfor
 
 CFLAGS+=	-I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY
-.if empty(CXXFLAGS:M-std=*)
-CXXFLAGS+=	-std=c++11
-.endif
 CXXFLAGS+=	-fno-rtti
+CXXSTD=		c++11
 STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC
 # Probably need to just move this earlier or use CXXFLAGS
 .if ${MK_DIRDEPS_BUILD} == "yes"

Modified: projects/capsicum-test/lib/libomp/Makefile
==============================================================================
--- projects/capsicum-test/lib/libomp/Makefile	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libomp/Makefile	Fri Mar 29 18:51:14 2019	(r345710)
@@ -53,9 +53,9 @@ CFLAGS+=	-I${ITTSRC}
 CFLAGS+=	-ffunction-sections
 CFLAGS+=	-fdata-sections
 CXXFLAGS+=	-fvisibility-inlines-hidden
-CXXFLAGS+=	-std=c++11
 CXXFLAGS+=	-fno-exceptions
 CXXFLAGS+=	-fno-rtti
+CXXSTD=		c++11
 
 LDFLAGS+=	-Wl,--warn-shared-textrel
 LDFLAGS+=	-Wl,--gc-sections

Modified: projects/capsicum-test/lib/libthr/Makefile
==============================================================================
--- projects/capsicum-test/lib/libthr/Makefile	Fri Mar 29 18:49:08 2019	(r345709)
+++ projects/capsicum-test/lib/libthr/Makefile	Fri Mar 29 18:51:14 2019	(r345710)
@@ -16,8 +16,10 @@ SHLIB_MAJOR= 3
 NO_WTHREAD_SAFETY=1
 NO_WCAST_ALIGN.gcc=1    # for gcc 4.2
 CFLAGS+=-DPTHREAD_KERNEL
-CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR}/thread \
-	-I${SRCTOP}/include
+CFLAGS+=-I${SRCTOP}/lib/libc/include
+CFLAGS+=-I${SRCTOP}/lib/libc/${MACHINE_CPUARCH}
+CFLAGS+=-I${.CURDIR}/thread
+CFLAGS+=-I${SRCTOP}/include
 CFLAGS+=-I${.CURDIR}/arch/${MACHINE_CPUARCH}/include
 CFLAGS+=-I${.CURDIR}/sys
 CFLAGS+=-I${SRCTOP}/libexec/rtld-elf

Copied: projects/capsicum-test/lib/libthr/arch/aarch64/include/pthread_tls.h (from r345709, head/lib/libthr/arch/aarch64/include/pthread_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libthr/arch/aarch64/include/pthread_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libthr/arch/aarch64/include/pthread_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _ARCH_AARCH64_PTHREAD_TLS_H
+#define	_ARCH_AARCH64_PTHREAD_TLS_H
+
+static __inline uintptr_t
+_get_static_tls_base(struct pthread *thr, size_t offset)
+{
+	uintptr_t tlsbase;
+
+	tlsbase = (uintptr_t)thr->tcb;
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libthr/arch/amd64/include/pthread_tls.h (from r345709, head/lib/libthr/arch/amd64/include/pthread_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libthr/arch/amd64/include/pthread_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libthr/arch/amd64/include/pthread_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _ARCH_AMD64_PTHREAD_TLS_H
+#define	_ARCH_AMD64_PTHREAD_TLS_H
+
+static __inline uintptr_t
+_get_static_tls_base(struct pthread *thr, size_t offset)
+{
+	uintptr_t tlsbase;
+
+	tlsbase = (uintptr_t)thr->tcb;
+	tlsbase -= offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libthr/arch/arm/include/pthread_tls.h (from r345709, head/lib/libthr/arch/arm/include/pthread_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libthr/arch/arm/include/pthread_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libthr/arch/arm/include/pthread_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _ARCH_ARM_PTHREAD_TLS_H
+#define	_ARCH_ARM_PTHREAD_TLS_H
+
+static __inline uintptr_t
+_get_static_tls_base(struct pthread *thr, size_t offset)
+{
+	uintptr_t tlsbase;
+
+	tlsbase = (uintptr_t)thr->tcb;
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libthr/arch/i386/include/pthread_tls.h (from r345709, head/lib/libthr/arch/i386/include/pthread_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libthr/arch/i386/include/pthread_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libthr/arch/i386/include/pthread_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _ARCH_I386_PTHREAD_TLS_H
+#define	_ARCH_I386_PTHREAD_TLS_H
+
+static __inline uintptr_t
+_get_static_tls_base(struct pthread *thr, size_t offset)
+{
+	uintptr_t tlsbase;
+
+	tlsbase = (uintptr_t)thr->tcb;
+	tlsbase -= offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libthr/arch/mips/include/pthread_tls.h (from r345709, head/lib/libthr/arch/mips/include/pthread_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libthr/arch/mips/include/pthread_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libthr/arch/mips/include/pthread_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _ARCH_MIPS_PTHREAD_TLS_H
+#define	_ARCH_MIPS_PTHREAD_TLS_H
+
+static __inline uintptr_t
+_get_static_tls_base(struct pthread *thr, size_t offset)
+{
+	uintptr_t tlsbase;
+
+	tlsbase = (uintptr_t)thr->tcb;
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libthr/arch/powerpc/include/pthread_tls.h (from r345709, head/lib/libthr/arch/powerpc/include/pthread_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libthr/arch/powerpc/include/pthread_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libthr/arch/powerpc/include/pthread_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _ARCH_POWERPC_PTHREAD_TLS_H
+#define	_ARCH_POWERPC_PTHREAD_TLS_H
+
+static __inline uintptr_t
+_get_static_tls_base(struct pthread *thr, size_t offset)
+{
+	uintptr_t tlsbase;
+
+	tlsbase = (uintptr_t)thr->tcb;
+	tlsbase += offset;
+	return (tlsbase);
+}
+
+#endif

Copied: projects/capsicum-test/lib/libthr/arch/riscv/include/pthread_tls.h (from r345709, head/lib/libthr/arch/riscv/include/pthread_tls.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/capsicum-test/lib/libthr/arch/riscv/include/pthread_tls.h	Fri Mar 29 18:51:14 2019	(r345710, copy of r345709, head/lib/libthr/arch/riscv/include/pthread_tls.h)
@@ -0,0 +1,46 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2019 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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$
+ */
+
+#ifndef _ARCH_RISCV_PTHREAD_TLS_H
+#define	_ARCH_RISCV_PTHREAD_TLS_H
+
+static __inline uintptr_t

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903291851.x2TIpF5X092952>