[PATCH] powerpc: Fix build of wcscpy with --disable-multi-arch

Adhemerval Zanella adhemerval.zanella@linaro.org
Sun Mar 3 13:20:00 GMT 2019



On 02/03/2019 19:06, Gabriel F. T. Gomes wrote:
> Since the commit
> 
> commit 81a14439417552324ec6ca71f65ddf8e7cdd51c7
> Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
> Date:   Tue Feb 5 17:35:12 2019 -0200
> 
>     wcsmbs: optimize wcscat
> 
> powerpc64 and powerpc64le builds fail when configured with
> --disable-multi-arch, due to an undefined reference to __GI___wcscpy.
> This patch fixes this on sysdeps/powerpc/powerpc64/power6/wcscpy.c,
> which is only used when multi-arch is disabled.
> 
> This patch does nothing for the failures on 32-bits powerpc builds,
> because the file is under the powerpc64 subdirectory, however, powerpc
> builds were already failing with --disable-multi-arch, with multiple
> error messages, even before the aforementioned commit.
> 
> Tested for powerpc, powerpc64, and powerpc64le with multi-arch enabled
> (all pass) and disabled (powerpc still fails as explained above).
> 
> 	* sysdeps/powerpc/powerpc64/power6/wcscpy.c (WCSCPY): Define to
> 	__wcscpy, then use libc_hidden_def and weak_alias to bind it to
> 	__GI___wcscpy and wcscpy.

LGTM. In fact you need either your compiler to setup to to use power6+
as default or configure with --with-cpu (the powerpc64le gcc I used
to check in fact do not have neither set).

As a side note, this is exactly the kind of annoyance I tried to avoid
when I advocated to reduce the build permutations on glibc for the 
recent s390 ifunc refactor (and it bit me with an issue recently [1]).
So I would ask again if these micro-optimization indeed pays for the 
over-complicated build options we need to actually test to make sure 
nothing broken glibc build.

For powerpc64 there are two issue: 1. can't we just infer the minimum
cpu support from compiler or CC and get rid of --with-cpu? I would like
to avoid to add the possible permutation of --with-cpu=powerX and
--disable-multi-arch of the required build to check. It won't help much
now since powerpc still organizes itself with sysdeps subfolder, but
it can be a first step.

Second, and this is minor one, I will send a patch to just remove the
power6 wcs* optimized routines. They are rarely used in the wild, the
optimization are just loop unrolling that we can either rely on 
compiler (sadly gcc does not unroll this kind of loop either with
aggressive optimization flags) or add on generic implementation,
and power6 and power7 are essentially the same binary for
powerpc64.

[1] https://sourceware.org/ml/libc-alpha/2019-02/msg00140.html

> ---
>  sysdeps/powerpc/powerpc64/power6/wcscpy.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/sysdeps/powerpc/powerpc64/power6/wcscpy.c b/sysdeps/powerpc/powerpc64/power6/wcscpy.c
> index 722c8f995b..59cfb28832 100644
> --- a/sysdeps/powerpc/powerpc64/power6/wcscpy.c
> +++ b/sysdeps/powerpc/powerpc64/power6/wcscpy.c
> @@ -1 +1,4 @@
> +#define WCSCPY __wcscpy
>  #include <sysdeps/powerpc/power6/wcscpy.c>
> +libc_hidden_def (__wcscpy)
> +weak_alias (__wcscpy, wcscpy)
> 



More information about the Libc-alpha mailing list