From 2d58f28e9094f80e430457a6cf8999538f801367 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Fri, 17 Jun 2022 17:06:35 -0500 Subject: [PATCH] HASTIMERS is a bug workaround for glibc, just test for glibc instead of probing. --- lib/portability.c | 2 +- lib/portability.h | 3 ++- scripts/genconfig.sh | 6 ------ 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/portability.c b/lib/portability.c index e60e525e..8ea105c1 100644 --- a/lib/portability.c +++ b/lib/portability.c @@ -692,7 +692,7 @@ int timer_settime(timer_t t, int flags, struct itimerspec *new, void *old) // glibc requires -lrt for linux syscalls, which pulls in libgcc_eh.a for // static linking, and gcc 9.3 leaks pthread calls from that breaking the build // These are both just linux syscalls: wrap them ourselves -#elif !CFG_TOYBOX_HASTIMERS +#elif defined(__GLIBC__) int timer_create_wrap(clockid_t c, struct sigevent *se, timer_t *t) { // convert overengineered structure to what kernel actually uses diff --git a/lib/portability.h b/lib/portability.h index 2bd1c124..a0e64ac4 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -397,7 +397,8 @@ struct itimerspec { }; int timer_create(clock_t c, struct sigevent *se, timer_t *t); int timer_settime(timer_t t, int flags, struct itimerspec *new, void *old); -#elif !CFG_TOYBOX_HASTIMERS +#elif defined(__GLIBC__) +// Work around a glibc bug that interacts badly with a gcc bug. #include #include #include diff --git a/scripts/genconfig.sh b/scripts/genconfig.sh index 5e1208ea..2c1a242b 100755 --- a/scripts/genconfig.sh +++ b/scripts/genconfig.sh @@ -62,12 +62,6 @@ EOF #include int main(void) { char buf[100]; getrandom(buf, 100, 0); } EOF - - probesymbol TOYBOX_HASTIMERS << EOF - #include - #include - int main(void) {void *x=0;timer_create(CLOCK_MONOTONIC,x,x);} -EOF } genconfig() -- 2.39.2