[binutils-gdb/binutils-2_45-branch] gprofng: do not skip weak symbols

Vladimir Mezentsev vmezents@sourceware.org
Mon Jul 21 16:27:41 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c947a34079fb7e39b1a149def59c6ed606e25844

commit c947a34079fb7e39b1a149def59c6ed606e25844
Author: Dmitrii Bordukov <dabordukov@gmail.com>
Date:   Sat Jul 19 15:21:46 2025 +0300

    gprofng: do not skip weak symbols
    
    PR gprofng/33151
    
    gprofng ignores functions that are compiled as weak symbols. This
    heavily affects C++ class methods that are always compiled by g++
    and clang++ as weak symbols. In this case 'gprofng display text'
    just displays <static>@ADDRESS(<FILENAME>) instead of proper method
    name.
    
    The bug has been introduced in the commit 470a0288a818.

Diff:
---
 gprofng/src/Stabs.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gprofng/src/Stabs.cc b/gprofng/src/Stabs.cc
index 116316ed5b6..20bdf8ba663 100644
--- a/gprofng/src/Stabs.cc
+++ b/gprofng/src/Stabs.cc
@@ -1546,7 +1546,7 @@ Stabs::readSymSec (Elf *elf, bool is_dynamic)
       switch (GELF_ST_TYPE (Sym.st_info))
 	{
 	case STT_FUNC:
-	  if (Sym.st_size == 0 || ELF_ST_BIND (Sym.st_info) == STB_WEAK)
+	  if (Sym.st_size == 0)
 	    break;
 	  if (Sym.st_shndx == 0)
 	    {


More information about the Binutils-cvs mailing list