Date: Fri, 17 Jun 2022 19:37:16 GMT From: Dmitry Chagin <dchagin@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 85b2ff649628 - stable/13 - linux(4): Fix gcc buld. Message-ID: <202206171937.25HJbGhO013136@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=85b2ff6496285c6768437884917414b9d64b4f1b commit 85b2ff6496285c6768437884917414b9d64b4f1b Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2021-07-29 06:52:33 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2022-06-17 19:33:14 +0000 linux(4): Fix gcc buld. gcc failed as it didn't inlined the builtins and generates calls to the libgcc, ld can't find libgcc as cross-toolchain libgcc is not installed. To avoid this add internal vDSO ffs functions without optimized builtins. Reported by: jhb MFC after: 2 weeks (cherry picked from commit f33794014468562100f6f02ab8147b58bd9f82c0) --- sys/amd64/linux/linux_vdso_gtod.c | 1 - sys/amd64/linux32/linux32_vdso_gtod.c | 1 - sys/arm64/linux/linux_vdso_gtod.c | 1 - sys/compat/linux/linux_vdso_gtod.inc | 34 ++++++++++++++++++++++++++++++++++ sys/i386/linux/linux_vdso_gtod.c | 1 - 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/sys/amd64/linux/linux_vdso_gtod.c b/sys/amd64/linux/linux_vdso_gtod.c index ad23dc33575a..57d3f4b45dd4 100644 --- a/sys/amd64/linux/linux_vdso_gtod.c +++ b/sys/amd64/linux/linux_vdso_gtod.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include <sys/vdso.h> #undef _KERNEL #include <stdbool.h> -#include <strings.h> #include <machine/atomic.h> #include <machine/stdarg.h> diff --git a/sys/amd64/linux32/linux32_vdso_gtod.c b/sys/amd64/linux32/linux32_vdso_gtod.c index f1573ca3c1b1..0caf787c9503 100644 --- a/sys/amd64/linux32/linux32_vdso_gtod.c +++ b/sys/amd64/linux32/linux32_vdso_gtod.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include <sys/vdso.h> #undef _KERNEL #include <stdbool.h> -#include <strings.h> #include <machine/atomic.h> #include <machine/stdarg.h> diff --git a/sys/arm64/linux/linux_vdso_gtod.c b/sys/arm64/linux/linux_vdso_gtod.c index 682735cf2fa1..6fdff8335f5d 100644 --- a/sys/arm64/linux/linux_vdso_gtod.c +++ b/sys/arm64/linux/linux_vdso_gtod.c @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include <sys/vdso.h> #undef _KERNEL #include <stdbool.h> -#include <strings.h> #include <machine/atomic.h> #include <machine/stdarg.h> diff --git a/sys/compat/linux/linux_vdso_gtod.inc b/sys/compat/linux/linux_vdso_gtod.inc index a90b7dc8efdf..52fab2bbc5d7 100644 --- a/sys/compat/linux/linux_vdso_gtod.inc +++ b/sys/compat/linux/linux_vdso_gtod.inc @@ -26,6 +26,40 @@ * SUCH DAMAGE. */ +static int +fls(int mask) +{ + + if (mask == 0) + return (0); + return ((__builtin_clz(mask) ^ 0x1f) + 1); +} + +#ifdef _LP64 +static int +ffsl(long mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; !(mask & 1); bit++) + mask = (unsigned long)mask >> 1; + return (bit); +} +#else +static int +ffsll(long long mask) +{ + int bit; + + if (mask == 0) + return (0); + for (bit = 1; !(mask & 1); bit++) + mask = (unsigned long long)mask >> 1; + return (bit); +} +#endif static int __vdso_native_to_linux_timespec(struct l_timespec *lts, diff --git a/sys/i386/linux/linux_vdso_gtod.c b/sys/i386/linux/linux_vdso_gtod.c index b1e4a4620ee4..046b864c54f5 100644 --- a/sys/i386/linux/linux_vdso_gtod.c +++ b/sys/i386/linux/linux_vdso_gtod.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include <sys/vdso.h> #undef _KERNEL #include <stdbool.h> -#include <strings.h> #include <machine/atomic.h> #include <machine/stdarg.h>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202206171937.25HJbGhO013136>