Skip to content

Commit 8f6f0d8

Browse files
committed
guix: backport glibc patch to prevent redundant librt link
1 parent e144732 commit 8f6f0d8

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

contrib/guix/manifest.scm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ inspecting signatures in Mach-O binaries.")
558558
"0azpb9cvnbv25zg8019rqz48h8i2257ngyjg566dlnp74ivrs9vq"))
559559
(patches (search-our-patches "glibc-2.27-riscv64-Use-__has_include-to-include-asm-syscalls.h.patch"
560560
"glibc-2.27-fcommon.patch"
561-
"glibc-2.27-guix-prefix.patch"))))))
561+
"glibc-2.27-guix-prefix.patch"
562+
"glibc-2.27-no-librt.patch"))))))
562563

563564
(packages->manifest
564565
(append
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
This patch can be dropped when we are building with glibc 2.30+.
2+
3+
commit 6e41ef56c9baab719a02f1377b1e7ce7bff61e73
4+
Author: Florian Weimer <fweimer@redhat.com>
5+
Date: Fri Feb 8 10:21:56 2019 +0100
6+
7+
rt: Turn forwards from librt to libc into compat symbols [BZ #24194]
8+
9+
As the result of commit 6e6249d0b461b952d0f544792372663feb6d792a
10+
("BZ#14743: Move clock_* symbols from librt to libc."), in glibc 2.17,
11+
clock_gettime, clock_getres, clock_settime, clock_getcpuclockid,
12+
clock_nanosleep were added to libc, and the file rt/clock-compat.c
13+
was added with forwarders to the actual implementations in libc.
14+
These forwarders were wrapped in
15+
16+
#if SHLIB_COMPAT (librt, GLIBC_2_2, GLIBC_2_17)
17+
18+
so that they are not present for newer architectures (such as
19+
powerpc64le) with a 2.17 or later ABI baseline. But the forwarders
20+
were not marked as compatibility symbols. As a result, on older
21+
architectures, historic configure checks such as
22+
23+
AC_CHECK_LIB(rt, clock_gettime)
24+
25+
still cause linking against librt, even though this is completely
26+
unnecessary. It also creates a needless porting hazard because
27+
architectures behave differently when it comes to symbol availability.
28+
29+
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
30+
31+
diff --git a/rt/clock-compat.c b/rt/clock-compat.c
32+
index f816973c05..11e71aa890 100644
33+
--- a/rt/clock-compat.c
34+
+++ b/rt/clock-compat.c
35+
@@ -30,14 +30,16 @@
36+
#if HAVE_IFUNC
37+
# undef INIT_ARCH
38+
# define INIT_ARCH()
39+
-# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name)
40+
+# define COMPAT_REDIRECT(name, proto, arglist) libc_ifunc (name, &__##name) \
41+
+ compat_symbol (librt, name, name, GLIBC_2_2);
42+
#else
43+
# define COMPAT_REDIRECT(name, proto, arglist) \
44+
int \
45+
name proto \
46+
{ \
47+
return __##name arglist; \
48+
- }
49+
+ } \
50+
+ compat_symbol (librt, name, name, GLIBC_2_2);
51+
#endif
52+
53+
COMPAT_REDIRECT (clock_getres,

0 commit comments

Comments
 (0)