cond_syscall() and new ABI.
Christoph Hellwig
hch at lst.de
Wed Oct 13 00:26:27 EST 2004
On Tue, Oct 12, 2004 at 02:51:49PM +0100, David Woodhouse wrote:
> This (in linux/asm-ppc64/unistd.h) doesn't work with the new ABI:
>
> /*
> * "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
> */
> #define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall");
>
> Two options -- either we ditch older toolchains (before 2002-03-01
> probably), by switching to what we say in the comment, or we introduce
> an ifdef to choose whether to include the '.' in the symbol names...
>
> Both attached. Someone who cares can choose one :)
>
> --
> dwmw2
> ===== include/asm-ppc64/unistd.h 1.34 vs edited =====
> --- 1.34/include/asm-ppc64/unistd.h Tue Sep 14 01:23:12 2004
> +++ edited/include/asm-ppc64/unistd.h Tue Oct 12 14:49:48 2004
> @@ -468,7 +468,11 @@
> * 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
> */
> +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
> +#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall");
> +#else
> #define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall");
this is broken. Gcc 3.4 doesn't even have support for the non-dotted
ABI, nevermind uses it by default.
> ===== include/asm-ppc64/unistd.h 1.34 vs edited =====
> --- 1.34/include/asm-ppc64/unistd.h Tue Sep 14 01:23:12 2004
> +++ edited/include/asm-ppc64/unistd.h Tue Oct 12 14:48:08 2004
> @@ -468,7 +468,7 @@
> * 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
> */
> -#define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall");
> +#define cond_syscall(x) void x(void) __attribute__((weak,alias("sys_ni_syscall")));
this one otoh makes lots of sense - it's what most architectures use.
More information about the Linuxppc64-dev
mailing list