#783054 mklibs-readelf does not list symbols of GNU unique type as provided

#783054#5
Date:
2015-04-21 09:13:07 UTC
From:
To:
Dear Maintainer,

   * What led up to the situation?

GNU unique symbol bind type is introduced, and enabled by GCC 4.9 to address some
certain binding problems. The Standard C++ library from GCC as a result, uses
this binding type for some of the symbols.
However, mklibs-readelf does not treat any symbol other than STB_WEAK or
STB_GLOBAL as provided by library.
The issue randers some symbols false 'unresolvable' when trying to generate
minimal library set.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

mklibs-readelf --print-symbols-provided /usr/lib/x86_64-linux-gnu/libstdc++.so.6 \
  | grep empty_rep_storage

   * What was the outcome of this action?

Nothing, so the symbol is `not provided'.

   * What outcome did you expect instead?

_ZNSs4_Rep20_S_empty_rep_storageE False GLIBCXX_3.4 True
_ZNSbIwSt11char_traitsIwESaIwEE4_Rep20_S_empty_rep_storageE False GLIBCXX_3.4 True
From: Yuanjie Huang <yuanjie.huang@windriver.com>
Date: Wed, 15 Apr 2015 14:00:06 +0800
Subject: [PATCH] Show GNU unique symbols as provided symbols

GNU Unique symbol is a GNU extension employed by new version of GCC
by default. Even Standard C++ library in GCC 4.9 provides some symbols,
such as _ZNSs4_Rep20_S_empty_rep_storageE in this binding type instead
of ELF standard weak binding.
This patch adds support of this new binding type to mklibs-readelf.

Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
---
 src/mklibs-readelf/main.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mklibs-readelf/main.cpp b/src/mklibs-readelf/main.cpp
index 56d93f8..0134530 100644
--- a/src/mklibs-readelf/main.cpp
+++ b/src/mklibs-readelf/main.cpp
@@ -88,7 +88,7 @@ static void process_symbols_provided (const Elf::section_type<Elf::section_type_
     uint8_t type = symbol->get_type ();
     const std::string &name = symbol->get_name_string ();

-    if (bind != STB_GLOBAL && bind != STB_WEAK)
+    if (bind != STB_GLOBAL && bind != STB_WEAK && bind != STB_GNU_UNIQUE)
       continue;
     if (shndx == SHN_UNDEF || shndx == SHN_ABS)
       continue;