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

[commits] r8624 - in /trunk: libc/ libc/resolv/ libc/sysdeps/powerpc/powerpc32/ libc/sysdeps/x86_64/elf/ libc/sysdeps/x86_64/multiarch...



Author: joseph
Date: Tue Jun 30 13:19:02 2009
New Revision: 8624

Log:
Merge changes between r8602 and r8623 from /fsf/trunk.

Modified:
    trunk/libc/ChangeLog
    trunk/libc/resolv/res_init.c
    trunk/libc/resolv/res_send.c
    trunk/libc/resolv/resolv.h
    trunk/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S
    trunk/libc/sysdeps/x86_64/elf/configure
    trunk/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
    trunk/libc/sysdeps/x86_64/multiarch/init-arch.c
    trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
    trunk/ports/ChangeLog.arm
    trunk/ports/sysdeps/arm/eabi/Makefile

Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Tue Jun 30 13:19:02 2009
@@ -1,3 +1,29 @@
+2009-06-26  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/ifunc-defines.sym (FAMILIY_OFFSET): Define.
+	(MODEL_OFFSET): Define.
+	* sysdeps/x86_64/multiarch/init-arch.h (cpu_features): Add
+	family and model.
+	* sysdeps/x86_64/multiarch/init-arch.c (__init_cpu_features): Break
+	out common code into new function get_common_indeces. Determine
+	extended family and model for Intel processors.
+
+2009-06-26  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* resolv/resolv.h: Define RES_SNGLKUPREOP.
+	* resolv/res_init.c (res_setoptions): Recognize single-request-reopen
+	option.
+	* resolv/res_send.c (reopen): New function.  Broken out of...
+	(send_dg): ... here.  Recognize RES_SNGLKUPREOP.  Implement second
+	fallback mechanism.  If single-request fails switch to
+	single-request-reopen mode which opens a new socket for the second
+	request.
+
+2009-06-25  Andreas Schwab  <aschwab@xxxxxxxxxx>
+
+	* sysdeps/powerpc/powerpc32/____longjmp_chk.S (LOAD_ARG): Define.
+	(CHECK_SP): Use it.
+
 2009-06-24  Andreas Schwab  <aschwab@xxxxxxxxxx>
 
 	* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S: Fix cfa offset

Modified: trunk/libc/resolv/res_init.c
==============================================================================
--- trunk/libc/resolv/res_init.c (original)
+++ trunk/libc/resolv/res_init.c Tue Jun 30 13:19:02 2009
@@ -540,6 +540,9 @@
 			statp->options |= RES_NOCHECKNAME;
                 } else if (!strncmp(cp, "edns0", sizeof("edns0") - 1)) {
 			statp->options |= RES_USE_EDNS0;
+                } else if (!strncmp(cp, "single-request-reopen",
+				    sizeof("single-request-reopen") - 1)) {
+			statp->options |= RES_SNGLKUPREOP;
                 } else if (!strncmp(cp, "single-request",
 				    sizeof("single-request") - 1)) {
 			statp->options |= RES_SNGLKUP;

Modified: trunk/libc/resolv/res_send.c
==============================================================================
--- trunk/libc/resolv/res_send.c (original)
+++ trunk/libc/resolv/res_send.c Tue Jun 30 13:19:02 2009
@@ -908,24 +908,11 @@
 }
 
 static int
