diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | elf/sprof.c | 11 | ||||
-rw-r--r-- | malloc/malloc.c | 22 |
3 files changed, 29 insertions, 12 deletions
@@ -1,3 +1,11 @@ +2004-08-13 Ulrich Drepper <drepper@redhat.com> + + * elf/sprof.c (read_symbols): When comparing aliases, prefer + strong over weak symbols if both don't start with '_'. + + * malloc/malloc.c: Use strong_alias instead of weak_alias wherever + possible. + 2004-08-12 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/bits/resource.h: Define non-standard diff --git a/elf/sprof.c b/elf/sprof.c index 9ba28bc581..458a0905c0 100644 --- a/elf/sprof.c +++ b/elf/sprof.c @@ -148,6 +148,7 @@ struct known_symbol const char *name; uintptr_t addr; size_t size; + int weak; uintmax_t ticks; uintmax_t calls; @@ -938,6 +939,7 @@ read_symbols (struct shobj *shobj) newsym->name = &shobj->strtab[sym->st_name]; newsym->addr = sym->st_value; newsym->size = sym->st_size; + newsym->weak = ELFW(ST_BIND) (sym->st_info) == STB_WEAK; newsym->ticks = 0; newsym->calls = 0; @@ -952,7 +954,9 @@ read_symbols (struct shobj *shobj) { /* The function is already defined. See whether we have a better name here. */ - if ((*existp)->name[0] == '_' && newsym->name[0] != '_') + if (((*existp)->name[0] == '_' && newsym->name[0] != '_') + || ((*existp)->name[0] != '_' && newsym->name[0] != '_' + && (*existp)->weak && !newsym->weak)) *existp = newsym; else /* We don't need the allocated memory. */ @@ -990,6 +994,7 @@ read_symbols (struct shobj *shobj) newsym->name = &strtab[symtab->st_name]; newsym->addr = symtab->st_value; newsym->size = symtab->st_size; + newsym->weak = ELFW(ST_BIND) (symtab->st_info) == STB_WEAK; newsym->ticks = 0; newsym->froms = NULL; newsym->tos = NULL; @@ -1005,7 +1010,9 @@ read_symbols (struct shobj *shobj) { /* The function is already defined. See whether we have a better name here. */ - if ((*existp)->name[0] == '_' && newsym->name[0] != '_') + if (((*existp)->name[0] == '_' && newsym->name[0] != '_') + || ((*existp)->name[0] != '_' && newsym->name[0] != '_' + && (*existp)->weak && !newsym->weak)) *existp = newsym; else /* We don't need the allocated memory. */ diff --git a/malloc/malloc.c b/malloc/malloc.c index 6cac7d4406..6e6c1053b1 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -5439,16 +5439,18 @@ __posix_memalign (void **memptr, size_t alignment, size_t size) } weak_alias (__posix_memalign, posix_memalign) -weak_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc) -weak_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree) -weak_alias (__libc_free, __free) weak_alias (__libc_free, free) -weak_alias (__libc_malloc, __malloc) weak_alias (__libc_malloc, malloc) -weak_alias (__libc_memalign, __memalign) weak_alias (__libc_memalign, memalign) -weak_alias (__libc_realloc, __realloc) weak_alias (__libc_realloc, realloc) -weak_alias (__libc_valloc, __valloc) weak_alias (__libc_valloc, valloc) -weak_alias (__libc_pvalloc, __pvalloc) weak_alias (__libc_pvalloc, pvalloc) -weak_alias (__libc_mallinfo, __mallinfo) weak_alias (__libc_mallinfo, mallinfo) -weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt) +strong_alias (__libc_calloc, __calloc) weak_alias (__libc_calloc, calloc) +strong_alias (__libc_free, __cfree) weak_alias (__libc_free, cfree) +strong_alias (__libc_free, __free) strong_alias (__libc_free, free) +strong_alias (__libc_malloc, __malloc) strong_alias (__libc_malloc, malloc) +strong_alias (__libc_memalign, __memalign) +weak_alias (__libc_memalign, memalign) +strong_alias (__libc_realloc, __realloc) strong_alias (__libc_realloc, realloc) +strong_alias (__libc_valloc, __valloc) weak_alias (__libc_valloc, valloc) +strong_alias (__libc_pvalloc, __pvalloc) weak_alias (__libc_pvalloc, pvalloc) +strong_alias (__libc_mallinfo, __mallinfo) +weak_alias (__libc_mallinfo, mallinfo) +strong_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt) weak_alias (__malloc_stats, malloc_stats) weak_alias (__malloc_usable_size, malloc_usable_size) |