qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PULL v2 02/57] configure: add support for --cross-cc-F


From: Peter Maydell
Subject: Re: [Qemu-devel] [PULL v2 02/57] configure: add support for --cross-cc-FOO
Date: Tue, 20 Aug 2019 14:32:17 +0100

On Thu, 21 Jun 2018 at 07:26, Alex Bennée <address@hidden> wrote:
>
> This allows us to specify cross compilers for our guests. This is
> useful for building test images/programs. Currently we re-run the
> compile test for each target. I couldn't think of a way to cache the
> value for a given arch without getting messier configure code.
>
> The cross compiler for the guest is visible to each target as
> CROSS_CC_GUEST in config-target.mak. This is quoted to handle the case
> of --cc="ccache gcc".
>
> Signed-off-by: Alex Bennée <address@hidden>
> Reviewed-by: Richard Henderson <address@hidden>

Hi -- this is an old commit from last year, but I've just noticed
(by code inspection) a bug in it:

> diff --git a/configure b/configure
> index a5fd46c9d4..ab189067cb 100755
> --- a/configure
> +++ b/configure
> @@ -458,6 +458,13 @@ vxhs=""
>  libxml2=""
>  docker="no"
>
> +# cross compilers defaults, can be overridden with --cross-cc-ARCH
> +cross_cc_aarch64="aarch64-linux-gnu-gcc"
> +cross_cc_arm="arm-linux-gnueabihf-gcc"
> +cross_cc_powerpc="powerpc-linux-gnu-gcc"
> +
> +enabled_cross_compilers=""
> +
>  supported_cpu="no"
>  supported_os="no"
>  bogus_os="no"
> @@ -488,6 +495,11 @@ for opt do
>    ;;
>    --disable-debug-info) debug_info="no"
>    ;;
> +  --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO 
> option"
> +  ;;
> +  --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
> +                eval "cross_cc_${cc_arch}=\$optarg"
> +  ;;
>    esac
>  done
>  # OS specific
> @@ -676,30 +688,37 @@ case "$cpu" in
>    ppc|ppc64|s390|s390x|sparc64|x32)
>      cpu="$cpu"
>      supported_cpu="yes"
> +    eval "cross_cc_${cpu}=\$host_cc"
>    ;;
>    i386|i486|i586|i686|i86pc|BePC)
>      cpu="i386"
>      supported_cpu="yes"
> +    cross_cc_i386=$host_cc
>    ;;

In the various arms of this switch, we use $host_cc.
Unfortunately, we don't process the --host-cc= option
until further down in the script, so this will only ever use
the default ("cc") even if the user tries to override it on
the configure command line. For this to work we need to
pull the handling of --host-cc= up into the "parse CC options
first" option handling code.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]