This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Automatically guess --with-cpu value
- From: "Tulio Magno Quites Machado Filho" <tuliom at linux dot vnet dot ibm dot com>
- To: Carlos Eduardo Seo <cseo at linux dot vnet dot ibm dot com>
- Cc: GLIBC <libc-alpha at sourceware dot org>
- Cc:
- Date: Tue, 22 Dec 2015 14:44:04 -0200
- Subject: Re: [PATCH] powerpc: Automatically guess --with-cpu value
- Authentication-results: sourceware.org; auth=none
- References: <56577683 dot 3000206 at linux dot vnet dot ibm dot com>
Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> writes:
> Added a check to detect the CPU value in preconfigure, so that glibc is built
> with the correct --with-cpu value. This is only done for Power servers.
>
> 2015-11-15 Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
>
> * sysdeps/powerpc/preconfigure: Added a check to identify the CPU value
> and set it for the --with-cpu configure parameter.
> ---
> sysdeps/powerpc/preconfigure | 51 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
>
> diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure
> index 0c6fdde..ada7b0c 100644
> --- a/sysdeps/powerpc/preconfigure
> +++ b/sysdeps/powerpc/preconfigure
> @@ -15,3 +15,54 @@ powerpc*)
> rm -f conftest.i
> ;;
> esac
> +
> +# Lets ask the compiler which Power processor we've got.
Trailing whitespace here ----------------------------------^
> +# Note if you add patterns here you must ensure that an appropriate directory
> +# exists in sysdeps/powerpc
> +archcpu=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
> + sed -n 's/^#define \(_ARCH_PWR[0-9].*\) .*$/\1/p' |
> + sort -r | head -n 1`
> +
> +# Set --with-cpu as appropriate.
> +case "$archcpu" in
> +_ARCH_PWR8)
> + submachine="power8"
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5
> +$as_echo "$as_me: CPU identified as $submachine" >&6;}
> + ;;
> +_ARCH_PWR7)
> + submachine="power7"
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5
> +$as_echo "$as_me: CPU identified as $submachine" >&6;}
> + ;;
> +_ARCH_PWR6X)
> + submachine="power6x"
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5
> +$as_echo "$as_me: CPU identified as $submachine" >&6;}
> + ;;
> +_ARCH_PWR6)
> + submachine="power6"
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5
> +$as_echo "$as_me: CPU identified as $submachine" >&6;}
> + ;;
> +_ARCH_PWR5X)
> + submachine="power5+"
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5
> +$as_echo "$as_me: CPU identified as $submachine" >&6;}
> + ;;
> +_ARCH_PWR5)
> + submachine="power5"
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5
> +$as_echo "$as_me: CPU identified as $submachine" >&6;}
> + ;;
> +_ARCH_PWR4)
> + submachine="power4"
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5
> +$as_echo "$as_me: CPU identified as $submachine" >&6;}
> + ;;
> +*)
> + submachine=""
> + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU not identified; using default" >&5
> +$as_echo "$as_me: CPU not identified; using default" >&6;}
> + ;;
> +esac
You have to check if the user passed --with-cpu before doing this.
If you don't do that you'll overwrite the value passed by the user.
--
Tulio Magno