Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* dlfcn/Makefile (LDLIBS-bug-atexit3-lib.so): Add
	ld.so.

	* malloc/malloc.c (_int_malloc): Use full list insert and not
	shortcut which assumes the list is empty for large requests
	too.

	* elf/tst-addr1.c (do_test): Allow i.dli_sname "_IO_printf".
  • Loading branch information
Ulrich Drepper committed Aug 31, 2006
1 parent bee2df0 commit b80770b
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 17 deletions.
11 changes: 11 additions & 0 deletions ChangeLog
@@ -1,3 +1,14 @@
2006-08-31 Jakub Jelinek <jakub@redhat.com>

* dlfcn/Makefile (LDLIBS-bug-atexit3-lib.so): Add
ld.so.

* malloc/malloc.c (_int_malloc): Use full list insert and not
shortcut which assumes the list is empty for large requests
too.

* elf/tst-addr1.c (do_test): Allow i.dli_sname "_IO_printf".

2006-08-30 Jakub Jelinek <jakub@redhat.com>

* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h (splice): Add offin
Expand Down
3 changes: 2 additions & 1 deletion dlfcn/Makefile
Expand Up @@ -136,7 +136,8 @@ $(objpfx)bug-atexit2.out: $(objpfx)bug-atexit2-lib.so
$(objpfx)bug-atexit2-lib.so: $(common-objpfx)libc.so \
$(common-objpfx)libc_nonshared.a

LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(common-objpfx)libc_nonshared.a
LDLIBS-bug-atexit3-lib.so = -lstdc++ -lgcc_eh $(common-objpfx)elf/ld.so \
$(common-objpfx)libc_nonshared.a
$(objpfx)bug-atexit3: $(libdl)
$(objpfx)bug-atexit3.out: $(objpfx)bug-atexit3-lib.so
$(objpfx)bug-atexit3-lib.so: $(common-objpfx)libc.so \
Expand Down
9 changes: 8 additions & 1 deletion elf/tst-addr1.c
Expand Up @@ -12,7 +12,14 @@ do_test (void)
return 1;
}
printf ("found symbol %s in %s\n", i.dli_sname, i.dli_fname);
return i.dli_sname == NULL || strcmp (i.dli_sname, "printf") != 0;
return i.dli_sname == NULL
|| (strcmp (i.dli_sname, "printf") != 0
/* On architectures which create PIC code by default
&printf may resolve to an address in libc.so
rather than in the binary. printf and _IO_printf
are aliased and which one comes first in the
hash table is up to the linker. */
&& strcmp (i.dli_sname, "_IO_printf") != 0);
}

#define TEST_FUNCTION do_test ()
Expand Down
10 changes: 8 additions & 2 deletions malloc/malloc.c
Expand Up @@ -4230,8 +4230,14 @@ _int_malloc(mstate av, size_t bytes)
/* Split */
else {
remainder = chunk_at_offset(victim, nb);
unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
remainder->bk = remainder->fd = unsorted_chunks(av);
/* We cannot assume the unsorted list is empty and therefore
have to perform a complete insert here. */
bck = unsorted_chunks(av);
fwd = bck->fd;
remainder->bk = bck;
remainder->fd = fwd;
bck->fd = remainder;
fwd->bk = remainder;
set_head(victim, nb | PREV_INUSE |
(av != &main_arena ? NON_MAIN_ARENA : 0));
set_head(remainder, remainder_size | PREV_INUSE);
Expand Down
10 changes: 10 additions & 0 deletions nptl/ChangeLog
@@ -1,3 +1,13 @@
2006-08-31 Ulrich Drepper <drepper@redhat.com>

* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Undo last
change because it can disturb too much existing code. If real hard
reader preference is needed we'll introduce another type.
* sysdeps/pthread/pthread_rwlock_timedwrlock.c
(pthread_rwlock_timedwrlock): Likewise.
* sysdeps/pthread/pthread_rwlock_wrlock.c (__pthread_rwlock_wrlock):
Likewise.

2006-08-30 Ulrich Drepper <drepper@redhat.com>

* pthread_rwlock_trywrlock.c (__pthread_rwlock_trywrlock): Respect
Expand Down
7 changes: 2 additions & 5 deletions nptl/pthread_rwlock_trywrlock.c
@@ -1,4 +1,4 @@
/* Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003 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 @@ -30,10 +30,7 @@ __pthread_rwlock_trywrlock (rwlock)

lll_mutex_lock (rwlock->__data.__lock);

if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0
/* Respect the preference. */
&& (rwlock->__data.__flags != 0
|| rwlock->__data.__nr_readers_queued == 0))
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0)
{
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
result = 0;
Expand Down
6 changes: 2 additions & 4 deletions nptl/sysdeps/pthread/pthread_rwlock_timedwrlock.c
@@ -1,4 +1,4 @@
/* Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
Expand Down Expand Up @@ -40,9 +40,7 @@ pthread_rwlock_timedwrlock (rwlock, abstime)
int err;

/* Get the rwlock if there is no writer and no reader. */
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0
&& (rwlock->__data.__flags != 0
|| rwlock->__data.__nr_readers_queued == 0))
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0)
{
/* Mark self as writer. */
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
Expand Down
6 changes: 2 additions & 4 deletions nptl/sysdeps/pthread/pthread_rwlock_wrlock.c
@@ -1,4 +1,4 @@
/* Copyright (C) 2003, 2006 Free Software Foundation, Inc.
/* Copyright (C) 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
Expand Down Expand Up @@ -37,9 +37,7 @@ __pthread_rwlock_wrlock (rwlock)
while (1)
{
/* Get the rwlock if there is no writer and no reader. */
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0
&& (rwlock->__data.__flags != 0
|| rwlock->__data.__nr_readers_queued == 0))
if (rwlock->__data.__writer == 0 && rwlock->__data.__nr_readers == 0)
{
/* Mark self as writer. */
rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
Expand Down

0 comments on commit b80770b

Please sign in to comment.