[PATCH] detect incompatible aliases (PR c/81854)
Steve Ellcey
sellcey@cavium.com
Wed Sep 20 17:23:00 GMT 2017
Interesting new data point. Â aarch64 GCC does not enable the
resolver/indirect function feature by default (--enable-gnu-indirect-
function is not set by default). Â If I enable this on the GCC build
then GCC can build glibc. Â Without it, the glibc build fails.
Steve Ellcey
sellcey@cavium.com
On Wed, 2017-09-20 at 09:38 -0700, Steve Ellcey wrote:
> On Wed, 2017-09-20 at 10:17 -0600, Martin Sebor wrote:
> >
> > Â
> > The comment copied below from sysdeps/aarch64/multiarch/memmove.c
> > suggests this might be deliberate:
> >
> > /* Redefine memmove so that the compiler won't complain about the
> > type
> >     mismatch with the IFUNC selector in strong_alias, below.  */
> >
> > so my guess is that the improved type checking has just exposed
> > this mismatch.  Can you please post the translation unit so we
> > can confirm it?
> >
> > Thanks
> > Martin
> The translation unit is sysdeps/aarch64/multiarch/memmove.c. Â If I
> preprocess that and cut out the unneeded parts I get:
>
> extern int i;
> typedef long unsigned int size_t;
> extern void *__redirect_memmove (void *__dest, const void *__src,
> size_t __n)
> Â Â Â Â Â __attribute__ ((__nothrow__ )) ;
> extern __typeof (__redirect_memmove) __libc_memmove;
> extern __typeof (__redirect_memmove) __memmove_generic ;
> extern __typeof (__redirect_memmove) __memmove_thunderx ;
> extern __typeof (__libc_memmove) __libc_memmove;
> __typeof (__libc_memmove) *__libc_memmove_ifunc (void) __asm__
> ("__libc_memmove");
> __attribute__ ((__optimize__ ("-fno-stack-protector"))) __typeof
> (__libc_memmove) *__libc_memmove_ifunc (void)
> Â Â Â Â Â Â Â Â {
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â __typeof (__libc_memmove) *res = i ?
> __memmove_thunderx
> : __memmove_generic; return res; }
>
> __asm__ (".type " "__libc_memmove" ", %gnu_indirect_function");
> extern __typeof (__libc_memmove) memmove __attribute__ ((alias
> ("__libc_memmove")));;
>
>
> Which, when compiled gives me:
>
>
> % install/bin/gcc -c x.c
> x.c:15:34: warning: âmemmoveâ alias between functions of incompatible
> types âvoid *(void *, const void *, size_t) {aka void *(void *, const
> void *, long unsigned int)}â and âvoid * (*(void))(void *, const void
> *, size_t) {aka void * (*(void))(void *, const void *, long unsigned
> int)}â [-Wattributes]
> Â extern __typeof (__libc_memmove) memmove __attribute__ ((alias
> ("__libc_memmove")));;
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^~~~~~~
> x.c:10:84: note: aliased declaration here
> Â (__optimize__ ("-fno-stack-protector"))) __typeof (__libc_memmove)
> *__libc_memmove_ifunc (void)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â
> ^~
> ~~~~~~~~~~~~~~~~~~
More information about the Libstdc++
mailing list