diff options
| author | Mark Hatle <mark.hatle@xilinx.com> | 2022-02-08 20:36:33 -0800 |
|---|---|---|
| committer | Mark Hatle <mark.hatle@xilinx.com> | 2022-02-12 11:38:23 -0800 |
| commit | 92e66345eed4ccd9be0f7f4447cb3031bc856ea0 (patch) | |
| tree | 70946c79e8f45db620a2a7254e0c787c38a6b926 /meta-microblaze | |
| parent | 2a41a15473fa4d965095422bc9ee7a9a9b9b627b (diff) | |
| download | meta-xilinx-92e66345eed4ccd9be0f7f4447cb3031bc856ea0.tar.gz | |
meta-microblaze: Fix glibc issues related to select/pselect
*) Select syscall is not implemented on microblaze, newselect should be
used instead, but commit 4c3df0eba5e8fe98f0de917ade9b2ebba6951c5f
from glibc removed this behavior. Presumably by accident.
*) When the code path that doesn't use select, but instead uses
pselect32 is used, microblaze provides it's own implementation
but this implementation is only available when ASSUME_PSELECT
is disabled. We need to fallback to the default Linux implementation.
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-microblaze')
4 files changed, 122 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-core/glibc/files/0001-microblaze-Add-missing-implementation-when-__ASSUME_.patch b/meta-microblaze/recipes-core/glibc/files/0001-microblaze-Add-missing-implementation-when-__ASSUME_.patch new file mode 100644 index 00000000..5c0dc42a --- /dev/null +++ b/meta-microblaze/recipes-core/glibc/files/0001-microblaze-Add-missing-implementation-when-__ASSUME_.patch | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | From c75aa9246a8cfc814d99cf5f58229177bd69fc4f Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Thomas Petazzoni <thomas.petazzoni@bootlin.com> | ||
| 3 | Date: Tue, 28 Dec 2021 09:09:49 -0300 | ||
| 4 | Subject: [PATCH] microblaze: Add missing implementation when | ||
| 5 | !__ASSUME_TIME64_SYSCALLS | ||
| 6 | |||
| 7 | In commit a92f4e6299fe0e3cb6f77e79de00817aece501ce ("linux: Add time64 | ||
| 8 | pselect support"), a Microblaze specific implementation of | ||
| 9 | __pselect32() was added to cover the case of kernels < 3.15 which lack | ||
| 10 | the pselect6 system call. | ||
| 11 | |||
| 12 | This new file sysdeps/unix/sysv/linux/microblaze/pselect32.c takes | ||
| 13 | precedence over the default implementation | ||
| 14 | sysdeps/unix/sysv/linux/pselect32.c. | ||
| 15 | |||
| 16 | However sysdeps/unix/sysv/linux/pselect32.c provides an implementation | ||
| 17 | of __pselect32() which is needed when __ASSUME_TIME64_SYSCALLS is not | ||
| 18 | defined. On Microblaze, which is a 32-bit architecture, | ||
| 19 | __ASSUME_TIME64_SYSCALLS is only true for kernels >= 5.1. | ||
| 20 | |||
| 21 | Due to sysdeps/unix/sysv/linux/microblaze/pselect32.c taking | ||
| 22 | precedence over sysdeps/unix/sysv/linux/pselect32.c, it means that | ||
| 23 | when we are with a kernel >= 3.15 but < 5.1, we need a __pselect32() | ||
| 24 | implementation, but sysdeps/unix/sysv/linux/microblaze/pselect32.c | ||
| 25 | doesn't provide it, and sysdeps/unix/sysv/linux/pselect32.c which | ||
| 26 | would provide it is not compiled in. | ||
| 27 | |||
| 28 | This causes the following build failure on Microblaze with for example | ||
| 29 | Linux kernel headers 4.9: | ||
| 30 | |||
| 31 | [...]/build/libc_pic.os: in function `__pselect64': | ||
| 32 | (.text+0x120b44): undefined reference to `__pselect32' | ||
| 33 | collect2: error: ld returned 1 exit status | ||
| 34 | |||
| 35 | Upstream-Status: Backport [https://sourceware.org/git/?p=glibc.git;a=commit;h=c75aa9246a8cfc814d99cf5f58229177bd69fc4f] | ||
| 36 | |||
| 37 | Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> | ||
| 38 | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> | ||
| 39 | Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> | ||
| 40 | --- | ||
| 41 | sysdeps/unix/sysv/linux/microblaze/pselect32.c | 4 +++- | ||
| 42 | 1 file changed, 3 insertions(+), 1 deletion(-) | ||
| 43 | |||
| 44 | diff --git a/sysdeps/unix/sysv/linux/microblaze/pselect32.c b/sysdeps/unix/sysv/linux/microblaze/pselect32.c | ||
| 45 | index 70b7b52a48..dd9d56ba29 100644 | ||
| 46 | --- a/sysdeps/unix/sysv/linux/microblaze/pselect32.c | ||
| 47 | +++ b/sysdeps/unix/sysv/linux/microblaze/pselect32.c | ||
| 48 | @@ -22,7 +22,9 @@ | ||
| 49 | #include <sys/poll.h> | ||
| 50 | #include <sysdep-cancel.h> | ||
| 51 | |||
| 52 | -#ifndef __ASSUME_PSELECT | ||
| 53 | +#ifndef __ASSUME_TIME64_SYSCALL | ||
| 54 | +#include <sysdeps/unix/sysv/linux/pselect32.c> | ||
| 55 | +#elif !defined __ASSUME_PSELECT | ||
| 56 | int | ||
| 57 | __pselect32 (int nfds, fd_set *readfds, fd_set *writefds, | ||
| 58 | fd_set *exceptfds, const struct __timespec64 *timeout, | ||
| 59 | -- | ||
| 60 | 2.17.1 | ||
| 61 | |||
diff --git a/meta-microblaze/recipes-core/glibc/files/select-use-newselect-syscall.patch b/meta-microblaze/recipes-core/glibc/files/select-use-newselect-syscall.patch new file mode 100644 index 00000000..04231f0a --- /dev/null +++ b/meta-microblaze/recipes-core/glibc/files/select-use-newselect-syscall.patch | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | Restore newselect syscall override of select syscall | ||
| 2 | |||
| 3 | Commit 4c3df0eba5e8fe98f0de917ade9b2ebba6951c5f removed the check and override | ||
| 4 | of select syscall with newselect if newselect was defined. | ||
| 5 | |||
| 6 | This code path, using select instead of pselect is only executed when | ||
| 7 | ASSUME_PSELECT is not enabled. This happens on microblaze when the | ||
| 8 | kernel version is set below 3.15. | ||
| 9 | |||
| 10 | On Microblaze select is not implemented, only newselect is. So this automatic | ||
| 11 | conversion from select to newselect syscall is expected. The original | ||
| 12 | implementation of the select to newselect syscall was part of: | ||
| 13 | |||
| 14 | commit 26f28fd73d20df8847d93f88b6e2a7bd3bd9bf51 | ||
| 15 | Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> | ||
| 16 | Date: Fri Nov 18 14:27:03 2016 -0200 | ||
| 17 | |||
| 18 | Consolidate Linux select implementation | ||
| 19 | |||
| 20 | This patch consolidates the select Linux syscall implementation on | ||
| 21 | sysdeps/unix/sysv/linux/select.c. The changes are: | ||
| 22 | |||
| 23 | 1. Remove select from auto-generation syscalls.list on the architecture | ||
| 24 | that uses __NR_select. | ||
| 25 | 2. Remove generic implementation add a default one that handle all | ||
| 26 | current cases (with the expection of alpha) | ||
| 27 | The new default implementation will either use __NR_select if | ||
| 28 | available of fallback to __NR_pselect6 otherwise. | ||
| 29 | 3. Add a alpha outlier implementation which requires old compatibility | ||
| 30 | symbols. | ||
| 31 | |||
| 32 | Upstream-Status: Submitted [https://sourceware.org/bugzilla/show_bug.cgi?id=28883] | ||
| 33 | |||
| 34 | Signed-off-by: Mark Hatle <mark.hatle@xilinx.com> | ||
| 35 | |||
| 36 | diff --git a/sysdeps/unix/sysv/linux/select.c b/sysdeps/unix/sysv/linux/select.c | ||
| 37 | index da25b4b4cfe..0f4c67aa29e 100644 | ||
| 38 | --- a/sysdeps/unix/sysv/linux/select.c | ||
| 39 | +++ b/sysdeps/unix/sysv/linux/select.c | ||
| 40 | @@ -101,6 +116,10 @@ __select64 (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, | ||
| 41 | TIMESPEC_TO_TIMEVAL (timeout, pts32); | ||
| 42 | return r; | ||
| 43 | # else | ||
| 44 | +# ifdef __NR__newselect | ||
| 45 | +# undef __NR_select | ||
| 46 | +# define __NR_select __NR__newselect | ||
| 47 | +# endif | ||
| 48 | struct timeval tv32, *ptv32 = NULL; | ||
| 49 | if (pts64 != NULL) | ||
| 50 | { | ||
diff --git a/meta-microblaze/recipes-core/glibc/glibc_2.34.bbappend b/meta-microblaze/recipes-core/glibc/glibc_2.34.bbappend new file mode 100644 index 00000000..ab93a9b5 --- /dev/null +++ b/meta-microblaze/recipes-core/glibc/glibc_2.34.bbappend | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | MB_INC_FILE = "" | ||
| 2 | MB_INC_FILE:microblaze = "microblaze-glibc.inc" | ||
| 3 | |||
| 4 | require ${MB_INC_FILE} | ||
diff --git a/meta-microblaze/recipes-core/glibc/microblaze-glibc.inc b/meta-microblaze/recipes-core/glibc/microblaze-glibc.inc new file mode 100644 index 00000000..f7820f24 --- /dev/null +++ b/meta-microblaze/recipes-core/glibc/microblaze-glibc.inc | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # Workaround for microblaze being unable to boot | ||
| 2 | FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/files" | ||
| 3 | |||
| 4 | SRC_URI:append:microblaze = " \ | ||
| 5 | file://select-use-newselect-syscall.patch \ | ||
| 6 | file://0001-microblaze-Add-missing-implementation-when-__ASSUME_.patch \ | ||
| 7 | " | ||
