Skip to content

Commit

Permalink
Merge commit 'origin/master' into fedora/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Schwab committed Jul 28, 2009
2 parents e121491 + e73e694 commit b14f097
Show file tree
Hide file tree
Showing 19 changed files with 198 additions and 103 deletions.
31 changes: 30 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
2009-07-27 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/tst-xmmymm.sh: Refine testing. The script now
determines which files are used in runtime lookups and only checks
those for SSE use.
* sysdeps/x86_64/rtld-memchr.c: Removed. Not needed with refined
testing.
* sysdeps/x86_64/rtld-rawmemchr.c: Removed.
* sysdeps/x86_64/multiarch/rtld-rawmemchr.c: Removed
* sysdeps/x86_64/Makefile: Emit warning that tst-xmmymm.sh might
take a while.

* elf/dl-open.c: Move _dl_scope_free to...
* elf/dl-scope.c: ...here. New file.
* elf/Makefile (dl-routines): Add scope.

* resolv/resolv.h (RES_USE_DNSSEC): Define.
* resolv/res_debug.c (p_option): Handle RES_USE_EDNS0 and
RES_USE_DNSSEC.
* resolv/res_mkquery.c (__res_nopt): Set flags for RES_USE_DNSSEC.
* resolv/res_query.c (__libc_res_nquery): Handle RES_USE_DNSSEC in
all the places we handled RES_USE_EDNS0 only before.
Patch by Adam Tkac <atkac@redhat.com>.

2009-07-27 Jakub Jelinek <jakub@redhat.com>

* elf/dl-lookup.c (do_lookup_x): Fix check for table more than
3/4 full. Pass size + 1 rather than size to _dl_higher_prime_number.
Update size when reallocating.

2009-07-26 Ulrich Drepper <drepper@redhat.com>

* sysdeps/x86_64/tst-xmmymm.sh: New file. Check whether any of the
Expand All @@ -7,7 +37,6 @@
* sysdeps/x86_64/rtld-memcmp.c: New file.
* sysdeps/x86_64/rtld-rawmemchr.c: New file.
* sysdeps/x86_64/rtld-strchr.S: New file.
* sysdeps/x86_64/rtld-strcmp.S: New file.
* sysdeps/x86_64/rtld-strlen.S: New file.
* sysdeps/x86_64/multiarch/rtld-rawmemchr.c: New file.
* sysdeps/x86_64/multiarch/rtld-strlen.S: New file.
Expand Down
2 changes: 1 addition & 1 deletion elf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ routines = $(dl-routines) dl-support dl-iteratephdr \
# profiled libraries.
dl-routines = $(addprefix dl-,load cache lookup object reloc deps \
runtime error init fini debug misc \
version profile conflict tls origin \
version profile conflict tls origin scope \
execstack caller open close trampoline)
all-dl-routines = $(dl-routines) $(sysdep-dl-routines)
# But they are absent from the shared libc, because that code is in ld.so.
Expand Down
5 changes: 3 additions & 2 deletions elf/dl-lookup.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,10 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,
idx -= size;
}

if (size * 3 <= tab->n_elements)
if (size * 3 <= tab->n_elements * 4)
{
/* Expand the table. */
size_t newsize = _dl_higher_prime_number (size);
size_t newsize = _dl_higher_prime_number (size + 1);
struct unique_sym *newentries
= calloc (sizeof (struct unique_sym), newsize);
if (newentries == NULL)
Expand All @@ -398,6 +398,7 @@ do_lookup_x (const char *undef_name, uint_fast32_t new_hash,

tab->free (entries);
tab->size = newsize;
size = newsize;
entries = tab->entries = newentries;
tab->free = free;
}
Expand Down
35 changes: 0 additions & 35 deletions elf/dl-open.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,41 +165,6 @@ add_to_global (struct link_map *new)
return 0;
}

int
_dl_scope_free (void *old)
{
struct dl_scope_free_list *fsl;
#define DL_SCOPE_FREE_LIST_SIZE (sizeof (fsl->list) / sizeof (fsl->list[0]))

if (RTLD_SINGLE_THREAD_P)
free (old);
else if ((fsl = GL(dl_scope_free_list)) == NULL)
{
GL(dl_scope_free_list) = fsl = malloc (sizeof (*fsl));
if (fsl == NULL)
{
THREAD_GSCOPE_WAIT ();
free (old);
return 1;
}
else
{
fsl->list[0] = old;
fsl->count = 1;
}
}
else if (fsl->count < DL_SCOPE_FREE_LIST_SIZE)
fsl->list[fsl->count++] = old;
else
{
THREAD_GSCOPE_WAIT ();
while (fsl->count > 0)
free (fsl->list[--fsl->count]);
return 1;
}
return 0;
}

