This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]