config-patches
[Top][All Lists]
Advanced

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

config.guess returns bogus triple when the compiler is tcc/x86


From: Bruno Haible
Subject: config.guess returns bogus triple when the compiler is tcc/x86
Date: Thu, 04 Mar 2021 01:51:32 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; )

TinyCC is an ISO C99 compliant C compiler. [1]

On an x86_64 glibc system, when using this compiler (configured to produce
x86 code: './configure --cpu=x86 --triplet=i386-linux-gnu'), all GNU package
configure scripts guess the $host wrongly:

checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-pc-linux-gnux32
checking host system type... x86_64-pc-linux-gnux32
checking for stdio.h... yes

This compiler produces object files and executables with the same
format as 'gcc -m32', the config.guess result should be the same:
x86_64-pc-linux-gnu. not x86_64-pc-linux-gnux32.

(Note: It can be debated whether the result should not be
i686-pc-linux-gnu instead of x86_64-pc-linux-gnu, but this is
not what I'm asking for here.)

The reason for the mis-diagnostic is that TinyCC, when generating code
for 32-bit CPUs, defines __ILP32__. This is not wrong by any standards,
because ILP32 simply means that the 'int' type, the 'long' type, and
the 'void *' type are all 32 bits wide. But it is different from what
GCC defines:

"gcc -m64"  defines __x64_64__, __LP64__
"gcc -mx32" defines __x64_64__, __ILP32__
"gcc -m32"  defines __i386__
"tcc"       defines __i386__, __ILP32__

Therefore IMO config.guess needs to be fixed.

Find attached a patch that achieves the effect:

checking whether make sets $(MAKE)... (cached) yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for stdio.h... yes

Bruno

[1] https://en.wikipedia.org/wiki/Tiny_C_Compiler

Attachment: config.guess.diff
Description: Text Data


reply via email to

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