summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-06-30 20:19:02 +0000
committerjoseph <joseph@7b3dc134-2b1b-0410-93df-9e9f96275f8d>2009-06-30 20:19:02 +0000
commit369530cdf8781f196712f2db21b774906440eca3 (patch)
tree62dc3dd5fe8b6ae30808c3f1c8119f0142ecdb24
parentf9f7cb825fff4924ec283efd84ecb0a6977fb0af (diff)
downloadeglibc2-369530cdf8781f196712f2db21b774906440eca3.tar.gz
Merge changes between r8602 and r8623 from /fsf/trunk.
git-svn-id: svn://svn.eglibc.org/trunk@8624 7b3dc134-2b1b-0410-93df-9e9f96275f8d
-rw-r--r--libc/ChangeLog26
-rw-r--r--libc/resolv/res_init.c3
-rw-r--r--libc/resolv/res_send.c68
-rw-r--r--libc/resolv/resolv.h2
-rw-r--r--libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S23
-rwxr-xr-xlibc/sysdeps/x86_64/elf/configure8
-rw-r--r--libc/sysdeps/x86_64/multiarch/ifunc-defines.sym2
-rw-r--r--libc/sysdeps/x86_64/multiarch/init-arch.c37
-rw-r--r--libc/sysdeps/x86_64/multiarch/init-arch.h2
-rw-r--r--ports/ChangeLog.arm6
-rw-r--r--ports/sysdeps/arm/eabi/Makefile5
11 files changed, 149 insertions, 33 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index 3e1f36578..7a25874b7 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,29 @@
+2009-06-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ * 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@redhat.com>
+
+ * 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@redhat.com>
+
+ * sysdeps/powerpc/powerpc32/____longjmp_chk.S (LOAD_ARG): Define.
+ (CHECK_SP): Use it.
+
2009-06-24 Andreas Schwab <aschwab@redhat.com>
* sysdeps/powerpc/powerpc32/power4/fpu/w_sqrtf.S: Fix cfa offset
diff --git a/libc/resolv/res_init.c b/libc/resolv/res_init.c
index 8841fe9fa..40dbe7d7e 100644
--- a/libc/resolv/res_init.c
+++ b/libc/resolv/res_init.c
@@ -540,6 +540,9 @@ res_setoptions(res_state statp, const char *options, const char *source) {
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;
diff --git a/libc/resolv/res_send.c b/libc/resolv/res_send.c
index 39c69da2b..971a4afb6 100644
--- a/libc/resolv/res_send.c
+++ b/libc/resolv/res_send.c
@@ -908,24 +908,11 @@ send_vc(res_state statp,
}
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 @@ send_dg(res_state statp,
}
}
+ 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 @@ send_dg(res_state statp,
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 @@ send_dg(res_state statp,
*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 @@ send_dg(res_state statp,
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 @@ send_dg(res_state statp,
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;
}
/*
diff --git a/libc/resolv/resolv.h b/libc/resolv/resolv.h
index c6e695dc7..3ef714f45 100644
--- a/libc/resolv/resolv.h
+++ b/libc/resolv/resolv.h
@@ -216,6 +216,8 @@ struct res_sym {
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)
diff --git a/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S b/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S
index 5c1f64866..510ce5250 100644
--- a/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S
+++ b/libc/sysdeps/powerpc/powerpc32/____longjmp_chk.S
@@ -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:
diff --git a/libc/sysdeps/x86_64/elf/configure b/libc/sysdeps/x86_64/elf/configure
index 7a2e3004a..24eff6284 100755
--- a/libc/sysdeps/x86_64/elf/configure
+++ b/libc/sysdeps/x86_64/elf/configure
@@ -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 @@ else
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
diff --git a/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym b/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
index 48d128724..e2021cdf8 100644
--- a/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
+++ b/libc/sysdeps/x86_64/multiarch/ifunc-defines.sym
@@ -11,5 +11,7 @@ CPUID_EAX_OFFSET offsetof (struct cpuid_registers, eax)
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
diff --git a/libc/sysdeps/x86_64/multiarch/init-arch.c b/libc/sysdeps/x86_64/multiarch/init-arch.c
index ec0eb29fa..29e687344 100644
--- a/libc/sysdeps/x86_64/multiarch/init-arch.c
+++ b/libc/sysdeps/x86_64/multiarch/init-arch.c
@@ -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 @@ __init_cpu_features (void)
{
__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;
diff --git a/libc/sysdeps/x86_64/multiarch/init-arch.h b/libc/sysdeps/x86_64/multiarch/init-arch.h
index 5c4892de3..48a212741 100644
--- a/libc/sysdeps/x86_64/multiarch/init-arch.h
+++ b/libc/sysdeps/x86_64/multiarch/init-arch.h
@@ -42,6 +42,8 @@ extern struct cpu_features
unsigned int ecx;
unsigned int edx;
} cpuid[COMMON_CPUID_INDEX_MAX];
+ unsigned int family;
+ unsigned int model;
} __cpu_features attribute_hidden;
diff --git a/ports/ChangeLog.arm b/ports/ChangeLog.arm
index ebc4e3075..47aa61d3f 100644
--- a/ports/ChangeLog.arm
+++ b/ports/ChangeLog.arm
@@ -1,3 +1,9 @@
+2009-06-30 Paul Brook <paul@codesourcery.com>
+
+ * 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@codesourcery.com>
* sysdeps/arm/eabi/aeabi_lcsts.c (__aeabi_stdin, __aeabi_stdout,
diff --git a/ports/sysdeps/arm/eabi/Makefile b/ports/sysdeps/arm/eabi/Makefile
index 22d62edef..36ddb8e43 100644
--- a/ports/sysdeps/arm/eabi/Makefile
+++ b/ports/sysdeps/arm/eabi/Makefile
@@ -6,6 +6,7 @@ aeabi_routines = aeabi_assert aeabi_errno_addr \
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 @@ endif
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