Skip to content

Cobalt build fixes for uClibc-ng

Yegor Yefremov xenomai 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v14 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- Dropped the getauxval() fallback for uClibc-ng < 1.0.43 (Jan).
- Checked the series with musl and mentioned it in the commit messages and comments (Jan). No functional changes.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3lib/cobalt: Don't rely on glibc's __OPEN_NEEDS_MODElib/cobalt/rtdm.c+10 -40 replies
2/3lib/cobalt: Select the time64 vDSO call without __TIMESIZElib/cobalt/arch/arm/include/asm/xenomai/time.h lib/cobalt/arch/arm64/include/asm/xenomai/time.h lib/cobalt/arch/x86/include/asm/xenomai/time.h+21 -33 replies
3/3testsuite/smokey/y2038: Define ADJ_SETOFFSET if missingtestsuite/smokey/y2038/syscall-tests.c+5 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] Cobalt build fixes for uClibc-ng

Cobalt has not built with uClibc-ng since v3.1.1. These patches fix the build, plus the clock_gettime() vDSO selection, which picks the 32-bit call for uClibc-ng and musl with 64-bit time_t. They complement Jan's mmap() off_t fix for uClibc-ng >= 1.0.58, now in next.

Tested with Buildroot's test-pkg on next plus the series, building Cobalt with the testsuite, RTCAN, Analogy and the pSOS and VxWorks skins:
- armv5 uClibc-ng 1.0.59 (time64), GCC 15
- armv7 glibc 2.44, GCC 16
- aarch64 glibc 2.24, GCC 6

Without the series, the uClibc-ng build fails on __OPEN_NEEDS_MODE; the ADJ_SETOFFSET error only showed up once that was fixed.

musl (as asked by Jan): I built Cobalt with configure and "make -k" using the Bootlin armv7 and i686 musl 1.2.6 toolchains (GCC 15), without Buildroot:

- Patches 1 and 3 remove the __OPEN_NEEDS_MODE and ADJ_SETOFFSET errors with musl as well.
- musl also defines __USE_TIME_BITS64 (in bits/alltypes.h) but not __TIMESIZE, so patch 2 applies just like for uClibc-ng: the vcall changes from __vdso_clock_gettime to __vdso_clock_gettime64. The time syscalls already pick the *64 variants via __USE_TIME_BITS64. This corrects my v1 cover letter, which claimed musl defines neither.

Cobalt still doesn't build with musl after this series. The remaining errors are the same with and without it:
- <error.h> (GNU error()) is missing, used by lib/cobalt/parse_vdso.c, the utils and the testsuite
- off64_t and open64() are gone since musl 1.2.4 (include/cobalt/ sys/mman.h, lib/cobalt/mmap.c, umm.c, wrappers.c)
- PTHREAD_MUTEX_ROBUST_NP (lib/cobalt/mutex.c, lib/vxworks/semLib.c) and PTHREAD_{RECURSIVE,ERRORCHECK}_MUTEX_INITIALIZER_NP (smokey posix-mutex)
- basename() without <libgen.h> in lib/boilerplate/setup.c
- __STRING in include/copperplate/traceobj.h
- the static pthread_mutexattr_[gs]etprioceiling() fallbacks in include/boilerplate/libc.h clash with musl's declarations

Also, musl redirects clock_gettime() and friends to __clock_gettime64 etc., just like glibc with _TIME_BITS=64. But configure only enables cobalt-glibc-time64.wrappers for glibc >= 2.34, so with symbol wrapping these calls would bypass libcobalt on 32-bit musl.

I can look into these separately if musl support is wanted.

Changes v1 -> v2:
- Dropped the getauxval() fallback for uClibc-ng < 1.0.43 (Jan).
- Checked the series with musl and mentioned it in the commit messages and comments (Jan). No functional changes.

Yegor Yefremov (3):
lib/cobalt: Don't rely on glibc's __OPEN_NEEDS_MODE lib/cobalt: Select the time64 vDSO call without __TIMESIZE testsuite/smokey/y2038: Define ADJ_SETOFFSET if missing

 lib/cobalt/arch/arm/include/asm/xenomai/time.h   |  8 +++++++-
 lib/cobalt/arch/arm64/include/asm/xenomai/time.h |  8 +++++++-
 lib/cobalt/arch/x86/include/asm/xenomai/time.h   |  8 +++++++-
 lib/cobalt/rtdm.c                                | 14 ++++++++++----
 testsuite/smokey/y2038/syscall-tests.c           |  5 +++++
 5 files changed, 36 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1