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 '_'.
+ non-hidden over hidden symbols and strong over weak symbols
+ if both don't start with '_'.
* malloc/malloc.c: Use strong_alias instead of weak_alias wherever
possible.
#include <locale.h>
#include <obstack.h>
#include <search.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char *name;
uintptr_t addr;
size_t size;
- int weak;
+ bool weak;
+ bool hidden;
uintmax_t ticks;
uintmax_t calls;
newsym->addr = sym->st_value;
newsym->size = sym->st_size;
newsym->weak = ELFW(ST_BIND) (sym->st_info) == STB_WEAK;
+ newsym->hidden = (ELFW(ST_VISIBILITY) (sym->st_other)
+ != STV_DEFAULT);
newsym->ticks = 0;
newsym->calls = 0;
{
/* The function is already defined. See whether we have
a better name here. */
- if (((*existp)->name[0] == '_' && newsym->name[0] != '_')
+ if (((*existp)->hidden && !newsym->hidden)
+ || ((*existp)->name[0] == '_' && newsym->name[0] != '_')
|| ((*existp)->name[0] != '_' && newsym->name[0] != '_'
- && (*existp)->weak && !newsym->weak))
+ && ((*existp)->weak && !newsym->weak)))
*existp = newsym;
else
/* We don't need the allocated memory. */
newsym->addr = symtab->st_value;
newsym->size = symtab->st_size;
newsym->weak = ELFW(ST_BIND) (symtab->st_info) == STB_WEAK;
+ newsym->hidden = (ELFW(ST_VISIBILITY) (symtab->st_other)
+ != STV_DEFAULT);
newsym->ticks = 0;
newsym->froms = NULL;
newsym->tos = NULL;
{
/* The function is already defined. See whether we have
a better name here. */
- if (((*existp)->name[0] == '_' && newsym->name[0] != '_')
+ if (((*existp)->hidden && !newsym->hidden)
+ || ((*existp)->name[0] == '_' && newsym->name[0] != '_')
|| ((*existp)->name[0] != '_' && newsym->name[0] != '_'
- && (*existp)->weak && !newsym->weak))
+ && ((*existp)->weak && !newsym->weak)))
*existp = newsym;
else
/* We don't need the allocated memory. */