Message ID | C4992368-E7DB-425A-B7A0-CAE46376BB89@adacore.com |
---|---|
State | New |
Headers | show |
Series | Let libstdc++ know that VxWorks has_nanosleep | expand |
On 13/12/19 18:54 +0100, Olivier Hainque wrote: > >This change adjusts the libstdc++ configuration for VxWorks >to set ac_has_nanosleep=yes, which enables the use of nanosleep >from the library. > >While this technically depends on the kernel configuration >(INCLUDE_POSIX_TIMERS) this is the normal configuration in all >the environments we have been given to work with for the past >decade and activating this improves the library in our experience. Is there a way to detect that more reliably? Should we replicate the test used later in the file, to detect whether the timers are really enabled for VxWorks? AC_MSG_CHECKING([for nanosleep]) AC_TRY_LINK( [#include <unistd.h> #include <time.h> ], [#if _POSIX_TIMERS > 0 timespec tp; #endif nanosleep(&tp, 0); ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no]) AC_MSG_RESULT($ac_has_nanosleep) You're the port maintainer though, so if you think that's not needed then the patch is OK for trunk.
Hi Jonathan, > On 19 Dec 2019, at 12:13, Jonathan Wakely <jwakely@redhat.com> wrote: > > > Is there a way to detect that more reliably? Should we replicate the > test used later in the file, to detect whether the timers are really > enabled for VxWorks? > > AC_MSG_CHECKING([for nanosleep]) ... > You're the port maintainer though, so if you think that's not needed > then the patch is OK for trunk. Thanks for your feedback Jonathan, Unfortunately, the AC kind of check is actually less reliable on VxWorks, in particular for the so called "kernel" mode where linking a "module" actually performs only a partial link to be downloaded on a target where the run-time loader takes care of the rest. The current assumption on the environment configuration is on a component included by default and required for a number of very common time related operations anyway, so always there in practice in our experience. The rare/unlikely users that would not have the library configured in on the VxWorks end would just not access to the c++ time related facilities, which is not a problem. Overall, this really seems like a good setting for --enable-libstdcxx-time auto. Olivier
On 22/12/19 23:20 +0100, Olivier Hainque wrote: >Hi Jonathan, > >> On 19 Dec 2019, at 12:13, Jonathan Wakely <jwakely@redhat.com> wrote: >> >> >> Is there a way to detect that more reliably? Should we replicate the >> test used later in the file, to detect whether the timers are really >> enabled for VxWorks? >> >> AC_MSG_CHECKING([for nanosleep]) >... >> You're the port maintainer though, so if you think that's not needed >> then the patch is OK for trunk. > >Thanks for your feedback Jonathan, > >Unfortunately, the AC kind of check is actually less reliable >on VxWorks, in particular for the so called "kernel" mode where >linking a "module" actually performs only a partial link to be >downloaded on a target where the run-time loader takes care of >the rest. > >The current assumption on the environment configuration is on >a component included by default and required for a number >of very common time related operations anyway, so always there >in practice in our experience. > >The rare/unlikely users that would not have the library >configured in on the VxWorks end would just not access to the >c++ time related facilities, which is not a problem. > >Overall, this really seems like a good setting for >--enable-libstdcxx-time auto. OK, that makes sense. Thanks!
> On 6 Jan 2020, at 16:21, Jonathan Wakely <jwakely@redhat.com> wrote: >> >> Overall, this really seems like a good setting for >> --enable-libstdcxx-time auto. > > OK, that makes sense. Thanks! Sure, thank you for your feedback :)
--- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1408,6 +1408,11 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [ ac_has_nanosleep=yes ac_has_sched_yield=yes ;; + # VxWorks has nanosleep as soon as the kernel is configured with + # INCLUDE_POSIX_TIMERS, which is normally/most-often the case. + vxworks*) + ac_has_nanosleep=yes + ;; gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) AC_MSG_CHECKING([for at least GNU libc 2.17]) AC_TRY_COMPILE( diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index fa86ca1e731..717f5c1d21d 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -20871,6 +20871,11 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu ac_has_nanosleep=yes ac_has_sched_yield=yes ;; + # VxWorks has nanosleep as soon as the kernel is configured with + # INCLUDE_POSIX_TIMERS, which is normally/most-often the case. + vxworks*) + ac_has_nanosleep=yes + ;; gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for at least GNU libc 2.17" >&5 $as_echo_n "checking for at least GNU libc 2.17... " >&6; }