public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IA64 build broken... cond_syscall()... Fixes?
@ 2004-11-02  2:39 Peter Chubb
  2004-11-02 22:07 ` Luck, Tony
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Chubb @ 2004-11-02  2:39 UTC (permalink / raw)
  To: Andrew.Morton.akpm, Tony Luck; +Cc: linux-ia64, linux-kernel


Hi Folks,
   The kernel 2.6 IA64 build has been broken for several days (see
http://www.gelato.unsw.edu.au/kerncomp )

The reason is that cond_syscall() for IA64 is defined as:

  #define cond_syscall(x) asmlinkage long x (void) \
	__attribute__((weak,alias("sys_ni_syscall")))   

which of course doesn't work if there's a prototype in scope for x,
unless the type of x just happens to be the same as for sys_ni_syscall.

Changing to the type-safe version
   #define cond_syscall(x) __typeof__ (x) x \
	   __attribute__((weak,alias("sys_ni_syscall")));
gives an error, e.g., 
 error: `compat_sys_futex' defined both normally and as an alias

Most architectures use inline assembly language which avoids the
problem.  However, we don't want to do this for IA64, to allow
compilers other than gcc to be used (in general, gcc generated code
for IA64 is extremely poor).

There are several ways to fix this.  The simple way is to ensure that
there are no prototypes for any system calls included in kernel/sys.c
(the only place where cond_syscall is used).  That's what this patch
does:



=== kernel/sys.c 1.97 vs edited ==--- 1.97/kernel/sys.c	2004-10-28 07:35:17 +10:00
+++ edited/kernel/sys.c	2004-11-02 13:34:33 +11:00
@@ -5,7 +5,6 @@
  */
 
 #include <linux/config.h>
-#include <linux/compat.h>
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/utsname.h>
@@ -25,8 +24,9 @@
 #include <linux/dcookies.h>
 #include <linux/suspend.h>
 
-/* Don't include this - it breaks ia64's cond_syscall() implementation */
+/* Don't include these - they break ia64's cond_syscall() implementation */
 #if 0
+#include <linux/compat.h>
 #include <linux/syscalls.h>
 #endif
 



--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
The technical we do immediately,  the political takes *forever*

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] IA64 build broken... cond_syscall()... Fixes?
       [not found] <200411020239.iA22dsQl026520@mail23.syd.optusnet.com.au>
@ 2004-11-02  3:28 ` Andrew Morton
  2004-11-02  4:01   ` Peter Chubb
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2004-11-02  3:28 UTC (permalink / raw)
  To: Peter Chubb; +Cc: tony.luck, linux-ia64, linux-kernel