-send_dg(res_state statp,
-	const u_char *buf, int buflen, const u_char *buf2, int buflen2,
-	u_char **ansp, int *anssizp,
-	int *terrno, int ns, int *v_circuit, int *gotsomewhere, u_char **anscp,
-	u_char **ansp2, int *anssizp2, int *resplen2)
+reopen (res_state statp, int *terrno, int ns)
 {
-	const HEADER *hp = (HEADER *) buf;
-	const HEADER *hp2 = (HEADER *) buf2;
-	u_char *ans = *ansp;
-	int orig_anssizp = *anssizp;
-	struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
-	struct timespec now, timeout, finish;
-	struct pollfd pfd[1];
-        int ptimeout;
-	struct sockaddr_in6 from;
-	int resplen, n;
-
 	if (EXT(statp).nssocks[ns] == -1) {
+		struct sockaddr_in6 *nsap = EXT(statp).nsaddrs[ns];
+
 		/* only try IPv6 if IPv6 NS and if not failed before */
 		if ((EXT(statp).nscount6 > 0) && !statp->ipv6_unavail) {
 			if (__builtin_expect (__have_o_nonblock >= 0, 1)) {
@@ -1000,6 +987,26 @@
 		}
 	}
 
+	return 1;
+}
+
+static int
+send_dg(res_state statp,
+	const u_char *buf, int buflen, const u_char *buf2, int buflen2,
+	u_char **ansp, int *anssizp,
+	int *terrno, int ns, int *v_circuit, int *gotsomewhere, u_char **anscp,
+	u_char **ansp2, int *anssizp2, int *resplen2)
+{
+	const HEADER *hp = (HEADER *) buf;
+	const HEADER *hp2 = (HEADER *) buf2;
+	u_char *ans = *ansp;
+	int orig_anssizp = *anssizp;
+	struct timespec now, timeout, finish;
+	struct pollfd pfd[1];
+        int ptimeout;
+	struct sockaddr_in6 from;
+	int resplen, n;
+
 	/*
 	 * Compute time for the total operation.
 	 */
@@ -1008,8 +1015,15 @@
 		seconds /= statp->nscount;
 	if (seconds <= 0)
 		seconds = 1;
-	bool single_request = (statp->options & RES_SNGLKUP) != 0;// XXX
+	bool single_request = (statp->options & RES_SNGLKUP) != 0;
+	bool single_request_reopen = (statp->options & RES_SNGLKUPREOP) != 0;
 	int save_gotsomewhere = *gotsomewhere;
+
+	int retval;
+ retry_reopen:
+	retval = reopen (statp, terrno, ns);
+	if (retval <= 0)
+		return retval;
  retry:
 	evNowTime(&now);
 	evConsTime(&timeout, seconds, 0);
@@ -1064,6 +1078,14 @@
 			*gotsomewhere = save_gotsomewhere;
 			goto retry;
 		      }
+		    else if (!single_request_reopen)
+		      {
+			statp->options |= RES_SNGLKUPREOP;
+			single_request_reopen = true;
+			*gotsomewhere = save_gotsomewhere;
+			__res_iclose (statp, false);
+			goto retry_reopen;
+		      }
 
 		    *resplen2 = 1;
 		    return resplen;
@@ -1092,7 +1114,8 @@
 			Perror(statp, stderr, "send", errno);
 			goto err_out;
 		}
-		if (nwritten != 0 || buf2 == NULL || single_request)
+		if (nwritten != 0 || buf2 == NULL
+		    || single_request || single_request_reopen)
 		  pfd[0].events = POLLIN;
 		else
 		  pfd[0].events = POLLIN | POLLOUT;
@@ -1306,8 +1329,15 @@
 			recvresp2 = 1;
 		/* Repeat waiting if we have a second answer to arrive.  */
 		if ((recvresp1 & recvresp2) == 0) {
-			if (single_request)
+			if (single_request || single_request_reopen) {
 				pfd[0].events = POLLOUT;
+				if (single_request_reopen) {
+					__res_iclose (statp, false);
+					retval = reopen (statp, terrno, ns);
+					if (retval <= 0)
+						return retval;
+				}
+			}
 			goto wait;
 		}
 		/*

Modified: trunk/libc/resolv/resolv.h
==============================================================================
--- trunk/libc/resolv/resolv.h (original)
+++ trunk/libc/resolv/resolv.h Tue Jun 30 13:19:02 2009
@@ -216,6 +216,8 @@
 					   reverse lookup */
 #define RES_USE_EDNS0	0x00100000	/* Use EDNS0.  */
 #define RES_SNGLKUP	0x00200000	/* one outstanding request at a time */
