Re: [RFC] [PATCH] asm-generic/unistd.h: handle symbol prefixes incond_syscall

From: James Hogan
Date: Fri Feb 24 2012 - 09:51:51 EST


Hi Arnd

Thanks for taking a look.

On 24/02/12 14:24, Arnd Bergmann wrote:
> On Friday 24 February 2012, James Hogan wrote:
>> Some architectures have symbol prefixes and set CONFIG_SYMBOL_PREFIX,
>> but this wasn't taken into account by the generic cond_syscall. It's
>> easy enough to fix in a generic fashion, so add the symbol prefix to
>> symbol names in cond_syscall when CONFIG_SYMBOL_PREFIX is set.
>>
>> Signed-off-by: James Hogan <james.hogan@xxxxxxxxxx>
>> ---
>> include/asm-generic/unistd.h | 9 ++++++++-
>> 1 files changed, 8 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
>> index 2292d1a..c9a5ba4 100644
>> --- a/include/asm-generic/unistd.h
>> +++ b/include/asm-generic/unistd.h
>> @@ -924,7 +924,14 @@ __SYSCALL(__NR_fork, sys_ni_syscall)
>> * but it doesn't work on all toolchains, so we just do it by hand
>> */
>> #ifndef cond_syscall
>> -#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
>> +#ifdef CONFIG_SYMBOL_PREFIX
>> +#define __SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
>> +#else
>> +#define __SYMBOL_PREFIX
>> +#endif
>> +#define cond_syscall(x) asm(".weak\t" __SYMBOL_PREFIX #x "\n\t" \
>> + ".set\t" __SYMBOL_PREFIX #x "," \
>> + __SYMBOL_PREFIX "sys_ni_syscall")
>> #endif
>
> Our trend is to move away from arch specific Kconfig symbols and __ARCH_HAS_*
> macros towards just defining whatever you need in the architecture as an
> override for the generic definition.
>
> Just provide your own unistd.h that does
>
> #define cond_syscall(x) asm(".weak\t." #x "\n\t.set\t." #x ",.sys_ni_syscall")
> #include <asm-generic/unistd.h>

Okay, no problem.

> BTW, are you planning to submit arch/metag for inclusion? I've looked at
> the code recently and it appears that you are on the right track overall,
> and it shouldn't be too hard to get to the same quality level as
> arch/openrisc.

At this stage I'm just (in my own time) trying to get it closer to the
standard required for new architectures so that when the time comes
there's less to do.

I've been looking at your initial comments for other architecture
submissions and they've been very helpful, but if you do have any
arch/metag specific suggestions I'd certainly welcome them.

Thanks
James

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/