static void
dl_open_worker (void *a)
{
Expand Down
58 changes: 58 additions & 0 deletions elf/dl-scope.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* Memory handling for the scope data structures.
Copyright (C) 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */

#include <stdlib.h>
#include <ldsodefs.h>
#include <sysdep-cancel.h>


int
_dl_scope_free (void *old)
{
struct dl_scope_free_list *fsl;
#define DL_SCOPE_FREE_LIST_SIZE (sizeof (fsl->list) / sizeof (fsl->list[0]))

if (RTLD_SINGLE_THREAD_P)
free (old);
else if ((fsl = GL(dl_scope_free_list)) == NULL)
{
GL(dl_scope_free_list) = fsl = malloc (sizeof (*fsl));
if (fsl == NULL)
{
THREAD_GSCOPE_WAIT ();
free (old);
return 1;
}
else
{
fsl->list[0] = old;
fsl->count = 1;
}
}
else if (fsl->count < DL_SCOPE_FREE_LIST_SIZE)
fsl->list[fsl->count++] = old;
else
{
THREAD_GSCOPE_WAIT ();
while (fsl->count > 0)
free (fsl->list[--fsl->count]);
return 1;
}
return 0;
}
7 changes: 3 additions & 4 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
2009-07-26 Ulrich Drepper <drepper@redhat.com>
2009-07-27 Ulrich Drepper <drepper@redhat.com>

[BZ #10418]
* pthread_mutex_lock.c (pthread_mutex_lock): Use _rel instead of of
_acq variants of cmpxchg.
* pthread_mutex_timedlock.c (pthread_mutex_timedlock): Likewise.
* pthread_mutex_unlock.c (__pthread_mutex_unlock_full): Use _rel
instead of of _acq variants of cmpxchg.

2009-07-23 Ulrich Drepper <drepper@redhat.com>

Expand Down
12 changes: 6 additions & 6 deletions nptl/pthread_mutex_lock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc.
/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -160,7 +160,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
#endif

newval
= atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
newval, oldval);

if (newval != oldval)
Expand Down Expand Up @@ -285,7 +285,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
#ifdef NO_INCR
newval |= FUTEX_WAITERS;
#endif
oldval = atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
oldval = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
newval, 0);

if (oldval != 0)
Expand Down Expand Up @@ -420,7 +420,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
oldprio = ceiling;

oldval
= atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
#ifdef NO_INCR
ceilval | 2,
#else
Expand All @@ -434,7 +434,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
do
{
oldval
= atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
ceilval | 2,
ceilval | 1);

Expand All @@ -445,7 +445,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
lll_futex_wait (&mutex->__data.__lock, ceilval | 2,
PTHREAD_MUTEX_PSHARED (mutex));
}
while (atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
ceilval | 2, ceilval)
!= ceilval);
}
Expand Down
12 changes: 6 additions & 6 deletions nptl/pthread_mutex_timedlock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc.
/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -126,7 +126,7 @@ pthread_mutex_timedlock (mutex, abstime)
int newval = id | (oldval & FUTEX_WAITERS);

newval
= atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
newval, oldval);
if (newval != oldval)
{
Expand Down Expand Up @@ -246,7 +246,7 @@ pthread_mutex_timedlock (mutex, abstime)
}
}

oldval = atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
oldval = atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
id, 0);

if (oldval != 0)
Expand Down Expand Up @@ -404,7 +404,7 @@ pthread_mutex_timedlock (mutex, abstime)
oldprio = ceiling;

oldval
= atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
ceilval | 1, ceilval);

if (oldval == ceilval)
Expand All @@ -413,7 +413,7 @@ pthread_mutex_timedlock (mutex, abstime)
do
{
oldval
= atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
= atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
ceilval | 2,
ceilval | 1);

Expand Down Expand Up @@ -456,7 +456,7 @@ pthread_mutex_timedlock (mutex, abstime)
PTHREAD_MUTEX_PSHARED (mutex));
}
}
while (atomic_compare_and_exchange_val_rel (&mutex->__data.__lock,
while (atomic_compare_and_exchange_val_acq (&mutex->__data.__lock,
ceilval | 2, ceilval)
!= ceilval);
}
Expand Down
6 changes: 3 additions & 3 deletions nptl/pthread_mutex_unlock.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2005-2007, 2008 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2005-2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
Expand Down Expand Up @@ -213,7 +213,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)

