[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Fri Mar 2 15:38:01 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/17241e798bc0
changeset: 361:17241e798bc0
user:      ray at terran.dlink.ua
date:      Fri Mar 02 16:56:20 2012 +0200
description:
Update to FreeBSD-HEAD @232391

diffstat:

 head/libexec/mail.local/Makefile          |    6 +-
 head/libexec/rtld-elf/arm/reloc.c         |   81 +++++++++++++++++-
 head/libexec/rtld-elf/arm/rtld_machdep.h  |   10 +-
 head/libexec/rtld-elf/mips/reloc.c        |  134 ++++++++++++++++++++++++++---
 head/libexec/rtld-elf/mips/rtld_machdep.h |   26 ++++-
 head/libexec/rtld-elf/rtld.c              |   10 +-
 head/libexec/smrsh/Makefile               |    6 +-
 head/libexec/tftpd/tftp-io.c              |    5 +-
 head/libexec/ypxfr/Makefile               |    4 +-
 9 files changed, 235 insertions(+), 47 deletions(-)

diffs (545 lines):

diff -r a9e795a22198 -r 17241e798bc0 head/libexec/mail.local/Makefile
--- a/head/libexec/mail.local/Makefile	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/mail.local/Makefile	Fri Mar 02 16:56:20 2012 +0200
@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.1 (Berkeley) 7/19/93
-# $FreeBSD: head/libexec/mail.local/Makefile 228590 2011-12-16 17:02:25Z dim $
+# $FreeBSD: head/libexec/mail.local/Makefile 232263 2012-02-28 18:30:18Z dim $
 
 SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
 .PATH:	${SENDMAIL_DIR}/mail.local
@@ -12,12 +12,10 @@
 WARNS?=	2
 WFORMAT=0
 
-.if ${CC:T:Mclang} == "clang"
 # Unfortunately, clang gives warnings about sendmail code that cannot
 # be turned off yet.  Since this is contrib code, and we don't really
 # care about the warnings, just make them non-fatal for now.
-NO_WERROR=
-.endif
+NO_WERROR.clang=
 
 LIBSMDIR=	${.OBJDIR}/../../lib/libsm
 LIBSM=		${LIBSMDIR}/libsm.a
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/rtld-elf/arm/reloc.c
--- a/head/libexec/rtld-elf/arm/reloc.c	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/rtld-elf/arm/reloc.c	Fri Mar 02 16:56:20 2012 +0200
@@ -1,7 +1,7 @@
 /*	$NetBSD: mdreloc.c,v 1.23 2003/07/26 15:04:38 mrg Exp $	*/
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/libexec/rtld-elf/arm/reloc.c 228435 2011-12-12 11:03:14Z kib $");
+__FBSDID("$FreeBSD: head/libexec/rtld-elf/arm/reloc.c 231618 2012-02-14 00:16:34Z gonzo $");
 #include <sys/param.h>
 #include <sys/mman.h>
 
@@ -10,6 +10,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+
+#include "machine/sysarch.h"
+
 #include "debug.h"
 #include "rtld.h"
 
@@ -233,6 +236,63 @@
 			dbg("COPY (avoid in main)");
 			break;
 
+		case R_ARM_TLS_DTPOFF32:
+			def = find_symdef(symnum, obj, &defobj, false, cache,
+			    lockstate);
+			if (def == NULL)
+				return -1;
+
+			tmp = (Elf_Addr)(def->st_value);
+			if (__predict_true(RELOC_ALIGNED_P(where)))
+				*where = tmp;
+			else
+				store_ptr(where, tmp);
+
+			dbg("TLS_DTPOFF32 %s in %s --> %p",
+			    obj->strtab + obj->symtab[symnum].st_name,
+			    obj->path, (void *)tmp);
+
+			break;
+		case R_ARM_TLS_DTPMOD32:
+			def = find_symdef(symnum, obj, &defobj, false, cache,
+			    lockstate);
+			if (def == NULL)
+				return -1;
+
+			tmp = (Elf_Addr)(defobj->tlsindex);
+			if (__predict_true(RELOC_ALIGNED_P(where)))
+				*where = tmp;
+			else
+				store_ptr(where, tmp);
+
+			dbg("TLS_DTPMOD32 %s in %s --> %p",
+			    obj->strtab + obj->symtab[symnum].st_name,
+			    obj->path, (void *)tmp);
+
+			break;
+
+		case R_ARM_TLS_TPOFF32:
+			def = find_symdef(symnum, obj, &defobj, false, cache,
+			    lockstate);
+			if (def == NULL)
+				return -1;
+
+			if (!defobj->tls_done && allocate_tls_offset(obj))
+				return -1;
+
+			/* XXX: FIXME */
+			tmp = (Elf_Addr)def->st_value + defobj->tlsoffset +
+			    TLS_TCB_SIZE;
+			if (__predict_true(RELOC_ALIGNED_P(where)))
+				*where = tmp;
+			else
+				store_ptr(where, tmp);
+			dbg("TLS_TPOFF32 %s in %s --> %p",
+			    obj->strtab + obj->symtab[symnum].st_name,
+			    obj->path, (void *)tmp);
+			break;
+
+
 		default:
 			dbg("sym = %lu, type = %lu, offset = %p, "
 			    "contents = %p, symbol = %s",
@@ -369,11 +429,26 @@
 void
 allocate_initial_tls(Obj_Entry *objs)
 {
-	
+	void **_tp = (void **)ARM_TP_ADDRESS;
+
+	/*
+	* Fix the size of the static TLS block by using the maximum
+	* offset allocated so far and adding a bit for dynamic modules to
+	* use.
+	*/
+
+	tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA;
+
+	(*_tp) = (void *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8);
 }
 
 void *
 __tls_get_addr(tls_index* ti)
 {
-	return (NULL);
+	void **_tp = (void **)ARM_TP_ADDRESS;
+	char *p;
+
+	p = tls_get_addr_common((Elf_Addr **)(*_tp), ti->ti_module, ti->ti_offset);
+
+	return (p);
 }
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/rtld-elf/arm/rtld_machdep.h
--- a/head/libexec/rtld-elf/arm/rtld_machdep.h	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/rtld-elf/arm/rtld_machdep.h	Fri Mar 02 16:56:20 2012 +0200
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: head/libexec/rtld-elf/arm/rtld_machdep.h 231618 2012-02-14 00:16:34Z gonzo $
  */
 
 #ifndef RTLD_MACHDEP_H
@@ -48,20 +48,20 @@
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
 	
+#define	TLS_TCB_SIZE	8
 typedef struct {
 	unsigned long ti_module;
 	unsigned long ti_offset;
 } tls_index;
 
 #define round(size, align) \
-	(((size) + (align) - 1) & ~((align) - 1))
+    (((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-	round(size, align)                                     
+    round(8, align)
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
-	    round(prev_offset + prev_size, align)
+    round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)    ((off) + (size))
 	
-	
 /*
  * Lazy binding entry point, called via PLT.
  */
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/rtld-elf/mips/reloc.c
--- a/head/libexec/rtld-elf/mips/reloc.c	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/rtld-elf/mips/reloc.c	Fri Mar 02 16:56:20 2012 +0200
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/libexec/rtld-elf/mips/reloc.c 229780 2012-01-07 16:09:54Z uqs $");
+__FBSDID("$FreeBSD: head/libexec/rtld-elf/mips/reloc.c 231491 2012-02-11 00:54:57Z gonzo $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -37,6 +37,9 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <inttypes.h>
+
+#include <machine/sysarch.h>
 
 #include "debug.h"
 #include "rtld.h"
@@ -244,9 +247,9 @@
 		_rtld_error("bind failed no symbol");
 
         target = (Elf_Addr)(defobj->relocbase + def->st_value);
-        dbg("bind now/fixup at %s sym # %d in %s --> was=%p new=%p",
+        dbg("bind now/fixup at %s sym # %jd in %s --> was=%p new=%p",
 	    obj->path,
-	    reloff, defobj->strtab + def->st_name, 
+	    (intmax_t)reloff, defobj->strtab + def->st_name, 
 	    (void *)got[obj->local_gotno + reloff - obj->gotsym],
 	    (void *)target);
         got[obj->local_gotno + reloff - obj->gotsym] = target;
@@ -283,8 +286,8 @@
 
 	/* Relocate the local GOT entries */
 	got += i;
-	dbg("got:%p for %d entries adding %x",
-	    got, obj->local_gotno, (uint32_t)obj->relocbase);
+	dbg("got:%p for %d entries adding %p",
+	    got, obj->local_gotno, obj->relocbase);
 	for (; i < obj->local_gotno; i++) {
 		*got += (Elf_Addr)obj->relocbase;
 		got++;
@@ -339,8 +342,8 @@
 			 */
 			*got = sym->st_value + (Elf_Addr)obj->relocbase;
 			if ((Elf_Addr)(*got) == (Elf_Addr)obj->relocbase) {
-				dbg("Warning2, i:%d maps to relocbase address:%x",
-				    i, (uint32_t)obj->relocbase);
+				dbg("Warning2, i:%d maps to relocbase address:%p",
+				    i, obj->relocbase);
 			}
 
 		} else if (sym->st_info == ELF_ST_INFO(STB_GLOBAL, STT_SECTION)) {
@@ -349,8 +352,8 @@
 				*got = sym->st_value +
 				    (Elf_Addr)obj->relocbase;
 				if ((Elf_Addr)(*got) == (Elf_Addr)obj->relocbase) {
-					dbg("Warning3, i:%d maps to relocbase address:%x",
-					    i, (uint32_t)obj->relocbase);
+					dbg("Warning3, i:%d maps to relocbase address:%p",
+					    i, obj->relocbase);
 				}
 			}
 		} else {
@@ -363,8 +366,8 @@
 			}
 			*got = def->st_value + (Elf_Addr)defobj->relocbase;
 			if ((Elf_Addr)(*got) == (Elf_Addr)obj->relocbase) {
-				dbg("Warning4, i:%d maps to relocbase address:%x",
-				    i, (uint32_t)obj->relocbase);
+				dbg("Warning4, i:%d maps to relocbase address:%p",
+				    i, obj->relocbase);
 				dbg("via first obj symbol %s",
 				    obj->strtab + obj->symtab[i].st_name);
 				dbg("found in obj %p:%s",
@@ -443,6 +446,89 @@
 			break;
 		}
 
+#ifdef __mips_n64
+		case R_TYPE(TLS_DTPMOD64):
+#else
+		case R_TYPE(TLS_DTPMOD32): 
+#endif
+		{
+
+			const size_t rlen = sizeof(Elf_Addr);
+			Elf_Addr old = load_ptr(where, rlen);
+			Elf_Addr val = old;
+
+        		def = find_symdef(r_symndx, obj, &defobj, false, NULL,
+	    			lockstate);
+			if (def == NULL)
+				return -1;
+
+			val += (Elf_Addr)defobj->tlsindex;
+
+			store_ptr(where, val, rlen);
+			dbg("DTPMOD %s in %s %p --> %p in %s",
+			    obj->strtab + obj->symtab[r_symndx].st_name,
+			    obj->path, (void *)old, (void*)val, defobj->path);
+			break;
+		}
+
+#ifdef __mips_n64
+		case R_TYPE(TLS_DTPREL64):
+#else
+		case R_TYPE(TLS_DTPREL32):
+#endif
+		{
+			const size_t rlen = sizeof(Elf_Addr);
+			Elf_Addr old = load_ptr(where, rlen);
+			Elf_Addr val = old;
+
+        		def = find_symdef(r_symndx, obj, &defobj, false, NULL,
+	    			lockstate);
+			if (def == NULL)
+				return -1;
+
+			if (!defobj->tls_done && allocate_tls_offset(obj))
+				return -1;
+
+			val += (Elf_Addr)def->st_value - TLS_DTP_OFFSET;
+			store_ptr(where, val, rlen);
+
+			dbg("DTPREL %s in %s %p --> %p in %s",
+			    obj->strtab + obj->symtab[r_symndx].st_name,
+			    obj->path, (void*)old, (void *)val, defobj->path);
+			break;
+		}
+
+#ifdef __mips_n64
+		case R_TYPE(TLS_TPREL64):
+#else
+		case R_TYPE(TLS_TPREL32):
+#endif
+		{
+			const size_t rlen = sizeof(Elf_Addr);
+			Elf_Addr old = load_ptr(where, rlen);
+			Elf_Addr val = old;
+
+        		def = find_symdef(r_symndx, obj, &defobj, false, NULL,
+	    			lockstate);
+
+			if (def == NULL)
+				return -1;
+
+			if (!defobj->tls_done && allocate_tls_offset(obj))
+				return -1;
+
+			val += (Elf_Addr)(def->st_value + defobj->tlsoffset
+			    - TLS_TP_OFFSET - TLS_TCB_SIZE);
+			store_ptr(where, val, rlen);
+
+			dbg("TPREL %s in %s %p --> %p in %s",
+			    obj->strtab + obj->symtab[r_symndx].st_name,
+			    obj->path, (void*)old, (void *)val, defobj->path);
+			break;
+		}
+
+
+
 		default:
 			dbg("sym = %lu, type = %lu, offset = %p, "
 			    "contents = %p, symbol = %s",
@@ -470,8 +556,8 @@
 	const Elf_Rel *rellim;
 	const Elf_Rel *rel;
 		
-	dbg("reloc_plt obj:%p pltrel:%p sz:%d", obj, obj->pltrel, (int)obj->pltrelsize);
-	dbg("gottable %p num syms:%d", obj->pltgot, obj->symtabno );
+	dbg("reloc_plt obj:%p pltrel:%p sz:%s", obj, obj->pltrel, (int)obj->pltrelsize);
+	dbg("gottable %p num syms:%s", obj->pltgot, obj->symtabno );
 	dbg("*****************************************************");
 	rellim = (const Elf_Rel *)((char *)obj->pltrel +
 	    obj->pltrelsize);
@@ -527,11 +613,31 @@
 void
 allocate_initial_tls(Obj_Entry *objs)
 {
+	char *tls;
 	
+	/*
+	 * Fix the size of the static TLS block by using the maximum
+	 * offset allocated so far and adding a bit for dynamic modules to
+	 * use.
+	 */
+	tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA;
+
+	tls = ((char *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8) 
+	    + TLS_TP_OFFSET + TLS_TCB_SIZE);
+
+	sysarch(MIPS_SET_TLS, tls);
 }
 
 void *
 __tls_get_addr(tls_index* ti)
 {
-	return (NULL);
+	Elf_Addr** tls;
+	char *p;
+
+	sysarch(MIPS_GET_TLS, &tls);
+
+	p = tls_get_addr_common((Elf_Addr**)((Elf_Addr)tls - TLS_TP_OFFSET 
+	    - TLS_TCB_SIZE), ti->ti_module, ti->ti_offset + TLS_DTP_OFFSET);
+
+	return (p);
 }
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/rtld-elf/mips/rtld_machdep.h
--- a/head/libexec/rtld-elf/mips/rtld_machdep.h	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/rtld-elf/mips/rtld_machdep.h	Fri Mar 02 16:56:20 2012 +0200
@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: head/libexec/rtld-elf/mips/rtld_machdep.h 231491 2012-02-11 00:54:57Z gonzo $
  */
 
 #ifndef RTLD_MACHDEP_H
@@ -47,21 +47,33 @@
 
 #define call_initfini_pointer(obj, target) \
 	(((InitFunc)(target))())
-	
+
+/*
+ * TLS
+ */
+
+#define TLS_TP_OFFSET	0x7000
+#define TLS_DTP_OFFSET	0x8000
+
+#ifdef __mips_n64
+#define TLS_TCB_SIZE	16
+#else
+#define TLS_TCB_SIZE	8
+#endif
+
 typedef struct {
 	unsigned long ti_module;
 	unsigned long ti_offset;
 } tls_index;
 
 #define round(size, align) \
-	(((size) + (align) - 1) & ~((align) - 1))
+    (((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-	round(size, align)                                     
+    round(TLS_TCB_SIZE, align)
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
-	    round(prev_offset + prev_size, align)
+    round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)    ((off) + (size))
-	
-	
+
 /*
  * Lazy binding entry point, called via PLT.
  */
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/rtld-elf/rtld.c
--- a/head/libexec/rtld-elf/rtld.c	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/rtld-elf/rtld.c	Fri Mar 02 16:56:20 2012 +0200
@@ -24,7 +24,7 @@
  * (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: head/libexec/rtld-elf/rtld.c 230784 2012-01-30 19:52:17Z kib $
+ * $FreeBSD: head/libexec/rtld-elf/rtld.c 231618 2012-02-14 00:16:34Z gonzo $
  */
 
 /*
@@ -757,6 +757,7 @@
     if (msg == NULL)
 	msg = "Fatal error";
     rtld_fdputstr(STDERR_FILENO, msg);
+    rtld_fdputchar(STDERR_FILENO, '\n');
     _exit(1);
 }
 
@@ -3541,9 +3542,7 @@
     return (void*) (dtv[index + 1] + offset);
 }
 
-/* XXX not sure what variants to use for arm. */
-
-#if defined(__ia64__) || defined(__powerpc__)
+#if defined(__arm__) || defined(__ia64__) || defined(__mips__) || defined(__powerpc__)
 
 /*
  * Allocate Static TLS using the Variant I method.
@@ -3624,8 +3623,7 @@
 
 #endif
 
-#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \
-    defined(__arm__) || defined(__mips__)
+#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__)
 
 /*
  * Allocate Static TLS using the Variant II method.
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/smrsh/Makefile
--- a/head/libexec/smrsh/Makefile	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/smrsh/Makefile	Fri Mar 02 16:56:20 2012 +0200
@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.1 (Berkeley) 7/2/95
-# $FreeBSD: head/libexec/smrsh/Makefile 228590 2011-12-16 17:02:25Z dim $
+# $FreeBSD: head/libexec/smrsh/Makefile 232263 2012-02-28 18:30:18Z dim $
 
 SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
 .PATH:	${SENDMAIL_DIR}/smrsh
@@ -17,12 +17,10 @@
 
 WARNS?=	2
 
-.if ${CC:T:Mclang} == "clang"
 # Unfortunately, clang gives warnings about sendmail code that cannot
 # be turned off yet.  Since this is contrib code, and we don't really
 # care about the warnings, just make them non-fatal for now.
-NO_WERROR=
-.endif
+NO_WERROR.clang=
 
 SRCS+=	sm_os.h
 CLEANFILES+=sm_os.h
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/tftpd/tftp-io.c
--- a/head/libexec/tftpd/tftp-io.c	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/tftpd/tftp-io.c	Fri Mar 02 16:56:20 2012 +0200
@@ -24,7 +24,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-io.c 229904 2012-01-10 02:55:35Z eadler $");
+__FBSDID("$FreeBSD: head/libexec/tftpd/tftp-io.c 231973 2012-02-21 14:59:07Z emaste $");
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -463,7 +463,8 @@
 	}
 
 	if (pkt->th_opcode == ERROR) {
-		tftp_log(LOG_ERR, "Got ERROR packet: %s", pkt->th_msg);
+		tftp_log(pkt->th_code == EUNDEF ? LOG_DEBUG : LOG_ERR,
+		    "Got ERROR packet: %s", pkt->th_msg);
 		return (RP_ERROR);
 	}
 
diff -r a9e795a22198 -r 17241e798bc0 head/libexec/ypxfr/Makefile
--- a/head/libexec/ypxfr/Makefile	Fri Mar 02 16:56:09 2012 +0200
+++ b/head/libexec/ypxfr/Makefile	Fri Mar 02 16:56:20 2012 +0200
@@ -1,4 +1,4 @@
-# $FreeBSD$
+# $FreeBSD: head/libexec/ypxfr/Makefile 231118 2012-02-07 09:27:07Z dim $
 
 PROG=	ypxfr
 SRCS=	yp_dblookup.c yp_dbwrite.c yp_error.c \
@@ -22,7 +22,7 @@
 CLEANFILES= ${GENSRCS}
 
 RPCDIR= ${.CURDIR}/../../include/rpcsvc
-RPCGEN= rpcgen -I -C
+RPCGEN=	RPCGEN_CPP=${CPP:Q} rpcgen -I -C
 
 ypxfr_clnt.c: ${RPCDIR}/yp.x
 	rm -f ${.TARGET}


More information about the Zrouter-src-freebsd mailing list