svn commit: r211775 - in user/imp/tbemd: . contrib/gcc contrib/libstdc++/include/ext contrib/libstdc++/src contrib/top gnu/lib/libdialog lib lib/libc lib/libc/compat-43 lib/libc/gen lib/libc/locale...

Warner Losh imp at FreeBSD.org
Tue Aug 24 21:16:38 UTC 2010


Author: imp
Date: Tue Aug 24 21:16:37 2010
New Revision: 211775
URL: http://svn.freebsd.org/changeset/base/211775

Log:
  Loopback changes in head @211774

Added:
  user/imp/tbemd/lib/libc/sys/stack_protector_compat.c
     - copied unchanged from r211774, head/lib/libc/sys/stack_protector_compat.c
Deleted:
  user/imp/tbemd/lib/libthr/arch/powerpc64/
  user/imp/tbemd/lib/libthr/thread/thr_atfork.c
Modified:
  user/imp/tbemd/Makefile.inc1
  user/imp/tbemd/contrib/gcc/crtstuff.c
  user/imp/tbemd/contrib/libstdc++/include/ext/bitmap_allocator.h
  user/imp/tbemd/contrib/libstdc++/include/ext/ropeimpl.h
  user/imp/tbemd/contrib/libstdc++/src/locale-inst.cc
  user/imp/tbemd/gnu/lib/libdialog/checklist.c
  user/imp/tbemd/lib/Makefile
  user/imp/tbemd/lib/libc/Makefile
  user/imp/tbemd/lib/libc/compat-43/Makefile.inc
  user/imp/tbemd/lib/libc/gen/Makefile.inc
  user/imp/tbemd/lib/libc/locale/Makefile.inc
  user/imp/tbemd/lib/libc/quad/Makefile.inc
  user/imp/tbemd/lib/libc/softfloat/Makefile.inc
  user/imp/tbemd/lib/libc/stdlib/Makefile.inc
  user/imp/tbemd/lib/libc/string/Makefile.inc
  user/imp/tbemd/lib/libc/sys/Makefile.inc
  user/imp/tbemd/lib/libc/sys/stack_protector.c
  user/imp/tbemd/lib/libthr/arch/powerpc/include/pthread_md.h
  user/imp/tbemd/lib/libthr/pthread.map
  user/imp/tbemd/lib/libthr/thread/thr_private.h
  user/imp/tbemd/lib/libthr/thread/thr_sig.c
  user/imp/tbemd/libexec/rtld-elf/rtld.c
  user/imp/tbemd/sys/amd64/include/trap.h
  user/imp/tbemd/sys/boot/common/ufsread.c
  user/imp/tbemd/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  user/imp/tbemd/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  user/imp/tbemd/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c
  user/imp/tbemd/sys/dev/age/if_age.c
  user/imp/tbemd/sys/dev/ed/if_ed_isa.c
  user/imp/tbemd/sys/dev/vr/if_vr.c
  user/imp/tbemd/sys/i386/include/trap.h
  user/imp/tbemd/sys/kern/kern_thr.c
  user/imp/tbemd/sys/modules/dtrace/Makefile
  user/imp/tbemd/sys/modules/dtrace/dtraceall/dtraceall.c
  user/imp/tbemd/sys/modules/dtrace/fasttrap/Makefile
  user/imp/tbemd/sys/pci/if_rl.c
  user/imp/tbemd/sys/sys/cdefs.h
  user/imp/tbemd/sys/sys/param.h
  user/imp/tbemd/sys/sys/signal.h
  user/imp/tbemd/sys/x86/x86/local_apic.c
  user/imp/tbemd/usr.sbin/acpi/acpiconf/acpiconf.c
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/disk-info.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/disk-part.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/enable-net.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/get-packages.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/list-packages.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/set-mirror.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/test-netup.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/update-part-list.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/xkeyboard-layouts.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/xkeyboard-models.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend-query/xkeyboard-variants.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-bsdlabel.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-cleanup.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-disk.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-extractimage.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-ftp.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-installcomponents.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-installpackages.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-localize.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-mountdisk.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-mountoptical.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-networking.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-newfs.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-packages.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-parse.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-unmount.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-upgrade.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions-users.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/functions.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/backend/parseconfig.sh
  user/imp/tbemd/usr.sbin/pc-sysinstall/pc-sysinstall/pc-sysinstall.sh
Directory Properties:
  user/imp/tbemd/   (props changed)
  user/imp/tbemd/cddl/contrib/opensolaris/   (props changed)
  user/imp/tbemd/contrib/bind9/   (props changed)
  user/imp/tbemd/contrib/ee/   (props changed)
  user/imp/tbemd/contrib/expat/   (props changed)
  user/imp/tbemd/contrib/file/   (props changed)
  user/imp/tbemd/contrib/gdb/   (props changed)
  user/imp/tbemd/contrib/gdtoa/   (props changed)
  user/imp/tbemd/contrib/gnu-sort/   (props changed)
  user/imp/tbemd/contrib/groff/   (props changed)
  user/imp/tbemd/contrib/less/   (props changed)
  user/imp/tbemd/contrib/libpcap/   (props changed)
  user/imp/tbemd/contrib/llvm/   (props changed)
  user/imp/tbemd/contrib/llvm/tools/clang/   (props changed)
  user/imp/tbemd/contrib/ncurses/   (props changed)
  user/imp/tbemd/contrib/netcat/   (props changed)
  user/imp/tbemd/contrib/ntp/   (props changed)
  user/imp/tbemd/contrib/one-true-awk/   (props changed)
  user/imp/tbemd/contrib/openbsm/   (props changed)
  user/imp/tbemd/contrib/openpam/   (props changed)
  user/imp/tbemd/contrib/pf/   (props changed)
  user/imp/tbemd/contrib/sendmail/   (props changed)
  user/imp/tbemd/contrib/tcpdump/   (props changed)
  user/imp/tbemd/contrib/tcsh/   (props changed)
  user/imp/tbemd/contrib/top/   (props changed)
  user/imp/tbemd/contrib/top/install-sh   (props changed)
  user/imp/tbemd/contrib/tzcode/stdtime/   (props changed)
  user/imp/tbemd/contrib/tzcode/zic/   (props changed)
  user/imp/tbemd/contrib/tzdata/   (props changed)
  user/imp/tbemd/contrib/wpa/   (props changed)
  user/imp/tbemd/crypto/openssh/   (props changed)
  user/imp/tbemd/crypto/openssl/   (props changed)
  user/imp/tbemd/lib/libc/   (props changed)
  user/imp/tbemd/lib/libc/stdtime/   (props changed)
  user/imp/tbemd/lib/libutil/   (props changed)
  user/imp/tbemd/lib/libz/   (props changed)
  user/imp/tbemd/sbin/   (props changed)
  user/imp/tbemd/sbin/ipfw/   (props changed)
  user/imp/tbemd/share/zoneinfo/   (props changed)
  user/imp/tbemd/sys/   (props changed)
  user/imp/tbemd/sys/amd64/include/xen/   (props changed)
  user/imp/tbemd/sys/cddl/contrib/opensolaris/   (props changed)
  user/imp/tbemd/sys/contrib/dev/acpica/   (props changed)
  user/imp/tbemd/sys/contrib/pf/   (props changed)
  user/imp/tbemd/sys/contrib/x86emu/   (props changed)
  user/imp/tbemd/sys/dev/xen/xenpci/   (props changed)
  user/imp/tbemd/usr.bin/csup/   (props changed)
  user/imp/tbemd/usr.bin/procstat/   (props changed)
  user/imp/tbemd/usr.sbin/zic/   (props changed)

