Bug 24194 - Non-compatibility symbols for clock_gettime etc. cause unnecessary librt dependencies
Summary: Non-compatibility symbols for clock_gettime etc. cause unnecessary librt depe...
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: librt (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: 2.30
Assignee: Florian Weimer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-02-08 09:20 UTC by Florian Weimer
Modified: 2019-09-03 07:48 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Weimer 2019-02-08 09:20:32 UTC
In glibc 2.17, clock_gettime, clock_getres, clock_settime, clock_getcpuclockid,   clock_nanosleep were added to libc, and rt/clock-compat.c was added with forwarders to the actual implementations in libc.  These were wrapped in

#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)

so that they are not present for newer architectures (such as powerpc64le) with a 2.17 or later ABI baseline.  But the forwarders were not marked as compatibility symbols.  As a result, on older architectures, historic configure checks such as

AC_CHECK_LIB(rt, clock_gettime)

still cause linking against librt, even though this is completely unnecessary.  It also creates a needless porting hazard because architectures behave differently when it comes to symbol availability.
Comment 1 Sourceware Commits 2019-02-08 09:58:27 UTC
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  f289e656ec8221756519a601042bc9fbe1b310fb (commit)
      from  823624bdc47f1f80109c9c52dee7939b9386d708 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f289e656ec8221756519a601042bc9fbe1b310fb

commit f289e656ec8221756519a601042bc9fbe1b310fb
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Feb 8 10:21:56 2019 +0100

    rt: Turn forwards from librt to libc into compat symbols [BZ #24194]
    
    As the  result of commit 6e6249d0b461b952d0f544792372663feb6d792a
    ("BZ#14743: Move clock_* symbols from librt to libc."), in glibc 2.17,
    clock_gettime, clock_getres, clock_settime, clock_getcpuclockid,
    clock_nanosleep were added to libc, and the file rt/clock-compat.c
    was added with forwarders to the actual implementations in libc.
    These forwarders were wrapped in
    
    #if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
    
    so that they are not present for newer architectures (such as
    powerpc64le) with a 2.17 or later ABI baseline.  But the forwarders
    were not marked as compatibility symbols.  As a result, on older
    architectures, historic configure checks such as
    
    AC_CHECK_LIB(rt, clock_gettime)
    
    still cause linking against librt, even though this is completely
    unnecessary.  It also creates a needless porting hazard because
    architectures behave differently when it comes to symbol availability.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |    5 +++++
 NEWS              |    6 +++++-
 rt/clock-compat.c |    6 ++++--
 3 files changed, 14 insertions(+), 3 deletions(-)
Comment 2 Florian Weimer 2019-02-08 10:08:32 UTC
Fixed in glibc 2.30.
Comment 3 Florian Weimer 2019-02-08 10:08:44 UTC
.