All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spufs: change ppc_rtas declaration to weak
@ 2006-10-05 18:35 Geoff Levand
  2006-10-06 11:53 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Geoff Levand @ 2006-10-05 18:35 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Arnd Bergmann

The symbol ppc_rtas is defined as weak, but the declaration is missing the
weak attribute specifier.  The improper declaration causes problems when
linking the ppc_rtas reference in spu_syscall_table[] (spu_callbacks.c)
when RTAS support is not enabled.

Fixes this powerpc build error with CONFIG_SPU_FS=y, CONFIG_PPC_RTAS=n:

 arch/powerpc/platforms/built-in.o: undefined reference to `ppc_rtas'


Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>

---

I did a test build with pseries_defconfig and verified the proper routine is
linked in.  No run time test done.


Index: cell--common--5/include/asm-powerpc/syscalls.h
===================================================================
--- cell--common--5.orig/include/asm-powerpc/syscalls.h
+++ cell--common--5/include/asm-powerpc/syscalls.h
@@ -37,7 +37,7 @@
 asmlinkage int sys_ipc(uint call, int first, unsigned long second,
 		long third, void __user *ptr, long fifth);
 asmlinkage long ppc64_personality(unsigned long personality);
-asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
+asmlinkage int ppc_rtas(struct rtas_args __user *uargs) __attribute__((weak));
 asmlinkage time_t sys64_time(time_t __user * tloc);
 asmlinkage long ppc_newuname(struct new_utsname __user * name);
 

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

* Re: [PATCH] spufs: change ppc_rtas declaration to weak
  2006-10-05 18:35 [PATCH] spufs: change ppc_rtas declaration to weak Geoff Levand
@ 2006-10-06 11:53 ` Arnd Bergmann
  2006-10-07  1:53   ` Geoff Levand
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2006-10-06 11:53 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus

On Thursday 05 October 2006 20:35, Geoff Levand wrote:
> Index: cell--common--5/include/asm-powerpc/syscalls.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- cell--common--5.orig/include/asm-powerpc/syscalls.h
> +++ cell--common--5/include/asm-powerpc/syscalls.h
> @@ -37,7 +37,7 @@
> =A0asmlinkage int sys_ipc(uint call, int first, unsigned long second,
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0long third, void __user *=
ptr, long fifth);
> =A0asmlinkage long ppc64_personality(unsigned long personality);
> -asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
> +asmlinkage int ppc_rtas(struct rtas_args __user *uargs) __attribute__((w=
eak));
> =A0asmlinkage time_t sys64_time(time_t __user * tloc);
> =A0asmlinkage long ppc_newuname(struct new_utsname __user * name);
> =A0

Hmm, I can't see why this does the right thing. __attribute__((weak)) should
normally be put only into the definition of a function, not into the common
declaration. This looks like it makes _both_ definitions (kernel/sys.c and
arch/powerpc/kernel/rtas.c) weak, so on pseries it becomes unspecific which
one is actually used.

The problem that this is trying to work around is probably caused by the
dot-symbols: cond_syscall defines a ".ppc_rtas", but not a "ppc_rtas" symbo=
l,
which spufs tries to resolve.

	Arnd <><=20

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

* Re: [PATCH] spufs: change ppc_rtas declaration to weak
  2006-10-06 11:53 ` Arnd Bergmann
@ 2006-10-07  1:53   ` Geoff Levand
  0 siblings, 0 replies; 3+ messages in thread
From: Geoff Levand @ 2006-10-07  1:53 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Andrew_Pinski, linuxppc-dev, paulus

Arnd Bergmann wrote:
> On Thursday 05 October 2006 20:35, Geoff Levand wrote:
>> Index: cell--common--5/include/asm-powerpc/syscalls.h
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> --- cell--common--5.orig/include/asm-powerpc/syscalls.h
>> +++ cell--common--5/include/asm-powerpc/syscalls.h
>> @@ -37,7 +37,7 @@
>> =EF=BF=BDasmlinkage int sys_ipc(uint call, int first, unsigned long se=
cond,
>> =EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=
=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BD=EF=BF=BDl=
ong third, void __user *ptr, long fifth);
>> =EF=BF=BDasmlinkage long ppc64_personality(unsigned long personality);
>> -asmlinkage int ppc_rtas(struct rtas_args __user *uargs);
>> +asmlinkage int ppc_rtas(struct rtas_args __user *uargs) __attribute__=
((weak));
>> =EF=BF=BDasmlinkage time_t sys64_time(time_t __user * tloc);
>> =EF=BF=BDasmlinkage long ppc_newuname(struct new_utsname __user * name=
);
>> =EF=BF=BD
>=20
> Hmm, I can't see why this does the right thing. __attribute__((weak)) s=
hould
> normally be put only into the definition of a function, not into the co=
mmon
> declaration. This looks like it makes _both_ definitions (kernel/sys.c =
and
> arch/powerpc/kernel/rtas.c) weak, so on pseries it becomes unspecific w=
hich
> one is actually used.


You're right, I see now that that fix just worked by pure chance.


> The problem that this is trying to work around is probably caused by th=
e
> dot-symbols: cond_syscall defines a ".ppc_rtas", but not a "ppc_rtas" s=
ymbol,
> which spufs tries to resolve.


Yes, on studying the code produced I found that the problem was that
cond_syscall() didn't create a non-dot symbol that the C linkage of
spu_syscall_table[] expected, as seen here:

./arch/powerpc/platforms/cell/spu_callbacks.o
                 U ppc_rtas
./kernel/sys_ni.o
0000000000000000 W .ppc_rtas

As you suggested to try, the method used by ia64 works properly, creating=
 both
a dot and a non-dot weak symbol:

./kernel/sys_ni.o
0000000000000000 W .ppc_rtas
0000000000000000 W ppc_rtas

Updated patch follows.

-Geoff



Change the definition of powerpc's cond_syscall() to use the standard gcc
weak attribute specifier which provides proper support for C linkage as
needed by spu_syscall_table[].

Fixes this powerpc build error with CONFIG_SPU_FS=3Dy, CONFIG_PPC_RTAS=3D=
n:

 arch/powerpc/platforms/built-in.o: undefined reference to `ppc_rtas'


Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>

---

Build tests done with pseries_defconfig, cell_defconfig and ebony_defconf=
ig.

>From what I could determine, the toolchain troubles are no longer relevan=
t
with the recent change to a minimum version of gcc 3.2 for kernel builds.
Confirmation of this point would be appreciated.

=20
Index: cell--common--5/include/asm-powerpc/unistd.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- cell--common--5.orig/include/asm-powerpc/unistd.h
+++ cell--common--5/include/asm-powerpc/unistd.h
@@ -445,7 +445,6 @@
 #include <linux/types.h>
 #include <linux/compiler.h>
 #include <linux/linkage.h>
-#include <asm/syscalls.h>
=20
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
@@ -487,16 +486,9 @@
=20
 /*
  * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
  */
-#ifdef CONFIG_PPC32
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscal=
l")
-#else
-#define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_sys=
call")
-#endif
-
+#define cond_syscall(x) \
+	asmlinkage long x (void) __attribute__((weak,alias("sys_ni_syscall")))
=20
 #endif		/* __ASSEMBLY__ */
 #endif		/* __KERNEL__ */

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

end of thread, other threads:[~2006-10-07  1:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-05 18:35 [PATCH] spufs: change ppc_rtas declaration to weak Geoff Levand
2006-10-06 11:53 ` Arnd Bergmann
2006-10-07  1:53   ` Geoff Levand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.