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 sell...@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) > > ^~ > ~~~~~~~~~~~~~~~~~~