Modified: user/imp/tbemd/Makefile.inc1
==============================================================================
--- user/imp/tbemd/Makefile.inc1	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/Makefile.inc1	Tue Aug 24 21:16:37 2010	(r211775)
@@ -1131,12 +1131,10 @@ _prereq_libs= gnu/lib/libssp/libssp_nons
 # all shared libraries for ELF.
 #
 _startup_libs=	gnu/lib/csu
-.if exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf)
-_startup_libs+=	lib/csu/${MACHINE_CPUARCH}-elf
+.if exists(${.CURDIR}/lib/csu/${MACHINE_ARCH}-elf)
+_startup_libs+=	lib/csu/${MACHINE_ARCH}-elf
 .elif exists(${.CURDIR}/lib/csu/${MACHINE_CPUARCH}-elf)
 _startup_libs+=	lib/csu/${MACHINE_CPUARCH}-elf
-.elif exists(${.CURDIR}/lib/csu/${MACHINE_ARCH})
-_startup_libs+=	lib/csu/${MACHINE_ARCH}
 .else
 _startup_libs+=	lib/csu/${MACHINE_CPUARCH}
 .endif

Modified: user/imp/tbemd/contrib/gcc/crtstuff.c
==============================================================================
--- user/imp/tbemd/contrib/gcc/crtstuff.c	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/contrib/gcc/crtstuff.c	Tue Aug 24 21:16:37 2010	(r211775)
@@ -175,14 +175,14 @@ CTOR_LIST_BEGIN;
 #elif defined(CTORS_SECTION_ASM_OP)
 /* Hack: force cc1 to switch to .data section early, so that assembling
    __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
-static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
+static func_ptr force_to_data[1] __attribute__ ((__used__)) = { };
 asm (CTORS_SECTION_ASM_OP);
 STATIC func_ptr __CTOR_LIST__[1]
-  __attribute__ ((__unused__, aligned(sizeof(func_ptr))))
+  __attribute__ ((__used__, aligned(sizeof(func_ptr))))
   = { (func_ptr) (-1) };
 #else
 STATIC func_ptr __CTOR_LIST__[1]
-  __attribute__ ((__unused__, section(".ctors"), aligned(sizeof(func_ptr))))
+  __attribute__ ((__used__, section(".ctors"), aligned(sizeof(func_ptr))))
   = { (func_ptr) (-1) };
 #endif /* __CTOR_LIST__ alternatives */
 
@@ -308,7 +308,7 @@ __do_global_dtors_aux (void)
 CRT_CALL_STATIC_FUNCTION (FINI_SECTION_ASM_OP, __do_global_dtors_aux)
 #else /* !defined(FINI_SECTION_ASM_OP) */
 static func_ptr __do_global_dtors_aux_fini_array_entry[]
-  __attribute__ ((__unused__, section(".fini_array")))
+  __attribute__ ((__used__, section(".fini_array")))
   = { __do_global_dtors_aux };
 #endif /* !defined(FINI_SECTION_ASM_OP) */
 
@@ -348,7 +348,7 @@ frame_dummy (void)
 CRT_CALL_STATIC_FUNCTION (INIT_SECTION_ASM_OP, frame_dummy)
 #else /* defined(INIT_SECTION_ASM_OP) */
 static func_ptr __frame_dummy_init_array_entry[]
-  __attribute__ ((__unused__, section(".init_array")))
+  __attribute__ ((__used__, section(".init_array")))
   = { frame_dummy };
 #endif /* !defined(INIT_SECTION_ASM_OP) */
 #endif /* USE_EH_FRAME_REGISTRY || JCR_SECTION_NAME */
@@ -456,7 +456,7 @@ CTOR_LIST_END;
 #elif defined(CTORS_SECTION_ASM_OP)
 /* Hack: force cc1 to switch to .data section early, so that assembling
    __CTOR_LIST__ does not undo our behind-the-back change to .ctors.  */
-static func_ptr force_to_data[1] __attribute__ ((__unused__)) = { };
+static func_ptr force_to_data[1] __attribute__ ((__used__)) = { };
 asm (CTORS_SECTION_ASM_OP);
 STATIC func_ptr __CTOR_END__[1]
   __attribute__((aligned(sizeof(func_ptr))))