+#define RES_SNGLKUPREOP	0x00400000	/* -"-, but open new socket for each
+					   request */
 
 #define RES_DEFAULT	(RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)
 

Modified: trunk/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S
==============================================================================
--- trunk/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S (original)
+++ trunk/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S Tue Jun 30 13:19:02 2009
@@ -26,11 +26,30 @@
 
 #define __longjmp ____longjmp_chk
 
+#ifdef PIC
+# ifdef HAVE_ASM_PPC_REL16
+#  define LOAD_ARG \
+	bcl	20,31,1f;				\
+1:	mflr	r3;					\
+	addis	r3,r3,_GLOBAL_OFFSET_TABLE_-1b@ha;	\
+	addi	r3,r3,_GLOBAL_OFFSET_TABLE_-1b@l;	\
+	lwz	r3,.LC0@got(r3)
+# else
+#  define LOAD_ARG \
+	bl	_GLOBAL_OFFSET_TABLE_-4@local;		\
+	mflr	r3;					\
+	lwz	r3,.LC0@got(r3)
+# endif
+#else
+# define LOAD_ARG \
+	lis	r3,.LC0@ha;				\
+	la	r3,.LC0@l(r3)
+#endif
+
 #define CHECK_SP(reg) \
 	cmplw	reg, r1;				\
 	bge+	.Lok;					\
-	lis	r3,.LC0@ha;				\
-	la	r3,.LC0@l(r3);				\
+	LOAD_ARG;					\
 	bl	HIDDEN_JUMPTARGET (__fortify_fail);	\
 .Lok:
 

Modified: trunk/libc/sysdeps/x86_64/elf/configure
==============================================================================
--- trunk/libc/sysdeps/x86_64/elf/configure (original)
+++ trunk/libc/sysdeps/x86_64/elf/configure Tue Jun 30 13:19:02 2009
@@ -3,8 +3,8 @@
 
 if test "$usetls" != no; then
 # Check for support of thread-local storage handling in assembler and linker.
-{ echo "$as_me:$LINENO: checking for x86-64 TLS support" >&5
-echo $ECHO_N "checking for x86-64 TLS support... $ECHO_C" >&6; }
+echo "$as_me:$LINENO: checking for x86-64 TLS support" >&5
+echo $ECHO_N "checking for x86-64 TLS support... $ECHO_C" >&6
 if test "${libc_cv_x86_64_tls+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -33,8 +33,8 @@
 fi
 rm -f conftest*
 fi
-{ echo "$as_me:$LINENO: result: $libc_cv_x86_64_tls" >&5
-echo "${ECHO_T}$libc_cv_x86_64_tls" >&6; }
+echo "$as_me:$LINENO: result: $libc_cv_x86_64_tls" >&5
+echo "${ECHO_T}$libc_cv_x86_64_tls" >&6
 if test $libc_cv_x86_64_tls = yes; then
   cat >>confdefs.h <<\_ACEOF
 #define HAVE_TLS_SUPPORT 1

Modified: trunk/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
==============================================================================
--- trunk/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym (original)
+++ trunk/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym Tue Jun 30 13:19:02 2009
@@ -11,5 +11,7 @@
 CPUID_EBX_OFFSET	offsetof (struct cpuid_registers, ebx)
 CPUID_ECX_OFFSET	offsetof (struct cpuid_registers, ecx)
 CPUID_EDX_OFFSET	offsetof (struct cpuid_registers, edx)
+FAMILY_OFFSET		offsetof (struct cpu_features, family)
+MODEL_OFFSET		offsetof (struct cpu_features, model)
 
 COMMON_CPUID_INDEX_1

Modified: trunk/libc/sysdeps/x86_64/multiarch/init-arch.c
==============================================================================
--- trunk/libc/sysdeps/x86_64/multiarch/init-arch.c (original)
+++ trunk/libc/sysdeps/x86_64/multiarch/init-arch.c Tue Jun 30 13:19:02 2009
@@ -24,6 +24,22 @@
 struct cpu_features __cpu_features attribute_hidden;
 
 
