Age | Commit message (Collapse) | Author |
|
For instance with buildroot config sipeed_maix_bit_defconfig the pre-processor generates
if (1)
r = ({ long _sys_result; { register long int _a7 __asm__ ("a7"); register long _a3 __asm__ ("a3"); long _a3tmp; register long _a2 __asm__ ("a2"); long _a2tmp; register long _a1 __asm__ ("a1"); long _a1tmp; long _a0tmp; register long _a0 __asm__ ("a0"); _a0tmp = (long) (clock_id); _a0 = _a0tmp; _a1tmp = (long) (flags); _a1 = _a1tmp; _a2tmp = (long) (req); _a2 = _a2tmp; _a3tmp = (long) (rem); _a3 = _a3tmp; _a7 = (115); __asm__ volatile ( "scall\n\t" : "=r" (_a0) : "r"(_a7) , "r" (_a0), "r" (_a1), "r" (_a2), "r" (_a3) : "memory"); _sys_result = _a0; } _sys_result; });
else
{
int oldstate = LIBC_CANCEL_ASYNC ();
r = ({ long _sys_result; { register long int _a7 __asm__ ("a7"); register long _a3 __asm__ ("a3"); long _a3tmp; register long _a2 __asm__ ("a2"); long _a2tmp; register long _a1 __asm__ ("a1"); long _a1tmp; long _a0tmp; register long _a0 __asm__ ("a0"); _a0tmp = (long) (clock_id); _a0 = _a0tmp; _a1tmp = (long) (flags); _a1 = _a1tmp; _a2tmp = (long) (req); _a2 = _a2tmp; _a3tmp = (long) (rem); _a3 = _a3tmp; _a7 = (115); __asm__ volatile ( "scall\n\t" : "=r" (_a0) : "r"(_a7) , "r" (_a0), "r" (_a1), "r" (_a2), "r" (_a3) : "memory"); _sys_result = _a0; } _sys_result; })
;
LIBC_CANCEL_RESET (oldstate);
}
And also the compiler issues these warnings:
librt/clock_nanosleep.c: In function 'clock_nanosleep':
librt/clock_nanosleep.c:43:22: warning: implicit declaration of function
'LIBC_CANCEL_ASYNC'; did you mean 'LIBC_CANCEL_HANDLED'?
[-Wimplicit-function-declaration]
43 | int oldstate = LIBC_CANCEL_ASYNC ();
| ^~~~~~~~~~~~~~~~~
| LIBC_CANCEL_HANDLED
librt/clock_nanosleep.c:48:7: warning: implicit declaration of function
'LIBC_CANCEL_RESET'; did you mean 'LIBC_CANCEL_HANDLED'?
[-Wimplicit-function-declaration]
48 | LIBC_CANCEL_RESET (oldstate);
| ^~~~~~~~~~~~~~~~~
| LIBC_CANCEL_HANDLED
So if the compiler is a bit picky and does not optimize the if (1) {} else {} it can fail to link with undefined symbols.
This patch fixes this issue: no more warning.
Btw, that's the solution that is already used in the following cancellation point files:
* libc/sysdeps/linux/common/__syscall_fcntl.c
* libc/sysdeps/linux/common/__syscall_fcntl64.c
* libc/sysdeps/linux/common/ioctl.c
* libc/sysdeps/linux/common/openat.c
* libc/sysdeps/linux/common/open.c
Signed-off-by: Yann Sionneau <yann@sionneau.net>
|
|
This reverts commit 08d46f1ce21e4ec51b2b1626beeaea6cbe7fdc6b.
Signed-off-by: Yann Sionneau <yann@sionneau.net>
|
|
For NOMMU builds, LIBC_CANCEL_ASYNC and LIBC_CANCEL_RESET are not
defined. Prevent these macros from being visible by the compiler in
clock_nanosleep() by replacing "if (SINGLE_THREAD_P) {" with the
pre-compiler directive "#if defined(SINGLE_THREAD_P)".
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
|
|
It seems there is no real dependency to NPTL for these clock_*
functions when UCLIBC_ADVANCED_REALTIME is enabled.
No regressions found.
Reported-by: Baruch Siach <baruch@tkos.co.il>
|
|
This matches a similar change made to glibc.
No functional changes here.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
|
|
* clock_getcpuclockid, clock_gettime, clock_nanosleep, mq_receive,
mq_send, mq_timedreceive, mq_timedsend, _SC_MONOTONIC_CLOCK
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
|