summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch
blob: 1552c69b525794660c94ae0827cc2c88728410ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
If we link against a newer glibc 2.34 and then try and our LD_PRELOAD is run against a
binary on a host with an older libc, we see symbol errors since in glibc 2.34, pthread 
and dl are merged into libc itself.

We need to use the older form of linking so use glibc binaries from an older release
to force this. We only use minimal symbols from these anyway.

pthread_atfork is problematic, particularly on arm so use the internal glibc routine
it maps too. This was always present in the main libc from 2.3.2 onwards.

Yes this is horrible. Better solutions welcome.

There is more info in the bug: [YOCTO #14521]

Upstream-Status: Inappropriate [this patch is native only]
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

Index: git/Makefile.in
===================================================================
--- git.orig/Makefile.in
+++ git/Makefile.in
@@ -122,7 +122,7 @@ libpseudo: $(LIBPSEUDO)
 $(LIBPSEUDO): $(WRAPOBJS) pseudo_client.o pseudo_ipc.o $(SHOBJS) | $(LIB)
 	$(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -shared -o $(LIBPSEUDO) \
 		pseudo_client.o pseudo_ipc.o \
-		$(WRAPOBJS) $(SHOBJS) $(LDFLAGS) $(CLIENT_LDFLAGS)
+		$(WRAPOBJS) $(SHOBJS) $(LDFLAGS) -Lprebuilt/$(shell uname -m)-linux/lib/ $(CLIENT_LDFLAGS)
 
 # *everything* now relies on stuff that's generated in the
 # wrapper process.
Index: git/pseudo_wrappers.c
===================================================================
--- git.orig/pseudo_wrappers.c
+++ git/pseudo_wrappers.c
@@ -100,10 +100,13 @@ static void libpseudo_atfork_child(void)
 	pseudo_mutex_holder = 0;
 }
 
+extern void *__dso_handle;
+extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
+
 static void
 _libpseudo_init(void) {
 	if (!_libpseudo_initted)
-		pthread_atfork(NULL, NULL, libpseudo_atfork_child);
+		__register_atfork (NULL, NULL, libpseudo_atfork_child, &__dso_handle == NULL ? NULL : __dso_handle);
 
 	pseudo_getlock();
 	pseudo_antimagic();