From ed97ef7a4ba990132e5eadcf95cb31ef602f3603 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 2 Jan 2025 07:22:36 +0800 Subject: [PATCH] not-cancel.h: Support testing fortify build with Clang When Clang is used to test fortify glibc build configured with --enable-fortify-source=N clang issues errors like In file included from tst-rfc3484.c:60: In file included from ./getaddrinfo.c:81: ../sysdeps/unix/sysv/linux/not-cancel.h:36:10: error: reference to overloaded function could not be resolved; did you mean to call it? 36 | __typeof (open64) __open64_nocancel; | ^~~~~~~~ ../include/bits/../../io/bits/fcntl2.h:127:1: note: possible target for call 127 | open64 (__fortify_clang_overload_arg (const char *, ,__path), int __oflag, | ^ ../include/bits/../../io/bits/fcntl2.h:118:1: note: possible target for call 118 | open64 (__fortify_clang_overload_arg (const char *, ,__path), int __oflag) | ^ ../include/bits/../../io/bits/fcntl2.h:114:1: note: possible target for call 114 | open64 (const char *__path, int __oflag, mode_t __mode, ...) | ^ ../io/fcntl.h:219:12: note: possible target for call 219 | extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1)); | ^ because clang fortify support for functions with variable arguments relies on function overload. Update not-cancel.h to avoid __typeof on functions with variable arguments. Co-Authored-By: Adhemerval Zanella Signed-off-by: H.J. Lu Reviewed-by: Sam James --- sysdeps/unix/sysv/linux/not-cancel.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 62363c1b0f..ece329711b 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -30,16 +30,16 @@ #include /* Non cancellable open syscall. */ -__typeof (open) __open_nocancel; +extern int __open_nocancel (const char *, int, ...); /* Non cancellable open syscall (LFS version). */ -__typeof (open64) __open64_nocancel; +extern int __open64_nocancel (const char *, int, ...); /* Non cancellable openat syscall. */ -__typeof (openat) __openat_nocancel; +extern int __openat_nocancel (int fd, const char *, int, ...); /* Non cacellable openat syscall (LFS version). */ -__typeof (openat64) __openat64_nocancel; +extern int __openat64_nocancel (int fd, const char *, int, ...); /* Non cancellable read syscall. */ __typeof (__read) __read_nocancel; @@ -54,7 +54,7 @@ __typeof (__write) __write_nocancel; __typeof (__close) __close_nocancel; /* Uncancelable fcntl. */ -__typeof (__fcntl) __fcntl64_nocancel; +int __fcntl64_nocancel (int, int, ...); #if IS_IN (libc) || IS_IN (rtld) hidden_proto (__open_nocancel)