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

From: Mike Frysinger
Date: Fri Feb 24 2012 - 11:19:43 EST


On Friday 24 February 2012 09:24:07 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.
> >
> > include/asm-generic/unistd.h | 9 ++++++++-
> > 1 files changed, 8 insertions(+), 1 deletions(-)
> >
> > --- a/include/asm-generic/unistd.h
> > +++ b/include/asm-generic/unistd.h
> >
> > #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.

i don't see how __ARCH_HAS_xxx would help here. the symbol prefix is a string,
not a bool value. it's also already used by linux/export.h, asm-
generic/vmlinux.lds.h, and module code in scripts/.

> Just provide your own unistd.h that does

the point of asm-generic is so that arches don't have to keep copying &
pasting things that they really don't care about. James' proposed patch looks
good to me. it might be nice to go even further and add logic to a core
header so that CONFIG_SYMBOL_PREFIX is always defined ...
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.