/* Unlock. */
if ((mutex->__data.__lock & FUTEX_WAITERS) != 0
|| atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock, 0,
|| atomic_compare_and_exchange_bool_rel (&mutex->__data.__lock, 0,
THREAD_GETMEM (THREAD_SELF,
tid)))
{
Expand Down Expand Up @@ -263,7 +263,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
oldval = mutex->__data.__lock;
newval = oldval & PTHREAD_MUTEX_PRIO_CEILING_MASK;
}
while (atomic_compare_and_exchange_bool_acq (&mutex->__data.__lock,
while (atomic_compare_and_exchange_bool_rel (&mutex->__data.__lock,
newval, oldval));

if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1)
Expand Down
2 changes: 2 additions & 0 deletions resolv/res_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,8 @@ p_option(u_long option) {
case RES_ROTATE: return "rotate";
case RES_NOCHECKNAME: return "no-check-names";
case RES_USEBSTRING: return "ip6-bytstring";
case RES_USE_EDNS0: return "edns0";
case RES_USE_DNSSEC: return "dnssec";
/* XXX nonreentrant */
default: sprintf(nbuf, "?0x%lx?", (u_long)option);
return (nbuf);
Expand Down
10 changes: 9 additions & 1 deletion resolv/res_mkquery.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,15 @@ __res_nopt(res_state statp,
NS_PUT16(MIN(anslen, 0xffff), cp); /* CLASS = UDP payload size */
*cp++ = NOERROR; /* extended RCODE */
*cp++ = 0; /* EDNS version */
/* XXX Once we support DNSSEC we change the flag value here. */

if (statp->options & RES_USE_DNSSEC) {
#ifdef DEBUG
if (statp->options & RES_DEBUG)
printf(";; res_opt()... ENDS0 DNSSEC\n");
#endif
flags |= NS_OPT_DNSSEC_OK;
}

NS_PUT16(flags, cp);
NS_PUT16(0, cp); /* RDLEN */
hp->arcount = htons(ntohs(hp->arcount) + 1);
Expand Down
8 changes: 4 additions & 4 deletions resolv/res_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ __libc_res_nquery(res_state statp,
if (n > 0)
{
if ((oflags & RES_F_EDNS0ERR) == 0
&& (statp->options & RES_USE_EDNS0) != 0)
&& (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0)
{
n = __res_nopt(statp, n, query1, bufsize, anslen / 2);
if (n < 0)
Expand All @@ -169,7 +169,7 @@ __libc_res_nquery(res_state statp,
NULL, query2, bufsize - nused);
if (n > 0
&& (oflags & RES_F_EDNS0ERR) == 0
&& (statp->options & RES_USE_EDNS0) != 0)
&& (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0)
n = __res_nopt(statp, n, query2, bufsize - nused - n,
anslen / 2);
nquery2 = n;
Expand All @@ -184,7 +184,7 @@ __libc_res_nquery(res_state statp,

if (n > 0
&& (oflags & RES_F_EDNS0ERR) == 0
&& (statp->options & RES_USE_EDNS0) != 0)
&& (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0)
n = __res_nopt(statp, n, query1, bufsize, anslen);

nquery1 = n;
Expand All @@ -203,7 +203,7 @@ __libc_res_nquery(res_state statp,
}
if (__builtin_expect (n <= 0, 0)) {
/* If the query choked with EDNS0, retry without EDNS0. */
if ((statp->options & RES_USE_EDNS0) != 0
if ((statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0
&& ((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) {
statp->_flags |= RES_F_EDNS0ERR;
#ifdef DEBUG
Expand Down
1 change: 1 addition & 0 deletions resolv/resolv.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ struct res_sym {
#define RES_SNGLKUP 0x00200000 /* one outstanding request at a time */
#define RES_SNGLKUPREOP 0x00400000 /* -"-, but open new socket for each
request */
#define RES_USE_DNSSEC 0x00800000 /* use DNSSEC using OK bit in OPT */

#define RES_DEFAULT (RES_RECURSE|RES_DEFNAMES|RES_DNSRCH|RES_NOIP6DOTINT)

Expand Down
1 change: 1 addition & 0 deletions sysdeps/x86_64/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ sysdep-rtld-routines += tlsdesc dl-tlsdesc

tests: $(objpfx)tst-xmmymm.out
$(objpfx)tst-xmmymm.out: ../sysdeps/x86_64/tst-xmmymm.sh $(objpfx)ld.so
@echo "Checking ld.so for SSE register use. This will take a few seconds..."
$(SHELL) -e $< $(objpfx) > $@
endif

Expand Down
1 change: 0 additions & 1 deletion sysdeps/x86_64/multiarch/rtld-rawmemchr.c

This file was deleted.

1 change: 0 additions & 1 deletion sysdeps/x86_64/rtld-memchr.c

This file was deleted.

1 change: 0 additions & 1 deletion sysdeps/x86_64/rtld-rawmemchr.c

This file was deleted.

Loading

0 comments on commit b14f097

Please sign in to comment.