Peter Chubb <peterc@gelato.unsw.edu.au> wrote:
>
> 
> Hi Folks,
>    The kernel 2.6 IA64 build has been broken for several days (see
> http://www.gelato.unsw.edu.au/kerncomp )
> 
> The reason is that cond_syscall() for IA64 is defined as:
> 
>   #define cond_syscall(x) asmlinkage long x (void) \
> 	__attribute__((weak,alias("sys_ni_syscall")))   
> 
> which of course doesn't work if there's a prototype in scope for x,
> unless the type of x just happens to be the same as for sys_ni_syscall.
> 
> Changing to the type-safe version
>    #define cond_syscall(x) __typeof__ (x) x \
> 	   __attribute__((weak,alias("sys_ni_syscall")));
> gives an error, e.g., 
>  error: `compat_sys_futex' defined both normally and as an alias

Yeah, it's a real bitch, that.

> Most architectures use inline assembly language which avoids the
> problem.  However, we don't want to do this for IA64, to allow
> compilers other than gcc to be used (in general, gcc generated code
> for IA64 is extremely poor).
> 
> There are several ways to fix this.  The simple way is to ensure that
> there are no prototypes for any system calls included in kernel/sys.c
> (the only place where cond_syscall is used).  That's what this patch
> does:

But I bet it introduces various nasty warnings or type-unsafety on other
architectures.

Shouldn't we just bite the bullet and hoist all that cond_syscall stuff out
into its own .c file?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] IA64 build broken... cond_syscall()... Fixes?
  2004-11-02  3:28 ` [PATCH] IA64 build broken... cond_syscall()... Fixes? Andrew Morton
@ 2004-11-02  4:01   ` Peter Chubb
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Chubb @ 2004-11-02  4:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Peter Chubb, tony.luck, linux-ia64, linux-kernel

>>>>> "Andrew" = Andrew Morton <akpm@osdl.org> writes:

Andrew> Peter Chubb <peterc@gelato.unsw.edu.au> wrote:

>> Most architectures use inline assembly language which avoids the
>> problem.  However, we don't want to do this for IA64, to allow
>> compilers other than gcc to be used (in general, gcc generated code
>> for IA64 is extremely poor).
>> 
>> There are several ways to fix this.  The simple way is to ensure
>> that there are no prototypes for any system calls included in
>> kernel/sys.c (the only place where cond_syscall is used).  That's
>> what this patch does:

Andrew> But I bet it introduces various nasty warnings or
Andrew> type-unsafety on other architectures.

The main issue would be the other system calls defined in sys.c, that
don't have a prototype in scope.  There were no warnings on the
architectures I test compiled on (i386, ARM, IA64).

Andrew> Shouldn't we just bite the bullet and hoist all that
Andrew> cond_syscall stuff out into its own .c file?

OK.  Patch appended.

Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>


diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.6/kernel/Makefile linux-2.5-import/kernel/Makefile
--- linux-2.6/kernel/Makefile	2004-11-02 14:52:36 +11:00
+++ linux-2.5-import/kernel/Makefile	2004-11-02 14:34:46 +11:00
@@ -7,7 +7,7 @@
 	    sysctl.o capability.o ptrace.o timer.o user.o \
 	    signal.o sys.o kmod.o workqueue.o pid.o \
 	    rcupdate.o intermodule.o extable.o params.o posix-timers.o \
-	    kthread.o wait.o kfifo.o
+	    kthread.o wait.o kfifo.o sys_ni.o
 
 obj-$(CONFIG_FUTEX) += futex.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.6/kernel/sys.c linux-2.5-import/kernel/sys.c
--- linux-2.6/kernel/sys.c	2004-11-02 14:52:36 +11:00
+++ linux-2.5-import/kernel/sys.c	2004-11-02 14:34:51 +11:00
@@ -5,7 +5,6 @@
  */
 
 #include <linux/config.h>
-#include <linux/compat.h>
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/utsname.h>
@@ -25,10 +24,8 @@
 #include <linux/dcookies.h>
 #include <linux/suspend.h>
 
-/* Don't include this - it breaks ia64's cond_syscall() implementation */
-#if 0
+#include <linux/compat.h>
 #include <linux/syscalls.h>
-#endif
 
 #include <asm/uaccess.h>
 #include <asm/io.h>
@@ -218,82 +215,6 @@
 }
 
 EXPORT_SYMBOL(unregister_reboot_notifier);
-
-asmlinkage long sys_ni_syscall(void)
-{
-	return -ENOSYS;
-}
-
-cond_syscall(sys_nfsservctl)
-cond_syscall(sys_quotactl)
-cond_syscall(sys_acct)
-cond_syscall(sys_lookup_dcookie)
-cond_syscall(sys_swapon)
-cond_syscall(sys_swapoff)
-cond_syscall(sys_init_module)
-cond_syscall(sys_delete_module)
-cond_syscall(sys_socketpair)
-cond_syscall(sys_bind)
-cond_syscall(sys_listen)
-cond_syscall(sys_accept)
-cond_syscall(sys_connect)
-cond_syscall(sys_getsockname)
-cond_syscall(sys_getpeername)
-cond_syscall(sys_sendto)
-cond_syscall(sys_send)
-cond_syscall(sys_recvfrom)
-cond_syscall(sys_recv)
-cond_syscall(sys_socket)
-cond_syscall(sys_setsockopt)
-cond_syscall(sys_getsockopt)
-cond_syscall(sys_shutdown)
-cond_syscall(sys_sendmsg)
-cond_syscall(sys_recvmsg)
-cond_syscall(sys_socketcall)
-cond_syscall(sys_futex)
-cond_syscall(compat_sys_futex)
-cond_syscall(sys_epoll_create)
-cond_syscall(sys_epoll_ctl)
-cond_syscall(sys_epoll_wait)
-cond_syscall(sys_semget)
-cond_syscall(sys_semop)
-cond_syscall(sys_semtimedop)
-cond_syscall(sys_semctl)
-cond_syscall(sys_msgget)
-cond_syscall(sys_msgsnd)
-cond_syscall(sys_msgrcv)
-cond_syscall(sys_msgctl)
-cond_syscall(sys_shmget)
-cond_syscall(sys_shmdt)
-cond_syscall(sys_shmctl)
-cond_syscall(sys_mq_open)
-cond_syscall(sys_mq_unlink)
-cond_syscall(sys_mq_timedsend)
-cond_syscall(sys_mq_timedreceive)
-cond_syscall(sys_mq_notify)
-cond_syscall(sys_mq_getsetattr)
-cond_syscall(compat_sys_mq_open)
-cond_syscall(compat_sys_mq_timedsend)
-cond_syscall(compat_sys_mq_timedreceive)
-cond_syscall(compat_sys_mq_notify)
-cond_syscall(compat_sys_mq_getsetattr)
-cond_syscall(sys_mbind)
-cond_syscall(sys_get_mempolicy)
-cond_syscall(sys_set_mempolicy)
-cond_syscall(compat_mbind)
-cond_syscall(compat_get_mempolicy)
-cond_syscall(compat_set_mempolicy)
-cond_syscall(sys_add_key)
-cond_syscall(sys_request_key)
-cond_syscall(sys_keyctl)
-cond_syscall(compat_sys_keyctl)
-cond_syscall(compat_sys_socketcall)
-
-/* arch-specific weak syscall entries */
-cond_syscall(sys_pciconfig_read)
-cond_syscall(sys_pciconfig_write)
-cond_syscall(sys_pciconfig_iobase)
-
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {
 	int no_nice;
diff -Nur --exclude=RCS --exclude=CVS --exclude=SCCS --exclude=BitKeeper --exclude=ChangeSet linux-2.6/kernel/sys_ni.c linux-2.5-import/kernel/sys_ni.c
--- linux-2.6/kernel/sys_ni.c	1970-01-01 10:00:00 +10:00
+++ linux-2.5-import/kernel/sys_ni.c	2004-11-02 14:48:55 +11:00
@@ -0,0 +1,81 @@
+#include <asm/unistd.h>
+#include <linux/errno.h>
+
+/*
+ * Non-implemented system calls get redirected here.
+ */
+asmlinkage long sys_ni_syscall(void)
+{
+	return -ENOSYS;
+}
+
+cond_syscall(sys_nfsservctl)
+cond_syscall(sys_quotactl)
+cond_syscall(sys_acct)
+cond_syscall(sys_lookup_dcookie)
+cond_syscall(sys_swapon)
+cond_syscall(sys_swapoff)
+cond_syscall(sys_init_module)
+cond_syscall(sys_delete_module)
+cond_syscall(sys_socketpair)
+cond_syscall(sys_bind)
+cond_syscall(sys_listen)
+cond_syscall(sys_accept)
+cond_syscall(sys_connect)
+cond_syscall(sys_getsockname)
+cond_syscall(sys_getpeername)
+cond_syscall(sys_sendto)
+cond_syscall(sys_send)
+cond_syscall(sys_recvfrom)
+cond_syscall(sys_recv)
+cond_syscall(sys_socket)
+cond_syscall(sys_setsockopt)
+cond_syscall(sys_getsockopt)
+cond_syscall(sys_shutdown)
+cond_syscall(sys_sendmsg)
+cond_syscall(sys_recvmsg)
+cond_syscall(sys_socketcall)
+cond_syscall(sys_futex)
+cond_syscall(compat_sys_futex)
+cond_syscall(sys_epoll_create)
+cond_syscall(sys_epoll_ctl)
+cond_syscall(sys_epoll_wait)
+cond_syscall(sys_semget)
+cond_syscall(sys_semop)
+cond_syscall(sys_semtimedop)
+cond_syscall(sys_semctl)
+cond_syscall(sys_msgget)
+cond_syscall(sys_msgsnd)
+cond_syscall(sys_msgrcv)
+cond_syscall(sys_msgctl)
+cond_syscall(sys_shmget)
+cond_syscall(sys_shmdt)
+cond_syscall(sys_shmctl)
+cond_syscall(sys_mq_open)
+cond_syscall(sys_mq_unlink)
+cond_syscall(sys_mq_timedsend)
+cond_syscall(sys_mq_timedreceive)
+cond_syscall(sys_mq_notify)
+cond_syscall(sys_mq_getsetattr)
+cond_syscall(compat_sys_mq_open)
+cond_syscall(compat_sys_mq_timedsend)
+cond_syscall(compat_sys_mq_timedreceive)
+cond_syscall(compat_sys_mq_notify)
+cond_syscall(compat_sys_mq_getsetattr)
+cond_syscall(sys_mbind)
+cond_syscall(sys_get_mempolicy)
+cond_syscall(sys_set_mempolicy)
+cond_syscall(compat_mbind)
+cond_syscall(compat_get_mempolicy)
+cond_syscall(compat_set_mempolicy)
+cond_syscall(sys_add_key)
+cond_syscall(sys_request_key)
+cond_syscall(sys_keyctl)
+cond_syscall(compat_sys_keyctl)
+cond_syscall(compat_sys_socketcall)
+
+/* arch-specific weak syscall entries */
+cond_syscall(sys_pciconfig_read)
+cond_syscall(sys_pciconfig_write)
+cond_syscall(sys_pciconfig_iobase)
+


-- 
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
The technical we do immediately,  the political takes *forever*

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] IA64 build broken... cond_syscall()... Fixes?
  2004-11-02  2:39 Peter Chubb
@ 2004-11-02 22:07 ` Luck, Tony
  2004-11-02 22:18   ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Luck, Tony @ 2004-11-02 22:07 UTC (permalink / raw)
  To: Peter Chubb, Andrew Morton; +Cc: linux-ia64, linux-kernel


>Andrew> Shouldn't we just bite the bullet and hoist all that
>Andrew> cond_syscall stuff out into its own .c file?
>
>OK.  Patch appended.
>
>Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>
>

Acked-by: Tony Luck

No surprise that Peter's fix works for me since I'm building
ia64 systems too.

-Tony

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] IA64 build broken... cond_syscall()... Fixes?
  2004-11-02 22:07 ` Luck, Tony
@ 2004-11-02 22:18   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2004-11-02 22:18 UTC (permalink / raw)
  To: Luck, Tony; +Cc: peterc, linux-ia64, linux-kernel

"Luck, Tony" <tony.luck@intel.com> wrote:
>
> 
> >Andrew> Shouldn't we just bite the bullet and hoist all that
> >Andrew> cond_syscall stuff out into its own .c file?
> >
> >OK.  Patch appended.
> >
> >Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>
> >
> 
> Acked-by: Tony Luck
> 
> No surprise that Peter's fix works for me since I'm building
> ia64 systems too.

yup.  It needed a fixlet for other platforms.  I'll scoot it along to Linus
today.

--- 25/kernel/sys_ni.c~sys_ni-fix	2004-11-01 23:17:15.324673272 -0800
+++ 25-akpm/kernel/sys_ni.c	2004-11-01 23:17:36.497454520 -0800
@@ -1,6 +1,9 @@
-#include <asm/unistd.h>
+
+#include <linux/linkage.h>
 #include <linux/errno.h>
 
+#include <asm/unistd.h>
+
 /*
  * Non-implemented system calls get redirected here.
  */
_


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-11-02 22:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200411020239.iA22dsQl026520@mail23.syd.optusnet.com.au>
2004-11-02  3:28 ` [PATCH] IA64 build broken... cond_syscall()... Fixes? Andrew Morton
2004-11-02  4:01   ` Peter Chubb
2004-11-02  2:39 Peter Chubb
2004-11-02 22:07 ` Luck, Tony
2004-11-02 22:18   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox