Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/tests/lib/libpthread Pull up following revision(s) (reque...



details:   https://anonhg.NetBSD.org/src/rev/6bb19ebc7f94
branches:  netbsd-8
changeset: 850964:6bb19ebc7f94
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Tue Aug 29 11:25:50 2017 +0000

description:
Pull up following revision(s) (requested by joerg in ticket #127):
        tests/libexec/ld.elf_so/h_thread_local_dtor.c: revision 1.1
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6/c++config.h: revision 1.14
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmeb/c++config.h: revision 1.17
        lib/libc/stdlib/atexit.h: file removal
        lib/libc/stdlib/exit.c: revision 1.16
        external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc64/c++config.h: revision 1.8
        lib/libc/stdlib/exit.c: revision 1.17
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hf/c++config.h: revision 1.14
        distrib/sets/lists/debug/shl.mi: revision 1.178
        external/gpl3/gcc/lib/libstdc++-v3/arch/sh3el/c++config.h: revision 1.21
        distrib/sets/lists/debug/shl.mi: revision 1.179
        distrib/sets/lists/debug/mi: revision 1.219
        lib/libpthread/pthread.c: revision 1.150
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/c++config.h: revision 1.14
        libexec/ld.elf_so/symbols.map: revision 1.2
        include/dlfcn.h: revision 1.25
        external/gpl3/gcc/lib/libstdc++-v3/arch/arm/c++config.h: revision 1.21
        external/gpl3/gcc/lib/libstdc++-v3/arch/x86_64/c++config.h: revision 1.23
        external/gpl3/gcc/lib/libstdc++-v3/arch/mips64el/c++config.h: revision 1.18
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4eb/c++config.h: revision 1.14
        external/gpl3/gcc/lib/libstdc++-v3/arch/earm/c++config.h: revision 1.19
        external/gpl3/gcc/lib/libstdc++-v3/arch/mipsel/c++config.h: revision 1.19
        external/gpl3/gcc/lib/libstdc++-v3/arch/ia64/c++config.h: revision 1.5
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6eb/c++config.h: revision 1.14
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmhf/c++config.h: revision 1.17
        distrib/sets/lists/tests/mi: revision 1.755
        external/gpl3/gcc/lib/libstdc++-v3/arch/mips64eb/c++config.h: revision 1.19
        external/gpl3/gcc/lib/libstdc++-v3/arch/i386/c++config.h: revision 1.20
        external/gpl3/gcc/lib/libstdc++-v3/arch/vax/c++config.h: revision 1.21
        external/gpl3/gcc/lib/libstdc++-v3/arch/armeb/c++config.h: revision 1.21
        external/gpl3/gcc/lib/libstdc++-v3/arch/sparc/c++config.h: revision 1.20
        lib/libc/dlfcn/dlfcn_elf.c: revision 1.14
        tests/libexec/ld.elf_so/t_thread_local_dtor.sh: revision 1.1
        tests/lib/libpthread/t_thread_local_dtor.sh: revision 1.1
        lib/libc/stdlib/Makefile.inc: revision 1.93
        lib/libc/include/atexit.h: revision 1.1
        lib/libc/include/atexit.h: revision 1.2
        external/gpl3/gcc/lib/libstdc++-v3/arch/m68k/c++config.h: revision 1.19
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hf/c++config.h: revision 1.14
        distrib/sets/lists/debug/shl.mi: revision 1.180
        external/gpl3/gcc/lib/libstdc++-v3/arch/sparc64/c++config.h: revision 1.19
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv6hfeb/c++config.h: revision 1.14
        external/gpl3/gcc/lib/libstdc++-v3/arch/hppa/c++config.h: revision 1.19
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7hfeb/c++config.h: revision 1.14
        lib/libc/stdlib/cxa_thread_atexit.c: revision 1.1
        tests/libexec/ld.elf_so/helper_dso3/h_helper_dso3.cpp: revision 1.1
        tests/libexec/ld.elf_so/helper_dso3/Makefile: revision 1.1
        external/gpl3/gcc/lib/libstdc++-v3/arch/riscv64/c++config.h: revision 1.5
        libexec/ld.elf_so/rtld.c: revision 1.185
        external/gpl3/gcc/lib/libstdc++-v3/arch/sh3eb/c++config.h: revision 1.19
        external/gpl3/gcc/lib/libstdc++-v3/arch/riscv32/c++config.h: revision 1.5
        external/gpl3/gcc/lib/libstdc++-v3/arch/m68000/c++config.h: revision 1.15
        external/gpl3/gcc/lib/libstdc++-v3/arch/mipseb/c++config.h: revision 1.21
        external/gpl3/gcc/lib/libstdc++-v3/arch/coldfire/c++config.h: revision 1.12
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/c++config.h: revision 1.14
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmhfeb/c++config.h: revision 1.15
        external/gpl3/gcc/lib/libstdc++-v3/arch/alpha/c++config.h: revision 1.19
        tests/libexec/ld.elf_so/Makefile: revision 1.9
        external/gpl3/gcc/lib/libstdc++-v3/arch/powerpc/c++config.h: revision 1.20
        external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7eb/c++config.h: revision 1.14
        tests/lib/libpthread/h_thread_local_dtor.cpp: revision 1.1
        distrib/sets/lists/tests/shl.mi: revision 1.11
        tests/lib/libpthread/Makefile: revision 1.13
        libexec/ld.elf_so/rtld.h: revision 1.129
        external/gpl3/gcc/lib/libstdc++-v3/arch/or1k/c++config.h: revision 1.6
Implement __cxa_thread_atexit and __cxa_thread_atexit_impl. This
functions are used for destructors of thread_local objects.
If a pending destructor exists, prevent unloading of shared objects.
Introduce __dl_cxa_refcount interface for this purpose. When the last
reference is gone and the object has been dlclose'd before, the
unloading is finalized.
Ideally, __cxa_thread_atexit_impl wouldn't exist, but libstdc++ insists
on providing __cxa_thread_atexit as direct wrapper without further
patching.
Fix filename of new debug file
Add misising DEBUGLIB file
Avoid common declaration.
Drop TLS variant checks, emutls is enough for VAX and Sun2.

diffstat:

 tests/lib/libpthread/h_thread_local_dtor.cpp |  80 ++++++++++++++++++++++++++++
 tests/lib/libpthread/t_thread_local_dtor.sh  |  41 ++++++++++++++
 2 files changed, 121 insertions(+), 0 deletions(-)

diffs (129 lines):

diff -r 5ee5fa8e9fbc -r 6bb19ebc7f94 tests/lib/libpthread/h_thread_local_dtor.cpp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread/h_thread_local_dtor.cpp      Tue Aug 29 11:25:50 2017 +0000
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016 Tavian Barnes. 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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>
+__RCSID("$NetBSD: h_thread_local_dtor.cpp,v 1.1.4.2 2017/08/29 11:25:50 bouyer Exp $");
+
+#include <cstdlib>
+#include <thread>
+
+static int seq;
+
+class OrderChecker {
+public:
+  explicit OrderChecker(int n) : n_{n} { }
+
+  ~OrderChecker() {
+    if (seq != n_) {
+      printf("Unexpected sequence point: %d\n", 3);
+      _Exit(1);
+    }
+    ++seq;
+  }
+
+private:
+  int n_;
+};
+
+template <int ID>
+class CreatesThreadLocalInDestructor {
+public:
+  ~CreatesThreadLocalInDestructor() {
+    thread_local OrderChecker checker{ID};
+  }
+};
+
+OrderChecker global{7};
+
+void thread_fn() {
+  static OrderChecker fn_static{5};
+  thread_local CreatesThreadLocalInDestructor<2> creates_tl2;
+  thread_local OrderChecker fn_thread_local{1};
+  thread_local CreatesThreadLocalInDestructor<0> creates_tl0;
+}
+
+int main() {
+  static OrderChecker fn_static{6};
+
+  std::thread{thread_fn}.join();
+  if (seq != 3) {
+    printf("Unexpected sequence point: %d\n", 3);
+    _Exit(1);
+  }
+
+  thread_local OrderChecker fn_thread_local{4};
+  thread_local CreatesThreadLocalInDestructor<3> creates_tl;
+
+  return 0;
+}
diff -r 5ee5fa8e9fbc -r 6bb19ebc7f94 tests/lib/libpthread/t_thread_local_dtor.sh
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libpthread/t_thread_local_dtor.sh       Tue Aug 29 11:25:50 2017 +0000
@@ -0,0 +1,41 @@
+# $NetBSD: t_thread_local_dtor.sh,v 1.1.4.2 2017/08/29 11:25:50 bouyer Exp $
+#
+# Copyright (c) 2008 The NetBSD Foundation, Inc.
+# 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+#
+
+atf_test_case thread_local_dtor_order
+thread_local_dtor_order_head()
+{
+       atf_set "descr" "Checks destructor order for thread_local objects"
+}
+thread_local_dtor_order_body()
+{
+       atf_check -o ignore "$(atf_get_srcdir)/h_thread_local_dtor"
+}
+
+atf_init_test_cases()
+{
+       atf_add_test_case thread_local_dtor_order
+}



Home | Main Index | Thread Index | Old Index