This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
[PATCH] '__fcntl_nocancel' can never be inlined because it uses variable argument lists
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Ulrich Drepper <drepper at redhat dot com>, Greg Schafer <gschafer at zip dot com dot au>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Thu, 15 Jul 2004 13:08:41 +0200
- Subject: [PATCH] '__fcntl_nocancel' can never be inlined because it uses variable argument lists
- References: <20040715124239.GA21236@tigers-lfs.nsw.bigpond.net.au>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jul 15, 2004 at 10:42:39PM +1000, Greg Schafer wrote:
> This error occurs when compiling current cvs with gcc-3.4.1 when NOT passing
> an '--enable-kernel=XXX' option to configure:
>
>
> ../sysdeps/unix/sysv/linux/i386/fcntl.c: In function `__fcntl_nocancel':
> ../sysdeps/unix/sysv/linux/i386/fcntl.c:39: sorry, unimplemented: function '__fcntl_nocancel' can never be inlined because it uses variable argument lists
>
>
> The error has already been reported here:
>
> http://sources.redhat.com/ml/libc-alpha/2004-07/msg00016.html
>
> The build error goes away when passing '--enable-kernel=2.4.1' (or greater..
> at least on i386) to configure. It appears related to the define of
> __ASSUME_FCNTL64
>
> I'm not sure what the correct fix is.
Here is an untested patch.
For the arches where __fcntl_nocancel is trivial INLINE_SYSCALL and nothing
else, this patch expands it directly in __libc_fcntl and removes
__fcntl_nocancel altogether for NO_CANCELLATION.
For i386 and similar arches where __fcntl_nocancel is bigger, if
NO_CANCELLATION it changes current __fcntl_nocancel to be the actual
__libc_fcntl instead of the wrapper. So the only case where there are two
nested vararg functions is if fcntl64 can't be assumed and NO_CANCELLATION
is not defined.
2004-07-15 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/fcntl.c (__fcntl_nocancel): Remove
static inline __attribute ((always_inline)). Don't define if
NO_CANCELLATION.
(__libc_fcntl): Use INLINE_SYSCALL directly instead of
__fcntl_nocancel.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c (__fcntl_nocancel):
Remove static inline __attribute ((always_inline)). Don't define
if NO_CANCELLATION.
(__libc_fcntl): Use INLINE_SYSCALL directly instead of
__fcntl_nocancel.
* sysdeps/unix/sysv/linux/i386/fcntl.c (__fcntl_nocancel): Define to
__libc_fcntl if NO_CANCELLATION and __ASSUME_FCNTL64 == 0.
Don't define at all if NO_CANCELLATION and __ASSUME_FCNTL64 > 0.
(__libc_fcntl): Don't define if __fcntl_nocancel is a macro.
--- libc/sysdeps/unix/sysv/linux/fcntl.c.jj 2004-07-12 17:50:25.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/fcntl.c 2004-07-15 15:07:39.994934483 +0200
@@ -25,9 +25,7 @@
#include <sys/syscall.h>
-#ifdef NO_CANCELLATION
-static inline __attribute ((always_inline))
-#endif
+#ifndef NO_CANCELLATION
int
__fcntl_nocancel (int fd, int cmd, ...)
{
@@ -40,6 +38,7 @@ __fcntl_nocancel (int fd, int cmd, ...)
return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
}
+#endif
int
@@ -53,11 +52,11 @@ __libc_fcntl (int fd, int cmd, ...)
va_end (ap);
if (SINGLE_THREAD_P || cmd != F_SETLKW)
- return __fcntl_nocancel (fd, cmd, arg);
+ return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
int oldtype = LIBC_CANCEL_ASYNC ();
- int result = __fcntl_nocancel (fd, cmd, arg);
+ int result = INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
LIBC_CANCEL_RESET (oldtype);
--- libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c.jj 2004-07-09 19:19:43.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c 2004-07-15 15:08:36.642906580 +0200
@@ -25,9 +25,7 @@
#include <sys/syscall.h>
-#ifdef NO_CANCELLATION
-static inline __attribute ((always_inline))
-#endif
+#ifndef NO_CANCELLATION
int
__fcntl_nocancel (int fd, int cmd, ...)
{
@@ -40,6 +38,7 @@ __fcntl_nocancel (int fd, int cmd, ...)
return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
}
+#endif
int
@@ -56,11 +55,11 @@ __libc_fcntl (int fd, int cmd, ...)
cmd -= F_GETLK64 - F_GETLK;
if (SINGLE_THREAD_P || cmd != F_SETLKW)
- return __fcntl_nocancel (fd, cmd, arg);
+ return INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
int oldtype = LIBC_CANCEL_ASYNC ();
- int result = __fcntl_nocancel (fd, cmd, arg);
+ int result = INLINE_SYSCALL (fcntl, 3, fd, cmd, arg);
LIBC_CANCEL_RESET (oldtype);
--- libc/sysdeps/unix/sysv/linux/i386/fcntl.c.jj 2004-07-12 17:50:25.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/i386/fcntl.c 2004-07-15 15:12:46.665636726 +0200
@@ -30,10 +30,11 @@
int __have_no_fcntl64;
#endif
-
-#ifdef NO_CANCELLATION
-static inline __attribute ((always_inline))
+#if defined NO_CANCELLATION && __ASSUME_FCNTL64 == 0
+# define __fcntl_nocancel __libc_fcntl
#endif
+
+#if !defined NO_CANCELLATION || __ASSUME_FCNTL64 == 0
int
__fcntl_nocancel (int fd, int cmd, ...)
{
@@ -126,8 +127,10 @@ __fcntl_nocancel (int fd, int cmd, ...)
return INLINE_SYSCALL (fcntl64, 3, fd, cmd, arg);
#endif /* !__ASSUME_FCNTL64 */
}
+#endif /* NO_CANCELLATION || !__ASSUME_FCNTL64 */
+#ifndef __fcntl_nocancel
int
__libc_fcntl (int fd, int cmd, ...)
{
@@ -158,6 +161,7 @@ __libc_fcntl (int fd, int cmd, ...)
return result;
}
+#endif
libc_hidden_def (__libc_fcntl)
weak_alias (__libc_fcntl, __fcntl)
Jakub