This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: [patch] Improve ELF symbols preference (global > weak)
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Mon, 08 Oct 2012 20:54:57 +0200
- Subject: Re: [patch] Improve ELF symbols preference (global > weak)
Hi,
sorry, forgot a ChangeLog:
libdwfl/
2012-10-08 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwfl_module_addrsym.c (dwfl_module_addrsym): Prefer also STB_WEAK
over STB_LOCAL.
diff --git a/libdwfl/dwfl_module_addrsym.c b/libdwfl/dwfl_module_addrsym.c
index 4e0646e..7ea6289 100644
--- a/libdwfl/dwfl_module_addrsym.c
+++ b/libdwfl/dwfl_module_addrsym.c
@@ -133,13 +143,13 @@ dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr,
}
}
/* When the beginning of its range is no closer,
- the end of its range might be. But do not
- replace a global symbol with a local! */
+ the end of its range might be. Prefer STB_GLOBAL over
+ STB_WEAK and STB_WEAK over STB_LOCAL. */
else if (sym.st_size != 0
&& closest_sym->st_value == sym.st_value
- && closest_sym->st_size > sym.st_size
- && (GELF_ST_BIND (closest_sym->st_info)
- <= GELF_ST_BIND (sym.st_info)))
+ && closest_sym->st_size >= sym.st_size
+ && (GELF_ST_BIND (sym.st_info) == STB_GLOBAL
+ || GELF_ST_BIND (closest_sym->st_info) == STB_LOCAL))
{
*closest_sym = sym;
closest_shndx = shndx;