From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 729823858404; Tue, 4 Oct 2022 12:56:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 729823858404 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1664888168; bh=OPy8IGVIlfcTPd41kcoMolrTd0H3FncjP2fBHBF7+ps=; h=From:To:Subject:Date:From; b=YEeqsn2uqb0AcM7B2xsfLqEa40DHovJ3b02pZGvIBSrOqb+8quDb6LSv0h2+qNauE t/I2kL5iL9ydC4ZUpDH8Lp46rYV2wxOdqPkwY21zOwOjPbxI/+0JKZcrUXolOABu5O Pyd3uCxOky50JFVet/WK/WKjlgyoMpD8inpHXvew= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] Rework not-cancel function prototypes X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 3b51d372c5604779a656f9ea747cb94b01cae5ba X-Git-Newrev: 3f7cb7b03a88be4479e3fcebaee0a51468586be8 Message-Id: <20221004125608.729823858404@sourceware.org> Date: Tue, 4 Oct 2022 12:56:08 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=3f7cb7b03a88be4479e3fcebaee0a51468586be8 commit 3f7cb7b03a88be4479e3fcebaee0a51468586be8 Author: Adhemerval Zanella Date: Tue Mar 8 16:41:14 2022 -0300 Rework not-cancel function prototypes By adding a new hidden_proto2 macro. Diff: --- include/libc-symbols.h | 9 ++++++ sysdeps/unix/sysv/linux/not-cancel.h | 54 ++++++++++++++++-------------------- 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index f4437ff6ad..0715d87c7d 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -520,6 +520,8 @@ for linking") __hidden_proto (name, , __GI_##name, ##attrs) # define hidden_proto_alias(name, alias, attrs...) \ __hidden_proto_alias (name, , alias, ##attrs) +# define hidden_proto2(type, name, attrs...) \ + __hidden_proto2 (type, name, , __GI_##name, ##attrs) # define hidden_tls_proto(name, attrs...) \ __hidden_proto (name, __thread, __GI_##name, ##attrs) # define __hidden_proto(name, thread, internal, attrs...) \ @@ -527,6 +529,9 @@ for linking") __hidden_proto_hiddenattr (attrs); # define __hidden_proto_alias(name, thread, internal, attrs...) \ extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs); +# define __hidden_proto2(type, name, thread, internal, attrs...) \ + extern thread __typeof (type) name __asm__ (__hidden_asmname (#internal)) \ + __hidden_proto_hiddenattr (attrs); # define __hidden_asmname(name) \ __hidden_asmname1 (__USER_LABEL_PREFIX__, name) # define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name) @@ -602,6 +607,10 @@ for linking") # define hidden_proto_alias(name, alias, attrs...) # define hidden_tls_proto(name, attrs...) # endif +# define __hidden_proto2(type, name, thread, attrs...) \ + extern thread __typeof (type) name __attribute__ ((visibility ("hidden"), ##attrs)); +# define hidden_proto2(type, name, attrs...) \ + __hidden_proto2(type, name, , attrs) # else # define HIDDEN_JUMPTARGET(name) JUMPTARGET(name) # endif /* Not __ASSEMBLER__ */ diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 93615de681..f2d3594269 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -28,29 +28,35 @@ #include #include -/* Non cancellable open syscall. */ -__typeof (open) __open_nocancel; - -/* Non cancellable open syscall (LFS version). */ -__typeof (open64) __open64_nocancel; - -/* Non cancellable openat syscall. */ -__typeof (openat) __openat_nocancel; - +#if IS_IN (libc) || IS_IN (rtld) +/* Non cacellable open syscall (LFS version). */ +hidden_proto2 (open, __open_nocancel) +/* Non cacellable open syscall (LFS version). */ +hidden_proto2 (open64, __open64_nocancel) /* Non cacellable openat syscall (LFS version). */ -__typeof (openat64) __openat64_nocancel; - +hidden_proto2 (openat, __openat_nocancel) +/* Non cacellable openat syscall (LFS version). */ +hidden_proto2 (openat64, __openat64_nocancel) /* Non cancellable read syscall. */ -__typeof (__read) __read_nocancel; - +hidden_proto2 (read, __read_nocancel) /* Non cancellable pread syscall (LFS version). */ -__typeof (__pread64) __pread64_nocancel; - +hidden_proto2 (pread64, __pread64_nocancel) /* Uncancelable write. */ -__typeof (__write) __write_nocancel; - +hidden_proto2 (write, __write_nocancel) /* Uncancelable close. */ -__typeof (__close) __close_nocancel; +hidden_proto2 (close, __close_nocancel) +/* Uncancelable fcntl. */ +hidden_proto2 (fcntl64, __fcntl64_nocancel) +#else +__typeof (open) __open_nocancel; +__typeof (open64) __open64_nocancel; +__typeof (openat) __openat_nocancel; +__typeof (openat64) __openat64_nocancel; +__typeof (read) __read_nocancel; +__typeof (pread64) __pread64_nocancel; +__typeof (write) __write_nocancel; +__typeof (close) __close_nocancel; +#endif /* Non cancellable close syscall that does not also set errno in case of failure. */ @@ -83,16 +89,4 @@ __poll_infinity_nocancel (struct pollfd *fds, nfds_t nfds) /* Uncancelable fcntl. */ __typeof (__fcntl) __fcntl64_nocancel; -#if IS_IN (libc) || IS_IN (rtld) -hidden_proto (__open_nocancel) -hidden_proto (__open64_nocancel) -hidden_proto (__openat_nocancel) -hidden_proto (__openat64_nocancel) -hidden_proto (__read_nocancel) -hidden_proto (__pread64_nocancel) -hidden_proto (__write_nocancel) -hidden_proto (__close_nocancel) -hidden_proto (__fcntl64_nocancel) -#endif - #endif /* NOT_CANCEL_H */