• [PATCH 0/1] dpkg-gensymbols: Remove useless version script node symbols

    From Raul Tambre@21:1/5 to All on Sun Aug 29 22:30:01 2021
    Dear maintainer,

    This is a fix for the Debian bug #992796.
    Let me know if you'd prefer this split into multiple commits (detection, with_internal, dpkg-gensymbols).

    Raul Tambre (1):
    dpkg-gensymbols: Remove useless version script node symbols

    debian/changelog | 5 ++++
    scripts/Dpkg/Shlibs/Symbol.pm | 12 ++++++++++
    scripts/Dpkg/Shlibs/SymbolFile.pm | 2 ++
    scripts/dpkg-gensymbols.pl | 2 +-
    scripts/t/Dpkg_Shlibs.t | 24 +++++++++++++++++--
    .../t/Dpkg_Shlibs/symbols.internal-existing | 5 ++++
    6 files changed, 47 insertions(+), 3 deletions(-)
    create mode 100644 scripts/t/Dpkg_Shlibs/symbols.internal-existing

    --
    2.33.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Raul Tambre@21:1/5 to All on Sun Aug 29 22:30:02 2021
    Given a version script "test.sym":

    LIBTEST_1
    {
    };

    clang -shared /dev/null -o example.so -Wl,--version-script=test.sym -fuse-ld=ld llvm-nm -D example.so:

    0000000000000000 A LIBTEST_1@@LIBTEST_1
    w _ITM_deregisterTMCloneTable
    w _ITM_registerTMCloneTable
    w __cxa_finalize
    w __gmon_start__

    Other linkers such as LLVM lld and GNU gold don't generate the LIBTEST_1@@LIBTEST_1.
    It's a nullptr SHN_ABS symbol meaning it's completely useless in practice.

    Detecting these in symbol_is_internal() isn't sufficient as there're existing symbol
    files with these symbols.

    As such I've:
    * Added Dpkg::Shlibs::Symbol::get_internal() to classify such symbols.
    * Added with_internal option Dpkg::Shlibs::SymbolFile to allow omitting these symbols.
    * Changed dpkg-gensymbols to keep such symbols for before, but not after. This allows
    graceful removal of these from existing symbol files.
    ---
    debian/changelog | 5 ++++
    scripts/Dpkg/Shlibs/Symbol.pm | 12 ++++++++++
    scripts/Dpkg/Shlibs/SymbolFile.pm | 2 ++
    scripts/dpkg-gensymbols.pl | 2 +-
    scripts/t/Dpkg_Shlibs.t | 24 +++++++++++++++++--
    .../t/Dpkg_Shlibs/symbols.internal-existing | 5 ++++
    6 files changed, 47 insertions(+), 3 deletions(-)
    create mode 100644 scripts/t/Dpkg_Shlibs/symbols.internal-existing

    diff --git a/debian/changelog b/debian/changelog
    index ecf0e8a2a..9c0128fc0 100644
    --- a/debian/changelog
    +++ b/debian/changelog
    @@ -1,7 +1,12 @@
    dpkg (1.21.0) UNRELEASED; urgency=medium

    + [ Guillem Jover ]
    *

    + [ Raul Tambre ]
    + * dpkg-gensymbols: ignore invalid ld version script tag symbols.
    + Closes: #992796
    +
    -- Guillem Jover <guillem@debian.org> Wed, 14 Apr 2021 00:04:18 +0200

    dpkg (1.20.8) unstable; urgency=medium
    diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm