about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-13 18:39:44 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-13 18:39:44 +0000
commiteba19d2be7678d6ec4f448919d05a89c0e8294cc (patch)
treeb2a617d2b5b2685253916fac1e16d6a656350782 /elf
parent5b6f86b37479ca44fd04cde915fe6ecf3a906dd1 (diff)
downloadglibc-eba19d2be7678d6ec4f448919d05a89c0e8294cc.tar.gz
glibc-eba19d2be7678d6ec4f448919d05a89c0e8294cc.tar.xz
glibc-eba19d2be7678d6ec4f448919d05a89c0e8294cc.zip
Update.
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.
Diffstat (limited to 'elf')
-rw-r--r--elf/sprof.c11
1 files changed, 9 insertions, 2 deletions
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.  */