On Tue, 7 Sept 2021 at 13:37, <marcandre.lur...@redhat.com> wrote:
>
> From: Marc-André Lureau <marcandre.lur...@redhat.com>
>
> Rust does not have i386 targets, so distinguish when target cpu is i686.
>
> Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
> ---
>  configure | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/configure b/configure
> index 8adf2127c3..48ff2837d9 100755
> --- a/configure
> +++ b/configure
> @@ -617,6 +617,8 @@ esac
>  if test ! -z "$cpu" ; then
>    # command line argument
>    :
> +elif check_define __i686__ ; then
> +  cpu="i686"
>  elif check_define __i386__ ; then
>    cpu="i386"

This isn't what the 'cpu' variable is attempting to distinguish.
We care only about "is this the 32-bit Intel CPU family?", which
we for convenience name "i386". We do not attempt (at least not in
configure) to distinguish between different sub-flavours or
versions of that 32-bit architecture. (Similarly, 'arm' just
means "32-bit arm", and doesn't distinguish v5, v6, v7 or whatever.)

As it happens the existing C codebase won't work on a classic
i386 -- for instance the cpu_get_host_ticks() function
for i386 host is implemented as the 'rdtsc' insn, which
didn't come in until the pentium.

For native compilation, I guess we should just assume that
whatever rustc targets by default is the right thing.
For cross compilation we probably need some mechanism for
the user to tell us what the right rust cross target is,
the same way we currently have them pass a --cross-prefix
(which typically looks like a target-triple, but where the
cpu part of the triple isn't necessarily the same thing as
the 'cpu' variable configure is using.

thanks
-- PMM

Reply via email to