[patch 1/2] Rename COMPAT_VERSION to COMPAT_VERSION_SAMEPROTO

Jan Kratochvil jan.kratochvil at redhat.com
Wed May 1 09:25:32 UTC 2013


On Wed, 01 May 2013 10:34:57 +0200, Mark Wielaard wrote:
> On Tue, Apr 30, 2013 at 02:37:46PM +0200, Jan Kratochvil wrote:
> > +# define COMPAT_VERSION_NEWPROTO(name, version, prefix) \
> > +  asm (".symver _compat." #version "." #name "," #name "@" #version); \
> > +  __typeof (_compat_##prefix##_##name) _compat_##prefix##_##name \
> > +    asm ("_compat." #version "." #name);
> >  # define COMPAT_VERSION(name, version, prefix) \
> >    asm (".symver _compat." #version "." #name "," #name "@" #version); \
> >    __typeof (name) _compat_##prefix##_##name asm ("_compat." #version "." #name);
> 
> Wouldn't the new definition just work always?

Yes but it will no longer sanity check the two implementations have the same
prototype.  Which may be useful in many (most?) use cases of it.

When thinking about it I am not sure if it was intentional or if it was just
a side-effect.


> (I still don't fully understand that last asm bit).

info '(gcc)Asm Labels'

IIUC there was an intention that someone cannot call the
compatibility-only-variant by accident (as one cannot call a function from
C containing '.' dot).  Sure even the caller could use the asm label to call
this '_compat.ELFUTILS_0.122.dwfl_report_elf' function but if the caller knows
how to use the asm label s/he should know it is not right to call this one.

But maybe I am wrong and there were different reasons for it.


Thanks,
Jan


More information about the elfutils-devel mailing list