+static void
+get_common_indeces (void)
+{
+  asm volatile ("cpuid"
+		: "=a" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax),
+		  "=b" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx),
+		  "=c" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx),
+		  "=d" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx)
+		: "0" (1));
+
+  unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
+  __cpu_features.family = (eax >> 8) & 0x0f;
+  __cpu_features.model = (eax >> 4) & 0x0f;
+}
+
+
 void
 __init_cpu_features (void)
 {
@@ -41,20 +57,25 @@
     {
       __cpu_features.kind = arch_kind_intel;
 
-    get_common_cpuid:
-      asm volatile ("cpuid"
-		    : "=a" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax),
-		      "=b" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ebx),
-		      "=c" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].ecx),
-		      "=d" (__cpu_features.cpuid[COMMON_CPUID_INDEX_1].edx)
-		    : "0" (1));
+      get_common_indeces ();
+
+      unsigned int eax = __cpu_features.cpuid[COMMON_CPUID_INDEX_1].eax;
+      unsigned int extended_family = (eax >> 20) & 0xff;
+      unsigned int extended_model = (eax >> 12) & 0xf0;
+      if (__cpu_features.family == 0x0f)
+	{
+	  __cpu_features.family += extended_family;
+	  __cpu_features.model += extended_model;
+	}
+      else if (__cpu_features.family == 0x06)
+	__cpu_features.model += extended_model;
     }
   /* This spells out "AuthenticAMD".  */
   else if (ebx == 0x68747541 && ecx == 0x444d4163 && edx == 0x69746e65)
     {
       __cpu_features.kind = arch_kind_amd;
 
-      goto get_common_cpuid;
+      get_common_indeces ();
     }
   else
     __cpu_features.kind = arch_kind_other;

Modified: trunk/libc/sysdeps/x86_64/multiarch/init-arch.h
==============================================================================
--- trunk/libc/sysdeps/x86_64/multiarch/init-arch.h (original)
+++ trunk/libc/sysdeps/x86_64/multiarch/init-arch.h Tue Jun 30 13:19:02 2009
@@ -42,6 +42,8 @@
     unsigned int ecx;
     unsigned int edx;
   } cpuid[COMMON_CPUID_INDEX_MAX];
+  unsigned int family;
+  unsigned int model;
 } __cpu_features attribute_hidden;
 
 

Modified: trunk/ports/ChangeLog.arm
==============================================================================
--- trunk/ports/ChangeLog.arm (original)
+++ trunk/ports/ChangeLog.arm Tue Jun 30 13:19:02 2009
@@ -1,3 +1,9 @@
+2009-06-30  Paul Brook  <paul@xxxxxxxxxxxxxxxx>
+
+	* sysdeps/arm/eabi/Makefile (CFLAGS-initfini.s): Add
+	-fno-asynchronous-unwind-tables -fno-unwind-tables.
+	(CFLAGS-pt-initfini.s): Ditto.
+
 2009-06-25  Nathan Froyd  <froydnj@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/arm/eabi/aeabi_lcsts.c (__aeabi_stdin, __aeabi_stdout,

Modified: trunk/ports/sysdeps/arm/eabi/Makefile
==============================================================================
--- trunk/ports/sysdeps/arm/eabi/Makefile (original)
+++ trunk/ports/sysdeps/arm/eabi/Makefile Tue Jun 30 13:19:02 2009
@@ -6,6 +6,7 @@
 ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
 aeabi_routines += aeabi_localeconv
 endif
+CFLAGS-initfini.s += -fno-asynchronous-unwind-tables -fno-unwind-tables
 
 sysdep_routines += $(aeabi_constants) $(aeabi_routines)
 static-only-routines += $(aeabi_constants)
@@ -28,3 +29,7 @@
 ifeq ($(subdir),math)
 $(objpfx)libm.so: $(elfobjdir)/ld.so
 endif
+
+ifeq ($(subdir),nptl)
+CFLAGS-pt-initfini.s += -fno-asynchronous-unwind-tables -fno-unwind-tables
+endif