mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
* Makerules (cpp-srcs-left): When setting this to run
cppflags-iterator.mk, must append .c to $(tests) and $(xtests) words. Combine the two loops into one on the concatenated list, including those as well as $(test-srcs). * elf/dl-minimal.c (__libc_memalign): Guts of malloc moved here, since we align here with optimally minimal waste anyway. (malloc): Just call that. * sysdeps/generic/libc-tls.c (__libc_setup_tls): Set l_tls_offset to the right variable. * elf/dl-load.c (_dl_map_object_from_fd): Use p_vaddr, not p_offset, to compute memory location for l_tls_initimage. * elf/rtld.c (_dl_start): Likewise. * sysdeps/generic/libc-tls.c (__libc_setup_tls): Likewise. * libio/oldiopopen.c: Move #include's before #if SHLIB_COMPAT, because the .d file is generated in the non-shared case and so fails to catch them otherwise. * sysdeps/generic/dl-tls.c (_dl_allocate_tls_storage): New function, split out of _dl_allocate_tls. (_dl_allocate_tls_init): Likewise. (_dl_allocate_tls): Call those. * sysdeps/generic/ldsodefs.h: Declare them with attribute_hidden. * elf/rtld.c (dl_main): Call them separately instead of calling _dl_allocate_tls. Delay _dl_allocate_tls_init until after relocation is finished, so that the initializer data has been relocated before we copy it into the main thread's TLS block. * sysdeps/generic/dl-tls.c (_dl_allocate_tls): Fix off-by-one error in loop conditions, prevented the last used module from being initialized.
This commit is contained in:
@ -46,8 +46,9 @@ extern unsigned long int weak_function strtoul (const char *nptr,
|
||||
char **endptr, int base);
|
||||
|
||||
|
||||
/* Allocate an aligned memory block. */
|
||||
void * weak_function
|
||||
malloc (size_t n)
|
||||
__libc_memalign (size_t align, size_t n)
|
||||
{
|
||||
#ifdef MAP_ANON
|
||||
#define _dl_zerofd (-1)
|
||||
@ -70,8 +71,8 @@ malloc (size_t n)
|
||||
}
|
||||
|
||||
/* Make sure the allocation pointer is ideally aligned. */
|
||||
alloc_ptr = (void *) 0 + (((alloc_ptr - (void *) 0) + sizeof (double) - 1)
|
||||
& ~(sizeof (double) - 1));
|
||||
alloc_ptr = (void *) 0 + (((alloc_ptr - (void *) 0) + align - 1)
|
||||
& ~(align - 1));
|
||||
|
||||
if (alloc_ptr + n >= alloc_end)
|
||||
{
|
||||
@ -91,6 +92,12 @@ malloc (size_t n)
|
||||
return alloc_last_block;
|
||||
}
|
||||
|
||||
void * weak_function
|
||||
malloc (size_t n)
|
||||
{
|
||||
return __libc_memalign (sizeof (double), n);
|
||||
}
|
||||
|
||||
/* We use this function occasionally since the real implementation may
|
||||
be optimized when it can assume the memory it returns already is
|
||||
set to NUL. */
|
||||
@ -124,15 +131,6 @@ realloc (void *ptr, size_t n)
|
||||
assert (new == ptr);
|
||||
return new;
|
||||
}
|
||||
|
||||
/* Return alligned memory block. */
|
||||
void * weak_function
|
||||
__libc_memalign (size_t align, size_t n)
|
||||
{
|
||||
void *newp = malloc (n + align - 1);
|
||||
|
||||
return (void *) roundup ((uintptr_t) newp, align);
|
||||
}
|
||||
|
||||
/* Avoid signal frobnication in setjmp/longjmp. Keeps things smaller. */
|
||||
|
||||
|
Reference in New Issue
Block a user