[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r8305 - in /fsf/trunk/libc: ChangeLog elf/dl-open.c elf/rtld.c malloc/arena.c malloc/hooks.c malloc/malloc.c resolv/res_send.c
- To: commits@xxxxxxxxxx
- Subject: [commits] r8305 - in /fsf/trunk/libc: ChangeLog elf/dl-open.c elf/rtld.c malloc/arena.c malloc/hooks.c malloc/malloc.c resolv/res_send.c
- From: eglibc@xxxxxxxxxx
- Date: Fri, 17 Apr 2009 07:05:08 -0000
Author: eglibc
Date: Fri Apr 17 00:05:07 2009
New Revision: 8305
Log:
Import glibc-mainline for 2009-04-17
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/elf/dl-open.c
fsf/trunk/libc/elf/rtld.c
fsf/trunk/libc/malloc/arena.c
fsf/trunk/libc/malloc/hooks.c
fsf/trunk/libc/malloc/malloc.c
fsf/trunk/libc/resolv/res_send.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Apr 17 00:05:07 2009
@@ -1,3 +1,41 @@
+2009-04-16 Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>
+
+ * elf/rtld.c (dl_main): Really call _dl_sysdep_start_cleanup after all
+ calls to _dl_relocate_object.
+
+2009-04-16 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ [BZ #9957]
+ * malloc/malloc.c (force_reg): Define.
+ (sYSMALLOc): Load hook variable into variable
+ before test and force into register.
+ (sYSTRIm): Likewise.
+ (public_mALLOc): Force hook value into register.
+ (public_fREe): Likewise.
+ (public_rEALLOc): Likewise.
+ (public_mEMALIGn): Likewise.
+ (public_vALLOc): Likewise.
+ (public_pVALLOc): Likewise.
+ (public_cALLOc): Likewise.
+ (__posix_memalign): Likewise.
+ * malloc/arena.c (ptmalloc_init): Load hook variable into variable
+ before test and force into register.
+ * malloc/hooks.c (top_check): Likewise.
+ (public_s_ET_STATe): Pretty printing.
+
+ * resolv/res_send.c (send_dg): Don't just ignore the result we got
+ in case we only receive one reply in single-request mode.
+
+2009-04-16 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * elf/dl-open.c (_dl_open): Bump GL(dl_nns) to 1 if no libraries
+ are dlopened in statically linked program even for __LM_ID_CALLER.
+
+2009-04-16 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * resolv/res_send.c (send_dg): Don't switch into single-request
+ mode if we already are in it.
+
2009-04-15 Ulrich Drepper <drepper@xxxxxxxxxx>
* sysdeps/unix/sysv/linux/getsysstats.c (next_line): Make sure there
Modified: fsf/trunk/libc/elf/dl-open.c
==============================================================================
--- fsf/trunk/libc/elf/dl-open.c (original)
+++ fsf/trunk/libc/elf/dl-open.c Fri Apr 17 00:05:07 2009
@@ -580,7 +580,8 @@
_dl_signal_error (EINVAL, file, NULL,
N_("invalid target namespace in dlmopen()"));
#ifndef SHARED
- else if (nsid == LM_ID_BASE && GL(dl_ns)[LM_ID_BASE]._ns_loaded == NULL
+ else if ((nsid == LM_ID_BASE || nsid == __LM_ID_CALLER)
+ && GL(dl_ns)[LM_ID_BASE]._ns_loaded == NULL
&& GL(dl_nns) == 0)
GL(dl_nns) = 1;
#endif
Modified: fsf/trunk/libc/elf/rtld.c
==============================================================================
--- fsf/trunk/libc/elf/rtld.c (original)
+++ fsf/trunk/libc/elf/rtld.c Fri Apr 17 00:05:07 2009
@@ -2181,8 +2181,6 @@
if (l->l_tls_blocksize != 0 && tls_init_tp_called)
_dl_add_to_slotinfo (l);
}
-
- _dl_sysdep_start_cleanup ();
}
else
{
@@ -2237,13 +2235,6 @@
HP_TIMING_DIFF (relocate_time, start, stop);
- /* Do any necessary cleanups for the startup OS interface code.
- We do these now so that no calls are made after rtld re-relocation
- which might be resolved to different functions than we expect.
- We cannot do this before relocating the other objects because
- _dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
- _dl_sysdep_start_cleanup ();
-
/* Now enable profiling if needed. Like the previous call,
this has to go here because the calls it makes should use the
rtld versions of the functions (particularly calloc()), but it
@@ -2298,6 +2289,13 @@
HP_TIMING_DIFF (add, start, stop);
HP_TIMING_ACCUM_NT (relocate_time, add);
}
+
+ /* Do any necessary cleanups for the startup OS interface code.
+ We do these now so that no calls are made after rtld re-relocation
+ which might be resolved to different functions than we expect.
+ We cannot do this before relocating the other objects because
+ _dl_relocate_object might need to call `mprotect' for DT_TEXTREL. */
+ _dl_sysdep_start_cleanup ();
#ifdef SHARED
/* Auditing checkpoint: we have added all objects. */
Modified: fsf/trunk/libc/malloc/arena.c
==============================================================================
--- fsf/trunk/libc/malloc/arena.c (original)
+++ fsf/trunk/libc/malloc/arena.c Fri Apr 17 00:05:07 2009
@@ -624,8 +624,9 @@
if (check_action != 0)
__malloc_check_init();
}
- if(__malloc_initialize_hook != NULL)
- (*__malloc_initialize_hook)();
+ void (*hook) (void) = force_reg (__malloc_initialize_hook);
+ if (hook != NULL)
+ (*hook)();
__malloc_initialized = 1;
}
Modified: fsf/trunk/libc/malloc/hooks.c
==============================================================================
--- fsf/trunk/libc/malloc/hooks.c (original)
+++ fsf/trunk/libc/malloc/hooks.c Fri Apr 17 00:05:07 2009
@@ -235,8 +235,9 @@
return -1;
}
/* Call the `morecore' hook if necessary. */
- if (__after_morecore_hook)
- (*__after_morecore_hook) ();
+ void (*hook) (void) = __after_morecore_hook;
+ if (hook)
+ (*hook) ();
main_arena.system_mem = (new_brk - mp_.sbrk_base) + sbrk_size;
top(&main_arena) = (mchunkptr)(brk + front_misalign);
@@ -669,10 +670,10 @@
!disallow_malloc_check)
__malloc_check_init ();
else if (!ms->using_malloc_checking && using_malloc_checking) {
- __malloc_hook = 0;
- __free_hook = 0;
- __realloc_hook = 0;
- __memalign_hook = 0;
+ __malloc_hook = NULL;
+ __free_hook = NULL;
+ __realloc_hook = NULL;
+ __memalign_hook = NULL;
using_malloc_checking = 0;
}
}
Modified: fsf/trunk/libc/malloc/malloc.c
==============================================================================
--- fsf/trunk/libc/malloc/malloc.c (original)
+++ fsf/trunk/libc/malloc/malloc.c Fri Apr 17 00:05:07 2009
@@ -563,6 +563,13 @@
#endif
#endif
#endif
+
+
+/* Force a value to be in a register and stop the compiler referring
+ to the source (mostly memory location) again. */
+#define force_reg(val) \
+ ({ __typeof (val) _v; asm ("" : "=r" (_v) : "0" (val)); _v; })
+
/*
MALLOC_FAILURE_ACTION is the action to take before "return 0" when
@@ -3165,8 +3172,9 @@
if (brk != (char*)(MORECORE_FAILURE)) {
/* Call the `morecore' hook if necessary. */
- if (__builtin_expect (__after_morecore_hook != NULL, 0))
- (*__after_morecore_hook) ();
+ void (*hook) (void) = force_reg (__after_morecore_hook);
+ if (__builtin_expect (hook != NULL, 0))
+ (*hook) ();
} else {
/*
If have mmap, try using it as a backup when MORECORE fails or
@@ -3302,10 +3310,12 @@
if (snd_brk == (char*)(MORECORE_FAILURE)) {
correction = 0;
snd_brk = (char*)(MORECORE(0));
- } else
+ } else {
/* Call the `morecore' hook if necessary. */
- if (__builtin_expect (__after_morecore_hook != NULL, 0))
- (*__after_morecore_hook) ();
+ void (*hook) (void) = force_reg (__after_morecore_hook);
+ if (__builtin_expect (hook != NULL, 0))
+ (*hook) ();
+ }
}
/* handle non-contiguous cases */
@@ -3453,8 +3463,9 @@
MORECORE(-extra);
/* Call the `morecore' hook if necessary. */
- if (__builtin_expect (__after_morecore_hook != NULL, 0))
- (*__after_morecore_hook) ();
+ void (*hook) (void) = force_reg (__after_morecore_hook);
+ if (__builtin_expect (hook != NULL, 0))
+ (*hook) ();
new_brk = (char*)(MORECORE(0));
if (new_brk != (char*)MORECORE_FAILURE) {
@@ -3579,7 +3590,8 @@
mstate ar_ptr;
Void_t *victim;
- __malloc_ptr_t (*hook) (size_t, __const __malloc_ptr_t) = __malloc_hook;
+ __malloc_ptr_t (*hook) (size_t, __const __malloc_ptr_t)
+ = force_reg (__malloc_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(bytes, RETURN_ADDRESS (0));
@@ -3655,7 +3667,8 @@
mstate ar_ptr;
mchunkptr p; /* chunk corresponding to mem */
- void (*hook) (__malloc_ptr_t, __const __malloc_ptr_t) = __free_hook;
+ void (*hook) (__malloc_ptr_t, __const __malloc_ptr_t)
+ = force_reg (__free_hook);
if (__builtin_expect (hook != NULL, 0)) {
(*hook)(mem, RETURN_ADDRESS (0));
return;
@@ -3713,7 +3726,7 @@
Void_t* newp; /* chunk to return */
__malloc_ptr_t (*hook) (__malloc_ptr_t, size_t, __const __malloc_ptr_t) =
- __realloc_hook;
+ force_reg (__realloc_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(oldmem, bytes, RETURN_ADDRESS (0));
@@ -3825,7 +3838,7 @@
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
- __memalign_hook;
+ force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(alignment, bytes, RETURN_ADDRESS (0));
@@ -3882,7 +3895,7 @@
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
- __memalign_hook;
+ force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(pagesz, bytes, RETURN_ADDRESS (0));
@@ -3929,7 +3942,7 @@
__malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
__const __malloc_ptr_t)) =
- __memalign_hook;
+ force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
return (*hook)(pagesz, rounded_bytes, RETURN_ADDRESS (0));
@@ -3970,8 +3983,6 @@
unsigned long clearsize;
unsigned long nclears;
INTERNAL_SIZE_T* d;
- __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) =
- __malloc_hook;
/* size_t is unsigned so the behavior on overflow is defined. */
bytes = n * elem_size;
@@ -3984,6 +3995,8 @@
}
}
+ __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, __const __malloc_ptr_t)) =
+ force_reg (__malloc_hook);
if (__builtin_expect (hook != NULL, 0)) {
sz = bytes;
mem = (*hook)(sz, RETURN_ADDRESS (0));
@@ -6192,9 +6205,6 @@
__posix_memalign (void **memptr, size_t alignment, size_t size)
{
void *mem;
- __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
- __const __malloc_ptr_t)) =
- __memalign_hook;
/* Test whether the SIZE argument is valid. It must be a power of
two multiple of sizeof (void *). */
@@ -6205,6 +6215,9 @@
/* Call the hook here, so that caller is posix_memalign's caller
and not posix_memalign itself. */
+ __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
+ __const __malloc_ptr_t)) =
+ force_reg (__memalign_hook);
if (__builtin_expect (hook != NULL, 0))
mem = (*hook)(alignment, size, RETURN_ADDRESS (0));
else
Modified: fsf/trunk/libc/resolv/res_send.c
==============================================================================
--- fsf/trunk/libc/resolv/res_send.c (original)
+++ fsf/trunk/libc/resolv/res_send.c Fri Apr 17 00:05:07 2009
@@ -1057,9 +1057,15 @@
having received one answer switch to the mode
where we send the second request only once we
have received the first answer. */
- single_request = true;
- *gotsomewhere = save_gotsomewhere;
- goto retry;
+ if (!single_request)
+ {
+ single_request = true;
+ *gotsomewhere = save_gotsomewhere;
+ goto retry;
+ }
+
+ *resplen2 = 1;
+ return resplen;
}
*gotsomewhere = 1;