Modified: user/imp/tbemd/contrib/libstdc++/include/ext/bitmap_allocator.h
==============================================================================
--- user/imp/tbemd/contrib/libstdc++/include/ext/bitmap_allocator.h	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/contrib/libstdc++/include/ext/bitmap_allocator.h	Tue Aug 24 21:16:37 2010	(r211775)
@@ -549,11 +549,13 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
    */
   class free_list
   {
+  public:
     typedef size_t* 				value_type;
     typedef __detail::__mini_vector<value_type> vector_type;
     typedef vector_type::iterator 		iterator;
     typedef __mutex				__mutex_type;
 
+  private:
     struct _LT_pointer_compare
     {
       bool

Modified: user/imp/tbemd/contrib/libstdc++/include/ext/ropeimpl.h
==============================================================================
--- user/imp/tbemd/contrib/libstdc++/include/ext/ropeimpl.h	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/contrib/libstdc++/include/ext/ropeimpl.h	Tue Aug 24 21:16:37 2010	(r211775)
@@ -382,7 +382,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 	  {
 	    _Rope_RopeLeaf<_CharT, _Alloc>* __l
 	      = (_Rope_RopeLeaf<_CharT, _Alloc>*)this;
-	    __l->_Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf();
+	    __l->template _Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf();
 	    _L_deallocate(__l, 1);
 	    break;
 	  }
@@ -390,7 +390,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 	  {
 	    _Rope_RopeConcatenation<_CharT,_Alloc>* __c
 	      = (_Rope_RopeConcatenation<_CharT, _Alloc>*)this;
-	    __c->_Rope_RopeConcatenation<_CharT, _Alloc>::
+	    __c->template _Rope_RopeConcatenation<_CharT, _Alloc>::
 	      ~_Rope_RopeConcatenation();
 	    _C_deallocate(__c, 1);
 	    break;
@@ -399,7 +399,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 	  {
 	    _Rope_RopeFunction<_CharT, _Alloc>* __f
 	      = (_Rope_RopeFunction<_CharT, _Alloc>*)this;
-	    __f->_Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction();
+	    __f->template _Rope_RopeFunction<_CharT, _Alloc>::~_Rope_RopeFunction();
 	    _F_deallocate(__f, 1);
 	    break;
 	  }
@@ -407,7 +407,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 	  {
 	    _Rope_RopeSubstring<_CharT, _Alloc>* __ss =
 	      (_Rope_RopeSubstring<_CharT, _Alloc>*)this;
-	    __ss->_Rope_RopeSubstring<_CharT, _Alloc>::
+	    __ss->template _Rope_RopeSubstring<_CharT, _Alloc>::
 	      ~_Rope_RopeSubstring();
 	    _S_deallocate(__ss, 1);
 	    break;
@@ -433,7 +433,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
     {
       size_t __old_len = __r->_M_size;
       _CharT* __new_data = (_CharT*)
-	_Data_allocate(_S_rounded_up_size(__old_len + __len));
+	_Rope_rep_base<_CharT, _Alloc>::_Data_allocate(_S_rounded_up_size(__old_len + __len));
       _RopeLeaf* __result;
 
       uninitialized_copy_n(__r->_M_data, __old_len, __new_data);
@@ -817,7 +817,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
 	    if (__result_len > __lazy_threshold)
 	      goto lazy;
 	    __section = (_CharT*)
-	      _Data_allocate(_S_rounded_up_size(__result_len));
+	      _Rope_rep_base<_CharT, _Alloc>::_Data_allocate(_S_rounded_up_size(__result_len));
 	    try
 	      {	(*(__f->_M_fn))(__start, __result_len, __section); }
 	    catch(...)

Modified: user/imp/tbemd/contrib/libstdc++/src/locale-inst.cc
==============================================================================
--- user/imp/tbemd/contrib/libstdc++/src/locale-inst.cc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/contrib/libstdc++/src/locale-inst.cc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -180,11 +180,11 @@ _GLIBCXX_END_LDBL_NAMESPACE
   template class messages_byname<C>;
   
   // ctype
-  inline template class __ctype_abstract_base<C>;
+  template class __ctype_abstract_base<C>;
   template class ctype_byname<C>;
   
   // codecvt
-  inline template class __codecvt_abstract_base<C, char, mbstate_t>;
+  template class __codecvt_abstract_base<C, char, mbstate_t>;
   template class codecvt_byname<C, char, mbstate_t>;
 
   // collate

Modified: user/imp/tbemd/gnu/lib/libdialog/checklist.c
==============================================================================
--- user/imp/tbemd/gnu/lib/libdialog/checklist.c	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/gnu/lib/libdialog/checklist.c	Tue Aug 24 21:16:37 2010	(r211775)
@@ -198,6 +198,24 @@ draw:
     wnoutrefresh(dialog);
     wmove(list, choice, check_x+1);
     wrefresh(list);
+
+    /*
+     *	XXX Black magic voodoo that allows printing to the checklist
+     *	window. For some reason, if this "refresh" code is not in
+     *	place, printing to the window from the selected callback
+     *	prints "behind" the checklist window. There is probably a
+     *	better way to do this.
+     */
+    draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, menubox_border_attr, menubox_attr);
+
+    for (i = 0; i < max_choice; i++)
+	print_item(list, items[i * 3], items[i * 3 + 1], status[i], i, i == choice, DREF(ditems, i), list_width, item_x, check_x);
+    print_arrows(dialog, scroll, list_height, item_no, box_x, box_y, check_x + 4, cur_x, cur_y);
+
+    wmove(list, choice, check_x+1);
+    wnoutrefresh(dialog);
+    wrefresh(list);
+    /* XXX Black magic XXX */
     
     while (key != ESC) {
 	key = wgetch(dialog);

Modified: user/imp/tbemd/lib/Makefile
==============================================================================
--- user/imp/tbemd/lib/Makefile	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/Makefile	Tue Aug 24 21:16:37 2010	(r211775)
@@ -112,7 +112,9 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	${_bind} \
 	${_clang}
 
-.if exists(${.CURDIR}/csu/${MACHINE_CPUARCH}-elf)
+.if exists(${.CURDIR}/csu/${MACHINE_ARCH}-elf)
+_csu=csu/${MACHINE_ARCH}-elf
+.elif exists(${.CURDIR}/csu/${MACHINE_CPUARCH}-elf)
 _csu=csu/${MACHINE_CPUARCH}-elf
 .elif exists(${.CURDIR}/csu/${MACHINE_CPUARCH}/Makefile)
 _csu=csu/${MACHINE_CPUARCH}

Modified: user/imp/tbemd/lib/libc/Makefile
==============================================================================
--- user/imp/tbemd/lib/libc/Makefile	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/Makefile	Tue Aug 24 21:16:37 2010	(r211775)
@@ -5,6 +5,15 @@ SHLIBDIR?= /lib
 
 .include <bsd.own.mk>
 
+# We have to special case powerpc and powerpc64, since they mostly have
+# the same source implementation.  libc is very different due to large
+# ABI differences.
+.if ${LIBC_ARCH} == "powerpc"
+LIBC_ARCH=${MACHINE_ARCH}
+.else
+LIBC_ARCH=${LIBC_ARCH}
+.endif
+
 # All library objects contain FreeBSD revision strings by default; they may be
 # excluded as a space-saving measure.  To produce a library that does
 # not contain these strings, add -DSTRIP_FBSDID (see <sys/cdefs.h>) to CFLAGS
@@ -15,7 +24,7 @@ LIB=c
 SHLIB_MAJOR= 7
 WARNS?=	2
 CFLAGS+=-I${.CURDIR}/include -I${.CURDIR}/../../include
-CFLAGS+=-I${.CURDIR}/${MACHINE_CPUARCH}
+CFLAGS+=-I${.CURDIR}/${LIBC_ARCH}
 CFLAGS+=-DNLS
 CLEANFILES+=tags
 INSTALL_PIC_ARCHIVE=
@@ -36,7 +45,7 @@ MDASM=
 MIASM=
 NOASM=
 
-.include "${.CURDIR}/${MACHINE_CPUARCH}/Makefile.inc"
+.include "${.CURDIR}/${LIBC_ARCH}/Makefile.inc"
 .include "${.CURDIR}/db/Makefile.inc"
 .include "${.CURDIR}/compat-43/Makefile.inc"
 .include "${.CURDIR}/gdtoa/Makefile.inc"
@@ -49,14 +58,14 @@ NOASM=
 .include "${.CURDIR}/net/Makefile.inc"
 .include "${.CURDIR}/nls/Makefile.inc"
 .include "${.CURDIR}/posix1e/Makefile.inc"
-.if ${MACHINE_CPUARCH} != "amd64" && \
-    ${MACHINE_CPUARCH} != "ia64" && \
-    ${MACHINE_ARCH} != "powerpc64" && \
-    ${MACHINE_CPUARCH} != "sparc64" && \
-    ${MACHINE_CPUARCH} != "mips"
+.if ${LIBC_ARCH} != "amd64" && \
+    ${LIBC_ARCH} != "ia64" && \
+    ${LIBC_ARCH} != "powerpc64" && \
+    ${LIBC_ARCH} != "sparc64" && \
+    ${LIBC_ARCH} != "mips"
 .include "${.CURDIR}/quad/Makefile.inc"
 .endif
-.if ${MACHINE_ARCH} == "mips" && \
+.if ${LIBC_ARCH} == "mips" && \
     (!defined(TARGET_ABI) || ${TARGET_ABI} == "o32")
 .include "${.CURDIR}/quad/Makefile.inc"
 .endif
@@ -70,7 +79,7 @@ NOASM=
 .include "${.CURDIR}/rpc/Makefile.inc"
 .include "${.CURDIR}/uuid/Makefile.inc"
 .include "${.CURDIR}/xdr/Makefile.inc"
-.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
+.if ${LIBC_ARCH} == "arm" || ${LIBC_ARCH} == "mips"
 .include "${.CURDIR}/softfloat/Makefile.inc"
 .endif
 .if ${MK_NIS} != "no"
@@ -115,14 +124,14 @@ KQSRCS=	adddi3.c anddi3.c ashldi3.c ashr
 KSRCS=	bcmp.c ffs.c ffsl.c fls.c flsl.c index.c mcount.c rindex.c \
 	strcat.c strcmp.c strcpy.c strlen.c strncpy.c
 
-libkern: libkern.gen libkern.${MACHINE_CPUARCH}
+libkern: libkern.gen libkern.${LIBC_ARCH}
 
 libkern.gen: ${KQSRCS} ${KSRCS}
 	cp -p ${.CURDIR}/quad/quad.h ${.ALLSRC} ${DESTDIR}/sys/libkern
 
-libkern.${MACHINE_CPUARCH}:: ${KMSRCS}
+libkern.${LIBC_ARCH}:: ${KMSRCS}
 .if defined(KMSRCS) && !empty(KMSRCS)
-	cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${MACHINE_CPUARCH}
+	cp -p ${.ALLSRC} ${DESTDIR}/sys/libkern/${LIBC_ARCH}
 .endif
 
 .include <bsd.lib.mk>

Modified: user/imp/tbemd/lib/libc/compat-43/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/compat-43/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/compat-43/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 # compat-43 sources
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/compat-43 ${.CURDIR}/compat-43
+.PATH: ${.CURDIR}/${LIBC_ARCH}/compat-43 ${.CURDIR}/compat-43
 
 SRCS+=	creat.c gethostid.c getwd.c killpg.c sethostid.c setpgrp.c \
 	setrgid.c setruid.c sigcompat.c

Modified: user/imp/tbemd/lib/libc/gen/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/gen/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/gen/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 # machine-independent gen sources
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/gen ${.CURDIR}/gen
+.PATH: ${.CURDIR}/${LIBC_ARCH}/gen ${.CURDIR}/gen
 
 SRCS+=  __getosreldate.c __xuname.c \
 	_once_stub.c _pthread_stubs.c _rand48.c _spinlock_stub.c \
@@ -38,9 +38,7 @@ SRCS+=  __getosreldate.c __xuname.c \
 SYM_MAPS+=${.CURDIR}/gen/Symbol.map
 
 # machine-dependent gen sources
-.if exists(${.CURDIR}/${MACHINE_CPUARCH}/gen/Makefile.inc)
-.include "${.CURDIR}/${MACHINE_CPUARCH}/gen/Makefile.inc"
-.endif
+.sinclude "${.CURDIR}/${LIBC_ARCH}/gen/Makefile.inc"
 
 MAN+=	alarm.3 arc4random.3 \
 	basename.3 check_utility_compat.3 clock.3 \

Modified: user/imp/tbemd/lib/libc/locale/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/locale/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/locale/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 # locale sources
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/locale ${.CURDIR}/locale
+.PATH: ${.CURDIR}/${LIBC_ARCH}/locale ${.CURDIR}/locale
 
 SRCS+=	ascii.c big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \
 	gb18030.c gb2312.c gbk.c isctype.c iswctype.c \

Modified: user/imp/tbemd/lib/libc/quad/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/quad/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/quad/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -2,9 +2,9 @@
 # $FreeBSD$
 
 # Quad support, if needed
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/quad ${.CURDIR}/quad
+.PATH: ${.CURDIR}/${LIBC_ARCH}/quad ${.CURDIR}/quad
 
-.if ${MACHINE_CPUARCH} == "i386"
+.if ${LIBC_ARCH} == "i386"
 
 SRCS+=	cmpdi2.c divdi3.c moddi3.c qdivrem.c ucmpdi2.c udivdi3.c umoddi3.c
 

Modified: user/imp/tbemd/lib/libc/softfloat/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/softfloat/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/softfloat/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -2,10 +2,10 @@
 # $FreeBSD$
 
 SOFTFLOAT_BITS?=64
-.PATH:		${MACHINE_CPUARCH}/softfloat \
+.PATH:		${LIBC_ARCH}/softfloat \
 		${.CURDIR}/softfloat/bits${SOFTFLOAT_BITS} ${.CURDIR}/softfloat
 
-CFLAGS+=	-I${.CURDIR}/${MACHINE_CPUARCH}/softfloat -I${.CURDIR}/softfloat
+CFLAGS+=	-I${.CURDIR}/${LIBC_ARCH}/softfloat -I${.CURDIR}/softfloat
 CFLAGS+=	-DSOFTFLOAT_FOR_GCC
 
 SRCS+=		softfloat.c

Modified: user/imp/tbemd/lib/libc/stdlib/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/stdlib/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/stdlib/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 # machine-independent stdlib sources
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/stdlib ${.CURDIR}/stdlib
+.PATH: ${.CURDIR}/${LIBC_ARCH}/stdlib ${.CURDIR}/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 \
@@ -16,7 +16,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate
 SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map
 
 # machine-dependent stdlib sources
-.sinclude "${.CURDIR}/${MACHINE_CPUARCH}/stdlib/Makefile.inc"
+.sinclude "${.CURDIR}/${LIBC_ARCH}/stdlib/Makefile.inc"
 
 MAN+=	a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \
 	div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \

Modified: user/imp/tbemd/lib/libc/string/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/string/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/string/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -1,7 +1,7 @@
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
 # $FreeBSD$
 
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/string ${.CURDIR}/string
+.PATH: ${.CURDIR}/${LIBC_ARCH}/string ${.CURDIR}/string
 
 CFLAGS+= -I${.CURDIR}/locale
 
@@ -26,9 +26,7 @@ SYM_MAPS+=	${.CURDIR}/string/Symbol.map
 
 
 # machine-dependent string sources
-.if exists(${.CURDIR}/${MACHINE_CPUARCH}/string/Makefile.inc)
-.include "${.CURDIR}/${MACHINE_CPUARCH}/string/Makefile.inc"
-.endif
+.sinclude "${.CURDIR}/${LIBC_ARCH}/string/Makefile.inc"
 
 MAN+=	bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
 	memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \

Modified: user/imp/tbemd/lib/libc/sys/Makefile.inc
==============================================================================
--- user/imp/tbemd/lib/libc/sys/Makefile.inc	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/sys/Makefile.inc	Tue Aug 24 21:16:37 2010	(r211775)
@@ -2,7 +2,7 @@
 # $FreeBSD$
 
 # sys sources
-.PATH: ${.CURDIR}/${MACHINE_CPUARCH}/sys ${.CURDIR}/sys
+.PATH: ${.CURDIR}/${LIBC_ARCH}/sys ${.CURDIR}/sys
 
 # Include the generated makefile containing the *complete* list
 # of syscall names in MIASM.
@@ -13,12 +13,10 @@
 # MDASM names override the default syscall names in MIASM.
 # NOASM will prevent the default syscall code from being generated.
 #
-.if exists(${.CURDIR}/${MACHINE_CPUARCH}/sys/Makefile.inc)
-.include "${.CURDIR}/${MACHINE_CPUARCH}/sys/Makefile.inc"
-.endif
+.sinclude "${.CURDIR}/${LIBC_ARCH}/sys/Makefile.inc"
 
 # Sources common to both syscall interfaces:
-SRCS+=	stack_protector.c __error.c
+SRCS+=	stack_protector.c stack_protector_compat.c __error.c
 .if !defined(WITHOUT_SYSCALL_COMPAT)
 SRCS+=	fcntl.c ftruncate.c lseek.c mmap.c pread.c pwrite.c truncate.c
 PSEUDO+= _fcntl.o

Modified: user/imp/tbemd/lib/libc/sys/stack_protector.c
==============================================================================
--- user/imp/tbemd/lib/libc/sys/stack_protector.c	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libc/sys/stack_protector.c	Tue Aug 24 21:16:37 2010	(r211775)
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
 /* $NetBSD: stack_protector.c,v 1.4 2006/11/22 17:23:25 christos Exp $	*/
 /* $OpenBSD: stack_protector.c,v 1.10 2006/03/31 05:34:44 deraadt Exp $	*/
 /*
@@ -116,8 +115,6 @@ __chk_fail(void)
 	__fail("buffer overflow detected; terminated");
 }
 
-#ifdef PIC
-__sym_compat(__stack_chk_fail_local, __stack_chk_fail, FBSD_1.0);
-#else
+#ifndef PIC
 __weak_reference(__stack_chk_fail, __stack_chk_fail_local);
 #endif

Copied: user/imp/tbemd/lib/libc/sys/stack_protector_compat.c (from r211774, head/lib/libc/sys/stack_protector_compat.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/imp/tbemd/lib/libc/sys/stack_protector_compat.c	Tue Aug 24 21:16:37 2010	(r211775, copy of r211774, head/lib/libc/sys/stack_protector_compat.c)
@@ -0,0 +1,20 @@
+/*
+ * Written by Alexander Kabaev <kan at FreeBSD.org>
+ * The file is in public domain.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+void __stack_chk_fail(void);
+
+#ifdef PIC
+void
+__stack_chk_fail_local_hidden(void)
+{
+
+	__stack_chk_fail();
+}
+
+__sym_compat(__stack_chk_fail_local, __stack_chk_fail_local_hidden, FBSD_1.0);
+#endif

Modified: user/imp/tbemd/lib/libthr/arch/powerpc/include/pthread_md.h
==============================================================================
--- user/imp/tbemd/lib/libthr/arch/powerpc/include/pthread_md.h	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libthr/arch/powerpc/include/pthread_md.h	Tue Aug 24 21:16:37 2010	(r211775)
@@ -39,12 +39,16 @@
 #define	CPU_SPINWAIT
 
 #define	DTV_OFFSET		offsetof(struct tcb, tcb_dtv)
+#ifdef __powerpc64__
+#define	TP_OFFSET		0x7010
+#else
 #define	TP_OFFSET		0x7008
+#endif
 
 /*
  * Variant I tcb. The structure layout is fixed, don't blindly
  * change it.
- * %r2 points to end of the structure.
+ * %r2 (32-bit) or %r13 (64-bit) points to end of the structure.
  */
 struct tcb {
 	void			*tcb_dtv;
@@ -57,7 +61,11 @@ void		_tcb_dtor(struct tcb *);
 static __inline void
 _tcb_set(struct tcb *tcb)
 {
+#ifdef __powerpc64__
+	register uint8_t *_tp __asm__("%r13");
+#else
 	register uint8_t *_tp __asm__("%r2");
+#endif
 
 	__asm __volatile("mr %0,%1" : "=r"(_tp) :
 	    "r"((uint8_t *)tcb + TP_OFFSET));
@@ -66,7 +74,11 @@ _tcb_set(struct tcb *tcb)
 static __inline struct tcb *
 _tcb_get(void)
 {
+#ifdef __powerpc64__
+	register uint8_t *_tp __asm__("%r13");
+#else
 	register uint8_t *_tp __asm__("%r2");
+#endif
 
 	return ((struct tcb *)(_tp - TP_OFFSET));
 }

Modified: user/imp/tbemd/lib/libthr/pthread.map
==============================================================================
--- user/imp/tbemd/lib/libthr/pthread.map	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libthr/pthread.map	Tue Aug 24 21:16:37 2010	(r211775)
@@ -342,6 +342,7 @@ FBSDprivate_1.0 {
 	_pthread_timedjoin_np;
 	_pthread_yield;
 	_raise;
+	_setcontext;
 	_sigaction;
 	_sigprocmask;
 	_sigsuspend;
@@ -351,6 +352,7 @@ FBSDprivate_1.0 {
 	_spinlock;
 	_spinlock_debug;
 	_spinunlock;
+	_swapcontext;
 
 	/* Debugger needs these. */
 	_libthr_debug;
@@ -397,4 +399,6 @@ FBSD_1.1 {
 
 FBSD_1.2 {
 	openat;
+	setcontext;
+	swapcontext;
 };

Modified: user/imp/tbemd/lib/libthr/thread/thr_private.h
==============================================================================
--- user/imp/tbemd/lib/libthr/thread/thr_private.h	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libthr/thread/thr_private.h	Tue Aug 24 21:16:37 2010	(r211775)
@@ -66,10 +66,6 @@
 	WEAK_REF(func, SYM_FBP10(sym));			\
 	SYM_DEFAULT(sym, SYM_FBP10(sym), FBSDprivate_1.0)
 
-#ifndef __hidden
-#define __hidden		__attribute__((visibility("hidden")))
-#endif
-
 #include "pthread_md.h"
 #include "thr_umtx.h"
 #include "thread_db.h"
@@ -709,6 +705,12 @@ int	__sys_sigwaitinfo(const sigset_t *se
 int	__sys_nanosleep(const struct timespec *, struct timespec *);
 #endif
 
+/* #include <sys/ucontext.h> */
+#ifdef _SYS_UCONTEXT_H_
+int	__sys_setcontext(const ucontext_t *ucp);
+int	__sys_swapcontext(ucontext_t *oucp, const ucontext_t *ucp);
+#endif
+
 /* #include <unistd.h> */
 #ifdef  _UNISTD_H_
 int     __sys_close(int);

Modified: user/imp/tbemd/lib/libthr/thread/thr_sig.c
==============================================================================
--- user/imp/tbemd/lib/libthr/thread/thr_sig.c	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/lib/libthr/thread/thr_sig.c	Tue Aug 24 21:16:37 2010	(r211775)
@@ -59,7 +59,29 @@ int	_sigwaitinfo(const sigset_t *set, si
 int	__sigwait(const sigset_t *set, int *sig);
 int	_sigwait(const sigset_t *set, int *sig);
 int	__sigsuspend(const sigset_t *sigmask);
+int	_setcontext(const ucontext_t *);
+int	_swapcontext(ucontext_t *, const ucontext_t *);
 
+static void
+remove_thr_signals(sigset_t *set)
+{
+	if (SIGISMEMBER(*set, SIGCANCEL))
+		SIGDELSET(*set, SIGCANCEL);
+}
+
+static const sigset_t *
+thr_remove_thr_signals(const sigset_t *set, sigset_t *newset)
+{
+	const sigset_t *pset;
+
+	if (SIGISMEMBER(*set, SIGCANCEL)) {
+		*newset = *set;
+		SIGDELSET(*newset, SIGCANCEL);
+		pset = newset;
+	} else
+		pset = set;
+	return (pset);
+}
 
 static void
 sigcancel_handler(int sig __unused,
@@ -268,20 +290,6 @@ _pthread_sigmask(int how, const sigset_t
 
 __weak_reference(__sigsuspend, sigsuspend);
 
-static const sigset_t *
-thr_remove_thr_signals(const sigset_t *set, sigset_t *newset)
-{
-	const sigset_t *pset;
-
-	if (SIGISMEMBER(*set, SIGCANCEL)) {
-		*newset = *set;
-		SIGDELSET(*newset, SIGCANCEL);
-		pset = newset;
-	} else
-		pset = set;
-	return (pset);
-}
-
 int
 _sigsuspend(const sigset_t * set)
 {
@@ -389,3 +397,26 @@ __sigwait(const sigset_t *set, int *sig)
 	_thr_cancel_leave_defer(curthread, (ret != 0));
 	return (ret);
 }
+
+__weak_reference(_setcontext, setcontext);
+int
+_setcontext(const ucontext_t *ucp)
+{
+	ucontext_t uc;
+
+	(void) memcpy(&uc, ucp, sizeof (uc));
+	remove_thr_signals(&uc.uc_sigmask);
+
+	return __sys_setcontext(&uc);
+}
+
+__weak_reference(_swapcontext, swapcontext);
+int
+_swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
+{
+	ucontext_t uc;
+
+	(void) memcpy(&uc, ucp, sizeof (uc));
+	remove_thr_signals(&uc.uc_sigmask);
+	return __sys_swapcontext(oucp, &uc);
+}

Modified: user/imp/tbemd/libexec/rtld-elf/rtld.c
==============================================================================
--- user/imp/tbemd/libexec/rtld-elf/rtld.c	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/libexec/rtld-elf/rtld.c	Tue Aug 24 21:16:37 2010	(r211775)
@@ -104,7 +104,6 @@ static void init_dag1(Obj_Entry *, Obj_E
 static void init_rtld(caddr_t, Elf_Auxinfo **);
 static void initlist_add_neededs(Needed_Entry *, Objlist *);
 static void initlist_add_objects(Obj_Entry *, Obj_Entry **, Objlist *);
-static bool is_exported(const Elf_Sym *);
 static void linkmap_add(Obj_Entry *);
 static void linkmap_delete(Obj_Entry *);
 static int load_needed_objects(Obj_Entry *, int);
@@ -197,36 +196,6 @@ extern Elf_Dyn _DYNAMIC;
 int osreldate, pagesize;
 
 /*
- * These are the functions the dynamic linker exports to application
- * programs.  They are the only symbols the dynamic linker is willing
- * to export from itself.
- */
-static func_ptr_type exports[] = {
-    (func_ptr_type) &_rtld_error,
-    (func_ptr_type) &dlclose,
-    (func_ptr_type) &dlerror,
-    (func_ptr_type) &dlopen,
-    (func_ptr_type) &dlsym,
-    (func_ptr_type) &dlfunc,
-    (func_ptr_type) &dlvsym,
-    (func_ptr_type) &dladdr,
-    (func_ptr_type) &dllockinit,
-    (func_ptr_type) &dlinfo,
-    (func_ptr_type) &_rtld_thread_init,
-#ifdef __i386__
-    (func_ptr_type) &___tls_get_addr,
-#endif
-    (func_ptr_type) &__tls_get_addr,
-    (func_ptr_type) &_rtld_allocate_tls,
-    (func_ptr_type) &_rtld_free_tls,
-    (func_ptr_type) &dl_iterate_phdr,
-    (func_ptr_type) &_rtld_atfork_pre,
-    (func_ptr_type) &_rtld_atfork_post,
-    (func_ptr_type) &_rtld_addr_phdr,
-    NULL
-};
-
-/*
  * Global declarations normally provided by crt1.  The dynamic linker is
  * not built with crt1, so we have to provide them ourselves.
  */
@@ -1445,19 +1414,6 @@ initlist_add_objects(Obj_Entry *obj, Obj
 #define FPTR_TARGET(f)	((Elf_Addr) (f))
 #endif
 
-static bool
-is_exported(const Elf_Sym *def)
-{
-    Elf_Addr value;
-    const func_ptr_type *p;
-
-    value = (Elf_Addr)(obj_rtld.relocbase + def->st_value);
-    for (p = exports;  *p != NULL;  p++)
-	if (FPTR_TARGET(*p) == value)
-	    return true;
-    return false;
-}
-
 /*
  * Given a shared object, traverse its list of needed objects, and load
  * each of them.  Returns 0 on success.  Generates an error message and
@@ -2161,12 +2117,11 @@ do_dlsym(void *handle, const char *name,
 	    /*
 	     * Search the dynamic linker itself, and possibly resolve the
 	     * symbol from there.  This is how the application links to
-	     * dynamic linker services such as dlopen.  Only the values listed
-	     * in the "exports" array can be resolved from the dynamic linker.
+	     * dynamic linker services such as dlopen.
 	     */
 	    if (def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) {
 		symp = symlook_obj(name, hash, &obj_rtld, ve, flags);
-		if (symp != NULL && is_exported(symp)) {
+		if (symp != NULL) {
 		    def = symp;
 		    defobj = &obj_rtld;
 		}
@@ -2746,12 +2701,11 @@ symlook_default(const char *name, unsign
     /*
      * Search the dynamic linker itself, and possibly resolve the
      * symbol from there.  This is how the application links to
-     * dynamic linker services such as dlopen.  Only the values listed
-     * in the "exports" array can be resolved from the dynamic linker.
+     * dynamic linker services such as dlopen.
      */
     if (def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) {
 	symp = symlook_obj(name, hash, &obj_rtld, ventry, flags);
-	if (symp != NULL && is_exported(symp)) {
+	if (symp != NULL) {
 	    def = symp;
 	    defobj = &obj_rtld;
 	}

Modified: user/imp/tbemd/sys/amd64/include/trap.h
==============================================================================
--- user/imp/tbemd/sys/amd64/include/trap.h	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/sys/amd64/include/trap.h	Tue Aug 24 21:16:37 2010	(r211775)
@@ -62,6 +62,8 @@
 #define	T_MCHK		28	/* machine check trap */
 #define	T_XMMFLT	29	/* SIMD floating-point exception */
 #define	T_RESERVED	30	/* reserved (unknown) */
+#define	T_DTRACE_RET	31	/* DTrace pid return */
+#define	T_DTRACE_PROBE	32	/* DTrace fasttrap probe */
 
 /* XXX most of the following codes aren't used, but could be. */
 

Modified: user/imp/tbemd/sys/boot/common/ufsread.c
==============================================================================
--- user/imp/tbemd/sys/boot/common/ufsread.c	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/sys/boot/common/ufsread.c	Tue Aug 24 21:16:37 2010	(r211775)
@@ -223,14 +223,19 @@ fsread(ino_t inode, void *buf, size_t nb
 			return -1;
 		n = INO_TO_VBO(n, inode);
 #if defined(UFS1_ONLY)
-		dp1 = ((struct ufs1_dinode *)blkbuf)[n];
+		memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
+		    sizeof(struct ufs1_dinode));
 #elif defined(UFS2_ONLY)
-		dp2 = ((struct ufs2_dinode *)blkbuf)[n];
+		memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
+		    sizeof(struct ufs2_dinode));
 #else
 		if (fs->fs_magic == FS_UFS1_MAGIC)
-			dp1 = ((struct ufs1_dinode *)blkbuf)[n];
+			memcpy(&dp1, (struct ufs1_dinode *)blkbuf + n,
+			    sizeof(struct ufs1_dinode));
 		else
-			dp2 = ((struct ufs2_dinode *)blkbuf)[n];
+			memcpy(&dp2, (struct ufs2_dinode *)blkbuf + n,
+			    sizeof(struct ufs2_dinode));
+
 #endif
 		inomap = inode;
 		fs_off = 0;

Modified: user/imp/tbemd/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
==============================================================================
--- user/imp/tbemd/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Tue Aug 24 20:54:43 2010	(r211774)
+++ user/imp/tbemd/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c	Tue Aug 24 21:16:37 2010	(r211775)
@@ -17,6 +17,10 @@
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
+ *
+ * Portions Copyright 2010 The FreeBSD Foundation
+ *
+ * $FreeBSD$
  */
 
 /*
@@ -24,7 +28,9 @@
  * Use is subject to license terms.
  */
 
+#if defined(sun)
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
+#endif
 
 #include <sys/atomic.h>
 #include <sys/errno.h>
@@ -32,11 +38,15 @@
 #include <sys/modctl.h>
 #include <sys/conf.h>
 #include <sys/systm.h>
+#if defined(sun)
 #include <sys/ddi.h>
+#endif
 #include <sys/sunddi.h>
 #include <sys/cpuvar.h>
 #include <sys/kmem.h>
+#if defined(sun)
 #include <sys/strsubr.h>
+#endif
 #include <sys/fasttrap.h>
 #include <sys/fasttrap_impl.h>
 #include <sys/fasttrap_isa.h>
@@ -44,9 +54,17 @@
 #include <sys/dtrace_impl.h>
 #include <sys/sysmacros.h>
 #include <sys/proc.h>
-#include <sys/priv.h>
 #include <sys/policy.h>
+#if defined(sun)
 #include <util/qsort.h>
+#endif
+#include <sys/mutex.h>
+#include <sys/kernel.h>
+#if !defined(sun)
+#include <sys/user.h>
+#include <sys/dtrace_bsd.h>
+#include <cddl/dev/dtrace/dtrace_cddl.h>
+#endif
 
 /*
  * User-Land Trap-Based Tracing
@@ -125,11 +143,20 @@
  *	never hold the provider lock and creation lock simultaneously
  */
 
-static dev_info_t *fasttrap_devi;
+static d_open_t fasttrap_open;
+static d_ioctl_t fasttrap_ioctl;
+
+static struct cdevsw fasttrap_cdevsw = {
+	.d_version	= D_VERSION,
+	.d_open		= fasttrap_open,
+	.d_ioctl	= fasttrap_ioctl,
+	.d_name		= "fasttrap",
+};
+static struct cdev *fasttrap_cdev;
 static dtrace_meta_provider_id_t fasttrap_meta_id;
 
-static timeout_id_t fasttrap_timeout;
-static kmutex_t fasttrap_cleanup_mtx;
+static struct callout fasttrap_timeout;
+static struct mtx fasttrap_cleanup_mtx;
 static uint_t fasttrap_cleanup_work;
 
 /*
@@ -229,6 +256,7 @@ fasttrap_hash_str(const char *p)
 void
 fasttrap_sigtrap(proc_t *p, kthread_t *t, uintptr_t pc)
 {
+#if defined(sun)
 	sigqueue_t *sqp = kmem_zalloc(sizeof (sigqueue_t), KM_SLEEP);
 
 	sqp->sq_info.si_signo = SIGTRAP;
@@ -241,6 +269,17 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t
 
 	if (t != NULL)
 		aston(t);
+#else
+	ksiginfo_t *ksi = kmem_zalloc(sizeof (ksiginfo_t), KM_SLEEP);
+
+	ksiginfo_init(ksi);
+	ksi->ksi_signo = SIGTRAP;
+	ksi->ksi_code = TRAP_DTRACE;
+	ksi->ksi_addr = (caddr_t)pc;
+	PROC_LOCK(p);
+	(void) tdksignal(t, SIGTRAP, ksi);
+	PROC_UNLOCK(p);
+#endif
 }
 
 /*
@@ -250,17 +289,24 @@ fasttrap_sigtrap(proc_t *p, kthread_t *t
 static void
 fasttrap_mod_barrier(uint64_t gen)
 {
+#if defined(sun)
 	int i;
+#endif
 
 	if (gen < fasttrap_mod_gen)
 		return;
 
 	fasttrap_mod_gen++;
 
+#if defined(sun)
 	for (i = 0; i < NCPU; i++) {
 		mutex_enter(&cpu_core[i].cpuc_pid_lock);
 		mutex_exit(&cpu_core[i].cpuc_pid_lock);
 	}
+#else
+	/* XXX */
+	__asm __volatile("": : :"memory");
+#endif
 }
 
 /*
@@ -274,16 +320,15 @@ fasttrap_pid_cleanup_cb(void *data)
 	fasttrap_provider_t **fpp, *fp;
 	fasttrap_bucket_t *bucket;
 	dtrace_provider_id_t provid;
-	int i, later;
+	int i, later = 0;
 
 	static volatile int in = 0;
 	ASSERT(in == 0);
 	in = 1;
 
-	mutex_enter(&fasttrap_cleanup_mtx);
 	while (fasttrap_cleanup_work) {
 		fasttrap_cleanup_work = 0;
-		mutex_exit(&fasttrap_cleanup_mtx);
+		mtx_unlock(&fasttrap_cleanup_mtx);
 
 		later = 0;
 
@@ -349,10 +394,12 @@ fasttrap_pid_cleanup_cb(void *data)
 			mutex_exit(&bucket->ftb_mtx);
 		}
 
-		mutex_enter(&fasttrap_cleanup_mtx);
+		mtx_lock(&fasttrap_cleanup_mtx);
 	}
 
+#if 0
 	ASSERT(fasttrap_timeout != 0);
+#endif
 
 	/*
 	 * If we were unable to remove a retired provider, try again after
@@ -364,14 +411,17 @@ fasttrap_pid_cleanup_cb(void *data)
 	 * get a chance to do that work if and when the timeout is reenabled
 	 * (if detach fails).
 	 */
-	if (later > 0 && fasttrap_timeout != (timeout_id_t)1)
-		fasttrap_timeout = timeout(&fasttrap_pid_cleanup_cb, NULL, hz);
+	if (later > 0 && callout_active(&fasttrap_timeout))
+		callout_reset(&fasttrap_timeout, hz, &fasttrap_pid_cleanup_cb,
+		    NULL);
 	else if (later > 0)
 		fasttrap_cleanup_work = 1;
-	else
-		fasttrap_timeout = 0;
+	else {
+#if !defined(sun)
+		/* Nothing to be done for FreeBSD */
+#endif
+	}
 
-	mutex_exit(&fasttrap_cleanup_mtx);
 	in = 0;
 }
 
@@ -381,11 +431,11 @@ fasttrap_pid_cleanup_cb(void *data)
 static void
 fasttrap_pid_cleanup(void)
 {
-	mutex_enter(&fasttrap_cleanup_mtx);
+
+	mtx_lock(&fasttrap_cleanup_mtx);
 	fasttrap_cleanup_work = 1;
-	if (fasttrap_timeout == 0)
-		fasttrap_timeout = timeout(&fasttrap_pid_cleanup_cb, NULL, 1);
-	mutex_exit(&fasttrap_cleanup_mtx);
+	callout_reset(&fasttrap_timeout, 1, &fasttrap_pid_cleanup_cb, NULL);
+	mtx_unlock(&fasttrap_cleanup_mtx);
 }
 
 /*
@@ -400,9 +450,23 @@ fasttrap_fork(proc_t *p, proc_t *cp)
 	pid_t ppid = p->p_pid;
 	int i;
 
+#if defined(sun)
 	ASSERT(curproc == p);
 	ASSERT(p->p_proc_flag & P_PR_LOCK);
+#else
+	PROC_LOCK_ASSERT(p, MA_OWNED);
+#endif
+#if defined(sun)
 	ASSERT(p->p_dtrace_count > 0);
+#else
+	/*
+	 * This check is purposely here instead of in kern_fork.c because,
+	 * for legal resons, we cannot include the dtrace_cddl.h header
+	 * inside kern_fork.c and insert if-clause there.
+	 */
+	if (p->p_dtrace_count == 0)
+		return;
+#endif
 	ASSERT(cp->p_dtrace_count == 0);
 
 	/*
@@ -419,9 +483,11 @@ fasttrap_fork(proc_t *p, proc_t *cp)
 	 * We don't have to worry about the child process disappearing
 	 * because we're in fork().
 	 */
-	mutex_enter(&cp->p_lock);

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


More information about the svn-src-user mailing list