summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libc/ChangeLog42
-rw-r--r--libc/elf/Makefile12
-rw-r--r--libc/elf/dl-tls.c2
-rw-r--r--libc/elf/tst-tls17.c28
-rw-r--r--libc/elf/tst-tlsmod17a.c23
-rw-r--r--libc/elf/tst-tlsmod17b.c15
-rw-r--r--libc/nptl/ChangeLog5
-rw-r--r--libc/nptl/sysdeps/unix/sysv/linux/fork.c5
-rw-r--r--libc/nscd/connections.c2
-rw-r--r--libc/resolv/res_send.c14
-rw-r--r--libc/stdlib/divmod_1.c2
-rw-r--r--libc/stdlib/longlong.h157
-rw-r--r--libc/stdlib/mod_1.c2
-rw-r--r--libc/sysdeps/sparc/sparc64/sparcv9v/memcpy.S5
-rw-r--r--libc/sysdeps/sparc/sparc64/sparcv9v/memset.S8
-rw-r--r--libc/sysdeps/sparc/sparc64/sparcv9v2/memcpy.S5
-rw-r--r--libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h2
-rw-r--r--libc/sysdeps/unix/sysv/linux/sys/signalfd.h2
-rw-r--r--ports/ChangeLog.mips6
-rw-r--r--ports/sysdeps/mips/dl-dtprocnum.h6
-rw-r--r--ports/sysdeps/mips/dl-machine.h8
22 files changed, 299 insertions, 54 deletions
diff --git a/libc/ChangeLog b/libc/ChangeLog
index ddad30a05..178c921c7 100644
--- a/libc/ChangeLog
+++ b/libc/ChangeLog
@@ -1,3 +1,45 @@
+2008-10-17 Jakub Jelinek <jakub@redhat.com>
+
+ * elf/Makefile: Add rules to build and run tst-tls17.
+ * elf/tst-tls17.c: New test.
+ * elf/tst-tlsmod17a.c: New file.
+ * elf/tst-tlsmod17b.c: Likewise.
+
+2008-10-17 Ulrich Drepper <drepper@redhat.com>
+
+ * stdlib/divmod_1.c: Use correct type for dummy variable.
+ * stdlib/mod_1.c: Likewise.
+
+2008-10-16 Ulrich Drepper <drepper@redhat.com>
+
+ * elf/dl-tls.c (_dl_update_slotinfo): Copy all of the initial DTV.
+
+2008-10-16 Jakub Jelinek <jakub@redhat.com>
+
+ * sysdeps/unix/sysv/linux/sys/signalfd.h (signalfd): Fix __THROW vs.
+ __nonnull order for C++.
+ * sysdeps/unix/sysv/linux/alpha/sys/signalfd.h (signalfd): Likewise.
+ * sysdeps/unix/sysv/linux/sparc/sys/signalfd.h (signalfd): Likewise.
+
+2008-10-01 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * stdlib/longlong.h: Update from GCC.
+
+2008-10-09 Jakub Jelinek <jakub@redhat.com>
+ David S. Miller <davem@davemloft.net>
+
+ * sysdeps/sparc/sparc64/sparcv9v/memcpy.S: When not USE_BPR,
+ make sure any registers used with 64-bit 'branch-on-register'
+ instructions have their top 32-bits clear.
+ * sysdeps/sparc/sparc64/sparcv9v/memset.S: Likewise.
+ * sysdeps/sparc/sparc64/sparcv9v2/memcpy.S: Likewise.
+
+2008-09-18 Andreas Schwab <schwab@suse.de>
+
+ [BZ #6942]
+ * resolv/res_send.c (send_vc): Fix use of unaligned address.
+ Properly handle partial reads.
+
2008-10-01 Mark Shinwell <shinwell@codesourcery.com>
* elf/elf.h (STO_MIPS_PLT): New.
diff --git a/libc/elf/Makefile b/libc/elf/Makefile
index 4eaa01dfc..01044c640 100644
--- a/libc/elf/Makefile
+++ b/libc/elf/Makefile
@@ -167,7 +167,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
- tst-tls16 tst-tls-dlinfo \
+ tst-tls16 tst-tls17 tst-tls-dlinfo \
tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
tst-dlmodcount tst-dlopenrpath tst-deep1 \
tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
@@ -182,6 +182,7 @@ ifeq (yesyes,$(have-fpie)$(build-shared))
tests: $(objpfx)tst-pie1.out
endif
tests: $(objpfx)tst-leaks1-mem
+tlsmod17a-suffixes = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
testobj1_1 failobj constload2 constload3 unloadmod \
dep1 dep2 dep3 dep4 vismod1 vismod2 vismod3 \
@@ -201,6 +202,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-tlsmod9 tst-tlsmod10 tst-tlsmod11 tst-tlsmod12 \
tst-tlsmod13 tst-tlsmod13a tst-tlsmod14a tst-tlsmod14b \
tst-tlsmod15a tst-tlsmod15b tst-tlsmod16a tst-tlsmod16b \
+ $(patsubst %,tst-tlsmod17a%,$(tlsmod17a-suffixes)) \
+ tst-tlsmod17b \
circlemod1 circlemod1a circlemod2 circlemod2a \
circlemod3 circlemod3a \
reldep8mod1 reldep8mod2 reldep8mod3 \
@@ -721,6 +724,13 @@ $(objpfx)tst-tls-dlinfo.out: $(objpfx)tst-tlsmod2.so
$(objpfx)tst-tls16: $(libdl)
$(objpfx)tst-tls16.out: $(objpfx)tst-tlsmod16a.so $(objpfx)tst-tlsmod16b.so
+$(objpfx)tst-tls17: $(libdl)
+$(objpfx)tst-tls17.out: $(objpfx)tst-tlsmod17b.so
+$(patsubst %,$(objpfx)tst-tlsmod17a%.os,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.os : tst-tlsmod17a.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ -DN=$* -DNOT_IN_libc=1 $<
+$(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes)): $(objpfx)tst-tlsmod17a%.so: $(objpfx)ld.so
+$(objpfx)tst-tlsmod17b.so: $(patsubst %,$(objpfx)tst-tlsmod17a%.so,$(tlsmod17a-suffixes))
+
CFLAGS-tst-align.c = $(stack-align-test-flags)
CFLAGS-tst-align2.c = $(stack-align-test-flags)
CFLAGS-tst-alignmod.c = $(stack-align-test-flags)
diff --git a/libc/elf/dl-tls.c b/libc/elf/dl-tls.c
index 54c3590a9..e234a0a82 100644
--- a/libc/elf/dl-tls.c
+++ b/libc/elf/dl-tls.c
@@ -634,7 +634,7 @@ _dl_update_slotinfo (unsigned long int req_modid)
newp = malloc ((2 + newsize) * sizeof (dtv_t));
if (newp == NULL)
oom ();
- memcpy (newp, &dtv[-1], oldsize * sizeof (dtv_t));
+ memcpy (newp, &dtv[-1], (2 + oldsize) * sizeof (dtv_t));
}
else
{
diff --git a/libc/elf/tst-tls17.c b/libc/elf/tst-tls17.c
new file mode 100644
index 000000000..c768fb6a5
--- /dev/null
+++ b/libc/elf/tst-tls17.c
@@ -0,0 +1,28 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+ void *h = dlopen ("tst-tlsmod17b.so", RTLD_LAZY);
+ if (h == NULL)
+ {
+ puts ("unexpectedly failed to open tst-tlsmod17b.so");
+ exit (1);
+ }
+
+ int (*fp) (void) = (int (*) (void)) dlsym (h, "tlsmod17b");
+ if (fp == NULL)
+ {
+ puts ("cannot find tlsmod17b");
+ exit (1);
+ }
+
+ if (fp ())
+ exit (1);
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/libc/elf/tst-tlsmod17a.c b/libc/elf/tst-tlsmod17a.c
new file mode 100644
index 000000000..24c84a159
--- /dev/null
+++ b/libc/elf/tst-tlsmod17a.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+
+#ifndef N
+#define N 0
+#endif
+#define CONCAT1(s, n) s##n
+#define CONCAT(s, n) CONCAT1(s, n)
+
+__thread int CONCAT (v, N) = 4;
+
+int
+CONCAT (tlsmod17a, N) (void)
+{
+ int *p = &CONCAT (v, N);
+ /* GCC assumes &var is never NULL, add optimization barrier. */
+ asm volatile ("" : "+r" (p));
+ if (p == NULL || *p != 4)
+ {
+ printf ("fail %d %p\n", N, p);
+ return 1;
+ }
+ return 0;
+}
diff --git a/libc/elf/tst-tlsmod17b.c b/libc/elf/tst-tlsmod17b.c
new file mode 100644
index 000000000..617882873
--- /dev/null
+++ b/libc/elf/tst-tlsmod17b.c
@@ -0,0 +1,15 @@
+#define P(N) extern int tlsmod17a##N (void);
+#define PS P(0) P(1) P(2) P(3) P(4) P(5) P(6) P(7) P(8) P(9) \
+ P(10) P(12) P(13) P(14) P(15) P(16) P(17) P(18) P(19)
+PS
+#undef P
+
+int
+tlsmod17b (void)
+{
+ int res = 0;
+#define P(N) res |= tlsmod17a##N ();
+ PS
+#undef P
+ return res;
+}
diff --git a/libc/nptl/ChangeLog b/libc/nptl/ChangeLog
index b8833a2e8..24926cf40 100644
--- a/libc/nptl/ChangeLog
+++ b/libc/nptl/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-11 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * sysdeps/unix/sysv/linux/fork.c (__libc_fork): Add memory barrier
+ to force runp->refcntr to be read from memory.
+
2008-09-08 Richard Guenther <rguenther@suse.de>
* sysdeps/unix/sysv/linux/i386/lowlevellock.h (lll_lock,
diff --git a/libc/nptl/sysdeps/unix/sysv/linux/fork.c b/libc/nptl/sysdeps/unix/sysv/linux/fork.c
index 1683de80f..524d72c58 100644
--- a/libc/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/libc/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -64,6 +64,9 @@ __libc_fork (void)
struct fork_handler *runp;
while ((runp = __fork_handlers) != NULL)
{
+ /* Make sure we read from the current RUNP pointer. */
+ atomic_full_barrier ();
+
unsigned int oldval = runp->refcntr;
if (oldval == 0)
diff --git a/libc/nscd/connections.c b/libc/nscd/connections.c
index 54b386497..e3a67386d 100644
--- a/libc/nscd/connections.c
+++ b/libc/nscd/connections.c
@@ -1824,12 +1824,14 @@ main_loop_poll (void)
if (have_paccept >= 0)
#endif
{
+#if 0
fd = TEMP_FAILURE_RETRY (paccept (sock, NULL, NULL, NULL,
SOCK_NONBLOCK));
#ifndef __ASSUME_PACCEPT
if (have_paccept == 0)
have_paccept = fd != -1 || errno != ENOSYS ? 1 : -1;
#endif
+#endif
}
#ifndef __ASSUME_PACCEPT
if (have_paccept < 0)
diff --git a/libc/resolv/res_send.c b/libc/resolv/res_send.c
index 3130f6428..59cdc214e 100644
--- a/libc/resolv/res_send.c
+++ b/libc/resolv/res_send.c
@@ -734,11 +734,11 @@ send_vc(res_state statp,
*/
int recvresp1 = 0;
int recvresp2 = buf2 == NULL;
- read_len:
- cp = ans;
uint16_t rlen16;
+ read_len:
+ cp = (u_char *)&rlen16;
len = sizeof(rlen16);
- while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, &rlen16,
+ while ((n = TEMP_FAILURE_RETRY (read(statp->_vcsock, cp,
(int)len))) > 0) {
cp += n;
if ((len -= n) <= 0)
@@ -778,8 +778,16 @@ send_vc(res_state statp,
/* No buffer allocated for the first
reply. We can try to use the rest
of the user-provided buffer. */
+#ifdef _STRING_ARCH_unaligned
*anssizp2 = orig_anssizp - resplen;
*ansp2 = *ansp + resplen;
+#else
+ int aligned_resplen
+ = ((resplen + __alignof__ (HEADER) - 1)
+ & (__alignof__ (HEADER) - 1));
+ *anssizp2 = orig_anssizp - aligned_resplen;
+ *ansp2 = *ansp + aligned_resplen;
+#endif
} else {
/* The first reply did not fit into the
user-provided buffer. Maybe the second
diff --git a/libc/stdlib/divmod_1.c b/libc/stdlib/divmod_1.c
index 51a47d85d..0a8a77e12 100644
--- a/libc/stdlib/divmod_1.c
+++ b/libc/stdlib/divmod_1.c
@@ -55,7 +55,7 @@ mpn_divmod_1 (quot_ptr, dividend_ptr, dividend_size, divisor_limb)
{
mp_size_t i;
mp_limb_t n1, n0, r;
- int dummy;
+ mp_limb_t dummy;
/* ??? Should this be handled at all? Rely on callers? */
if (dividend_size == 0)
diff --git a/libc/stdlib/longlong.h b/libc/stdlib/longlong.h
index ca6285a19..a2f38ae2a 100644
--- a/libc/stdlib/longlong.h
+++ b/libc/stdlib/longlong.h
@@ -229,6 +229,19 @@ UDItype __umulsidi3 (USItype, USItype);
#define UDIV_TIME 100
#endif /* __arm__ */
+#if defined(__arm__)
+/* Let gcc decide how best to implement count_leading_zeros. */
+#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
+#define COUNT_LEADING_ZEROS_0 32
+#endif
+
+#if defined (__CRIS__) && __CRIS_arch_version >= 3
+#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
+#if __CRIS_arch_version >= 8
+#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
+#endif
+#endif /* __CRIS__ */
+
#if defined (__hppa) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("add %4,%5,%1\n\taddc %2,%3,%0" \
@@ -315,7 +328,7 @@ UDItype __umulsidi3 (USItype, USItype);
#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("addl %5,%1\n\tadcl %3,%0" \
+ __asm__ ("add{l} {%5,%1|%1,%5}\n\tadc{l} {%3,%0|%0,%3}" \
: "=r" ((USItype) (sh)), \
"=&r" ((USItype) (sl)) \
: "%0" ((USItype) (ah)), \
@@ -323,7 +336,7 @@ UDItype __umulsidi3 (USItype, USItype);
"%1" ((USItype) (al)), \
"g" ((USItype) (bl)))
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subl %5,%1\n\tsbbl %3,%0" \
+ __asm__ ("sub{l} {%5,%1|%1,%5}\n\tsbb{l} {%3,%0|%0,%3}" \
: "=r" ((USItype) (sh)), \
"=&r" ((USItype) (sl)) \
: "0" ((USItype) (ah)), \
@@ -331,31 +344,60 @@ UDItype __umulsidi3 (USItype, USItype);
"1" ((USItype) (al)), \
"g" ((USItype) (bl)))
#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("mull %3" \
+ __asm__ ("mul{l} %3" \
: "=a" ((USItype) (w0)), \
"=d" ((USItype) (w1)) \
: "%0" ((USItype) (u)), \
"rm" ((USItype) (v)))
#define udiv_qrnnd(q, r, n1, n0, dv) \
- __asm__ ("divl %4" \
+ __asm__ ("div{l} %4" \
: "=a" ((USItype) (q)), \
"=d" ((USItype) (r)) \
: "0" ((USItype) (n0)), \
"1" ((USItype) (n1)), \
"rm" ((USItype) (dv)))
-#define count_leading_zeros(count, x) \
- do { \
- USItype __cbtmp; \
- __asm__ ("bsrl %1,%0" \
- : "=r" (__cbtmp) : "rm" ((USItype) (x))); \
- (count) = __cbtmp ^ 31; \
- } while (0)
-#define count_trailing_zeros(count, x) \
- __asm__ ("bsfl %1,%0" : "=r" (count) : "rm" ((USItype)(x)))
+#define count_leading_zeros(count, x) ((count) = __builtin_clz (x))
+#define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x))
#define UMUL_TIME 40
#define UDIV_TIME 40
#endif /* 80x86 */
+#if (defined (__x86_64__) || defined (__i386__)) && W_TYPE_SIZE == 64
+#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
+ __asm__ ("add{q} {%5,%1|%1,%5}\n\tadc{q} {%3,%0|%0,%3}" \
+ : "=r" ((UDItype) (sh)), \
+ "=&r" ((UDItype) (sl)) \
+ : "%0" ((UDItype) (ah)), \
+ "rme" ((UDItype) (bh)), \
+ "%1" ((UDItype) (al)), \
+ "rme" ((UDItype) (bl)))
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("sub{q} {%5,%1|%1,%5}\n\tsbb{q} {%3,%0|%0,%3}" \
+ : "=r" ((UDItype) (sh)), \
+ "=&r" ((UDItype) (sl)) \
+ : "0" ((UDItype) (ah)), \
+ "rme" ((UDItype) (bh)), \
+ "1" ((UDItype) (al)), \
+ "rme" ((UDItype) (bl)))
+#define umul_ppmm(w1, w0, u, v) \
+ __asm__ ("mul{q} %3" \
+ : "=a" ((UDItype) (w0)), \
+ "=d" ((UDItype) (w1)) \
+ : "%0" ((UDItype) (u)), \
+ "rm" ((UDItype) (v)))
+#define udiv_qrnnd(q, r, n1, n0, dv) \
+ __asm__ ("div{q} %4" \
+ : "=a" ((UDItype) (q)), \
+ "=d" ((UDItype) (r)) \
+ : "0" ((UDItype) (n0)), \
+ "1" ((UDItype) (n1)), \
+ "rm" ((UDItype) (dv)))
+#define count_leading_zeros(count, x) ((count) = __builtin_clzl (x))
+#define count_trailing_zeros(count, x) ((count) = __builtin_ctzl (x))
+#define UMUL_TIME 40
+#define UDIV_TIME 40
+#endif /* x86_64 */
+
#if defined (__i960__) && W_TYPE_SIZE == 32
#define umul_ppmm(w1, w0, u, v) \
({union {UDItype __ll; \
@@ -523,6 +565,11 @@ UDItype __umulsidi3 (USItype, USItype);
__asm__ ("bfffo %1{%b2:%b2},%0" \
: "=d" ((USItype) (count)) \
: "od" ((USItype) (x)), "n" (0))
+/* Some ColdFire architectures have a ff1 instruction supported via
+ __builtin_clz. */
+#elif defined (__mcfisaaplus__) || defined (__mcfisac__)
+#define count_leading_zeros(count,x) ((count) = __builtin_clz (x))
+#define COUNT_LEADING_ZEROS_0 32
#endif
#endif /* mc68000 */
@@ -585,14 +632,19 @@ UDItype __umulsidi3 (USItype, USItype);
#endif /* __m88000__ */
#if defined (__mips__) && W_TYPE_SIZE == 32
-#define umul_ppmm(w1, w0, u, v) \
- __asm__ ("multu %2,%3" \
- : "=l" ((USItype) (w0)), \
- "=h" ((USItype) (w1)) \
- : "d" ((USItype) (u)), \
- "d" ((USItype) (v)))
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ UDItype __x = (UDItype) (USItype) (u) * (USItype) (v); \
+ (w1) = (USItype) (__x >> 32); \
+ (w0) = (USItype) (__x); \
+ } while (0)
#define UMUL_TIME 10
#define UDIV_TIME 100
+
+#if (__mips == 32 || __mips == 64) && ! __mips16
+#define count_leading_zeros(COUNT,X) ((COUNT) = __builtin_clz (X))
+#define COUNT_LEADING_ZEROS_0 32
+#endif
#endif /* __mips__ */
#if defined (__ns32000__) && W_TYPE_SIZE == 32
@@ -641,7 +693,9 @@ UDItype __umulsidi3 (USItype, USItype);
|| defined (__powerpc__) /* gcc */ \
|| defined (__POWERPC__) /* BEOS */ \
|| defined (__ppc__) /* Darwin */ \
- || defined (PPC) /* GNU/Linux, SysV */ \
+ || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \
+ || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \
+ && CPU_FAMILY == PPC) \
) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
@@ -679,7 +733,10 @@ UDItype __umulsidi3 (USItype, USItype);
__asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x))
#define COUNT_LEADING_ZEROS_0 32
#if defined (_ARCH_PPC) || defined (__powerpc__) || defined (__POWERPC__) \
- || defined (__ppc__) || defined (PPC)
+ || defined (__ppc__) \
+ || (defined (PPC) && ! defined (CPU_FAMILY)) /* gcc 2.7.x GNU&SysV */ \
+ || (defined (PPC) && defined (CPU_FAMILY) /* VxWorks */ \
+ && CPU_FAMILY == PPC)
#define umul_ppmm(ph, pl, m0, m1) \
do { \
USItype __m0 = (m0), __m1 = (m1); \
@@ -828,18 +885,51 @@ UDItype __umulsidi3 (USItype, USItype);
} while (0)
#endif
-#if defined (__sh2__) && W_TYPE_SIZE == 32
+#if defined(__sh__) && !__SHMEDIA__ && W_TYPE_SIZE == 32
+#ifndef __sh1__
#define umul_ppmm(w1, w0, u, v) \
__asm__ ( \
- "dmulu.l %2,%3\n\tsts macl,%1\n\tsts mach,%0" \
- : "=r" ((USItype)(w1)), \
- "=r" ((USItype)(w0)) \
+ "dmulu.l %2,%3\n\tsts%M1 macl,%1\n\tsts%M0 mach,%0" \
+ : "=r<" ((USItype)(w1)), \
+ "=r<" ((USItype)(w0)) \
: "r" ((USItype)(u)), \
"r" ((USItype)(v)) \
: "macl", "mach")
#define UMUL_TIME 5
#endif
+/* This is the same algorithm as __udiv_qrnnd_c. */
+#define UDIV_NEEDS_NORMALIZATION 1
+
+#define udiv_qrnnd(q, r, n1, n0, d) \
+ do { \
+ extern UWtype __udiv_qrnnd_16 (UWtype, UWtype) \
+ __attribute__ ((visibility ("hidden"))); \
+ /* r0: rn r1: qn */ /* r0: n1 r4: n0 r5: d r6: d1 */ /* r2: __m */ \
+ __asm__ ( \
+ "mov%M4 %4,r5\n" \
+" swap.w %3,r4\n" \
+" swap.w r5,r6\n" \
+" jsr @%5\n" \
+" shll16 r6\n" \
+" swap.w r4,r4\n" \
+" jsr @%5\n" \
+" swap.w r1,%0\n" \
+" or r1,%0" \
+ : "=r" (q), "=&z" (r) \
+ : "1" (n1), "r" (n0), "rm" (d), "r" (&__udiv_qrnnd_16) \
+ : "r1", "r2", "r4", "r5", "r6", "pr"); \
+ } while (0)
+
+#define UDIV_TIME 80
+
+#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
+ __asm__ ("clrt;subc %5,%1; subc %4,%0" \
+ : "=r" (sh), "=r" (sl) \
+ : "0" (ah), "1" (al), "r" (bh), "r" (bl))
+
+#endif /* __sh__ */
+
#if defined (__SH5__) && __SHMEDIA__ && W_TYPE_SIZE == 32
#define __umulsidi3(u,v) ((UDItype)(USItype)u*(USItype)v)
#define count_leading_zeros(count, x) \
@@ -1153,6 +1243,23 @@ UDItype __umulsidi3 (USItype, USItype);
} while (0)
#endif /* __vax__ */
+#if defined (__xtensa__) && W_TYPE_SIZE == 32
+/* This code is not Xtensa-configuration-specific, so rely on the compiler
+ to expand builtin functions depending on what configuration features
+ are available. This avoids library calls when the operation can be
+ performed in-line. */
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ DWunion __w; \
+ __w.ll = __builtin_umulsidi3 (u, v); \
+ w1 = __w.s.high; \
+ w0 = __w.s.low; \
+ } while (0)
+#define __umulsidi3(u, v) __builtin_umulsidi3 (u, v)
+#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
+#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
+#endif /* __xtensa__ */
+
#if defined (__z8000__) && W_TYPE_SIZE == 16
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("add %H1,%H5\n\tadc %H0,%H3" \
diff --git a/libc/stdlib/mod_1.c b/libc/stdlib/mod_1.c
index 3273c9222..f4cfa6933 100644
--- a/libc/stdlib/mod_1.c
+++ b/libc/stdlib/mod_1.c
@@ -50,7 +50,7 @@ mpn_mod_1 (dividend_ptr, dividend_size, divisor_limb)
{
mp_size_t i;
mp_limb_t n1, n0, r;
- int dummy;
+ mp_limb_t dummy;
/* Botch: Should this be handled at all? Rely on callers? */
if (dividend_size == 0)
diff --git a/libc/sysdeps/sparc/sparc64/sparcv9v/memcpy.S b/libc/sysdeps/sparc/sparc64/sparcv9v/memcpy.S
index 05c837fa2..ad2b0f742 100644
--- a/libc/sysdeps/sparc/sparc64/sparcv9v/memcpy.S
+++ b/libc/sysdeps/sparc/sparc64/sparcv9v/memcpy.S
@@ -1,5 +1,5 @@
/* Copy SIZE bytes from SRC to DEST. For SUN4V Niagara.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David S. Miller (davem@davemloft.net)
@@ -61,6 +61,9 @@ END(bcopy)
.align 32
ENTRY(memcpy)
+#ifndef USE_BPR
+ srl %o2, 0, %o2
+#endif
100: /* %o0=dst, %o1=src, %o2=len */
mov %o0, %g5
cmp %o2, 0
diff --git a/libc/sysdeps/sparc/sparc64/sparcv9v/memset.S b/libc/sysdeps/sparc/sparc64/sparcv9v/memset.S
index ac0a50cf8..64817b887 100644
--- a/libc/sysdeps/sparc/sparc64/sparcv9v/memset.S
+++ b/libc/sysdeps/sparc/sparc64/sparcv9v/memset.S
@@ -1,5 +1,5 @@
/* Set a block of memory to some byte value. For SUN4V Niagara.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David S. Miller (davem@davemloft.net)
@@ -49,7 +49,11 @@ END(memset)
ENTRY(__bzero)
clr %o2
-1: brz,pn %o1, 90f
+1:
+#ifndef USE_BRP
+ srl %o1, 0, %o1
+#endif
+ brz,pn %o1, 90f
mov %o0, %o3
wr %g0, ASI_P, %asi
diff --git a/libc/sysdeps/sparc/sparc64/sparcv9v2/memcpy.S b/libc/sysdeps/sparc/sparc64/sparcv9v2/memcpy.S
index d94dd4701..b261f461a 100644
--- a/libc/sysdeps/sparc/sparc64/sparcv9v2/memcpy.S
+++ b/libc/sysdeps/sparc/sparc64/sparcv9v2/memcpy.S
@@ -1,5 +1,5 @@
/* Copy SIZE bytes from SRC to DEST. For SUN4V Niagara-2.
- Copyright (C) 2007 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David S. Miller (davem@davemloft.net)
@@ -163,6 +163,9 @@ END(bcopy)
.align 32
ENTRY(memcpy)
+#ifndef USE_BPR
+ srl %o2, 0, %o2
+#endif
100: /* %o0=dst, %o1=src, %o2=len */
mov %o0, %g5
cmp %o2, 0
diff --git a/libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h b/libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h
index a820eafe7..4cbe97776 100644
--- a/libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h
+++ b/libc/sysdeps/unix/sysv/linux/alpha/sys/signalfd.h
@@ -59,7 +59,7 @@ __BEGIN_DECLS
/* Request notification for delivery of signals in MASK to be
performed using descriptor FD.*/
extern int signalfd (int __fd, const sigset_t *__mask, int __flags)
- __nonnull ((2)) __THROW;
+ __THROW __nonnull ((2));
__END_DECLS
diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h b/libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h
index a134cc7ba..bd380c29f 100644
--- a/libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h
+++ b/libc/sysdeps/unix/sysv/linux/sparc/sys/signalfd.h
@@ -59,7 +59,7 @@ __BEGIN_DECLS
/* Request notification for delivery of signals in MASK to be
performed using descriptor FD.*/
extern int signalfd (int __fd, const sigset_t *__mask, int __flags)
- __nonnull ((2)) __THROW;
+ __THROW __nonnull ((2));
__END_DECLS
diff --git a/libc/sysdeps/unix/sysv/linux/sys/signalfd.h b/libc/sysdeps/unix/sysv/linux/sys/signalfd.h
index dae71a400..eeb27ee03 100644
--- a/libc/sysdeps/unix/sysv/linux/sys/signalfd.h
+++ b/libc/sysdeps/unix/sysv/linux/sys/signalfd.h
@@ -59,7 +59,7 @@ __BEGIN_DECLS
/* Request notification for delivery of signals in MASK to be
performed using descriptor FD.*/
extern int signalfd (int __fd, const sigset_t *__mask, int __flags)
- __nonnull ((2)) __THROW;
+ __THROW __nonnull ((2));
__END_DECLS
diff --git a/ports/ChangeLog.mips b/ports/ChangeLog.mips
index a4f03a731..e94e10981 100644
--- a/ports/ChangeLog.mips
+++ b/ports/ChangeLog.mips
@@ -1,3 +1,9 @@
+2008-10-15 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * sysdeps/mips/dl-dtprocnum.h (DT_MIPS_NUM): Do not redefine.
+ * sysdeps/mips/dl-machine.h (STO_MIPS_PLT, R_MIPS_COPY,
+ R_MIPS_JUMP_SLOT, DT_MIPS_PLTGOT): Do not redefine.
+
2008-10-01 Mark Shinwell <shinwell@codesourcery.com>
Daniel Jacobowitz <dan@codesourcery.com>
Richard Sandiford <rdsandiford@googlemail.com>
diff --git a/ports/sysdeps/mips/dl-dtprocnum.h b/ports/sysdeps/mips/dl-dtprocnum.h
index 41ae00082..dfd03ba31 100644
--- a/ports/sysdeps/mips/dl-dtprocnum.h
+++ b/ports/sysdeps/mips/dl-dtprocnum.h
@@ -17,12 +17,6 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-/* Until elf/elf.h in glibc is updated. */
-#ifndef STO_MIPS_PLT
-# undef DT_MIPS_NUM
-# define DT_MIPS_NUM 0x35
-#endif
-
/* Number of extra dynamic section entries for this architecture. By
default there are none. */
#define DT_THISPROCNUM DT_MIPS_NUM
diff --git a/ports/sysdeps/mips/dl-machine.h b/ports/sysdeps/mips/dl-machine.h
index f7af107f1..ec2e9b58c 100644
--- a/ports/sysdeps/mips/dl-machine.h
+++ b/ports/sysdeps/mips/dl-machine.h
@@ -53,14 +53,6 @@
".size\t" __STRING(entry) ", . - " __STRING(entry) "\n\t"
#endif
-/* Until elf/elf.h in glibc is updated. */
-#ifndef STO_MIPS_PLT
-#define STO_MIPS_PLT 0x8
-#define R_MIPS_COPY 126
-#define R_MIPS_JUMP_SLOT 127
-#define DT_MIPS_PLTGOT 0x70000032
-#endif
-
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.
This only makes sense on MIPS when using PLTs, so choose the
PLT relocation (not encountered when not using PLTs). */