Fix test_uds link on 64-bit glibc 2.40+
ST
7d ago+222+222+012345678901234567890123456789-3-3-0123456789
Problem
test_uds no longer links on 64-bit glibc 2.40 and later (and 2.39 builds with the stable-branch backport): undefined reference to '__sendmsg64'.
The __sendmsg64 EINTR wrapper in the test fixture was guarded on __USE_TIME_BITS64, which glibc now also defines on 64-bit targets, where libc has no __sendmsg64.
Since the Linux CI runners moved to Ubuntu 26.04, this fails the Runtime Safety, CodeQL (C/C++ POSIX) and Codacy Coverage jobs on main; the same failure blocks #19.
Change
- The wrapper is guarded on
defined(__GLIBC__) && defined(__USE_TIME_BITS64) && __TIMESIZE == 32, the condition glibc itself uses to redirectsendmsgto__sendmsg64; it also works with headers older than glibc's__USE_TIME64_REDIRECTSmacro. - Test fixture only; no library code changes. SOW-0074 records the analysis.
Compatibility
- 64-bit glibc builds no longer compile the wrapper; they never reference
__sendmsg64. - 32-bit builds with legacy 32-bit
time_talready omitted it and are unchanged. - glibc ABIs with a default 32-bit
time_tbuilt with_TIME_BITS=64still compile it and still intercept the redirected call.
Testing
- x86_64 glibc 2.41:
test_udsfailed to link before; it links and passes after, and CTest passes 32/32. - i386 glibc with
_FILE_OFFSET_BITS=64 _TIME_BITS=64: the library references__sendmsg64, the wrapper intercepts it, the EINTR injection checks pass, and CTest passes 14/14. - i386 glibc with legacy
time_t: CTest passes 14/14. - armv7-gnu-time64 and aarch64-gnu are covered by the PR's Linux target CI jobs.
Summary by cubic
Fixes the test_uds link failure on 64-bit glibc 2.40+, where the __sendmsg64 EINTR wrapper was built even though libc exports no such symbol.
- The wrapper was guarded on
__USE_TIME_BITS64, which glibc 2.40+ also sets on 64-bit targets; the guard now matches glibc's own redirect condition (__TIMESIZE == 32). - Test fixture only, no library changes; 32-bit
_TIME_BITS=64builds still intercept the redirected call. - Adds the SOW-0074 record documenting the analysis and validation.
Summary by CodeRabbit
- Bug Fixes
- Fixed a test link failure on newer glibc versions while preserving the expected behavior for 32-bit time64 and legacy builds.
- Documentation
- Added notes on the issue, expected behavior, and validation across supported configurations.