diff options
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch')
-rw-r--r-- | meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch b/meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch new file mode 100644 index 0000000000..c453b5f735 --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch | |||
@@ -0,0 +1,57 @@ | |||
1 | If we link against a newer glibc 2.34 and then try and our LD_PRELOAD is run against a | ||
2 | binary on a host with an older libc, we see symbol errors since in glibc 2.34, pthread | ||
3 | and dl are merged into libc itself. | ||
4 | |||
5 | We need to use the older form of linking so use glibc binaries from an older release | ||
6 | to force this. We only use minimal symbols from these anyway. | ||
7 | |||
8 | pthread_atfork is problematic, particularly on arm so use the internal glibc routine | ||
9 | it maps too. This was always present in the main libc from 2.3.2 onwards. | ||
10 | |||
11 | Yes this is horrible. Better solutions welcome. | ||
12 | |||
13 | There is more info in the bug: [YOCTO #14521] | ||
14 | |||
15 | Upstream-Status: Inappropriate [this patch is native and nativesdk] | ||
16 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
17 | |||
18 | Tweak library search order, make prebuilt lib ahead of recipe lib | ||
19 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
20 | --- | ||
21 | Makefile.in | 2 +- | ||
22 | pseudo_wrappers.c | 5 ++++- | ||
23 | 2 files changed, 5 insertions(+), 2 deletions(-) | ||
24 | |||
25 | diff --git a/Makefile.in b/Makefile.in | ||
26 | --- a/Makefile.in | ||
27 | +++ b/Makefile.in | ||
28 | @@ -120,7 +120,7 @@ $(PSEUDODB): pseudodb.o $(SHOBJS) $(DBOBJS) pseudo_ipc.o | $(BIN) | ||
29 | libpseudo: $(LIBPSEUDO) | ||
30 | |||
31 | $(LIBPSEUDO): $(WRAPOBJS) pseudo_client.o pseudo_ipc.o $(SHOBJS) | $(LIB) | ||
32 | - $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -shared -o $(LIBPSEUDO) \ | ||
33 | + $(CC) $(CFLAGS) -Lprebuilt/$(shell uname -m)-linux/lib/ $(CFLAGS_PSEUDO) -shared -o $(LIBPSEUDO) \ | ||
34 | pseudo_client.o pseudo_ipc.o \ | ||
35 | $(WRAPOBJS) $(SHOBJS) $(LDFLAGS) $(CLIENT_LDFLAGS) | ||
36 | |||
37 | diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c | ||
38 | --- a/pseudo_wrappers.c | ||
39 | +++ b/pseudo_wrappers.c | ||
40 | @@ -100,10 +100,13 @@ static void libpseudo_atfork_child(void) | ||
41 | pseudo_mutex_holder = 0; | ||
42 | } | ||
43 | |||
44 | +extern void *__dso_handle; | ||
45 | +extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *); | ||
46 | + | ||
47 | static void | ||
48 | _libpseudo_init(void) { | ||
49 | if (!_libpseudo_initted) | ||
50 | - pthread_atfork(NULL, NULL, libpseudo_atfork_child); | ||
51 | + __register_atfork (NULL, NULL, libpseudo_atfork_child, &__dso_handle == NULL ? NULL : __dso_handle); | ||
52 | |||
53 | pseudo_getlock(); | ||
54 | pseudo_antimagic(); | ||
55 | -- | ||
56 | 2.27.0 | ||
57 | |||