[PATCH 0/2] build: make tests/tcg compiler detection code more generic

Paolo Bonzini posted 2 patches 1 year, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220622134742.139306-1-pbonzini@redhat.com
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Peter Maydell <peter.maydell@linaro.org>
configure                              | 166 +++++++++++++++----------
tests/tcg/Makefile.target              |   1 +
tests/tcg/aarch64/system/pauth-3.c     |   2 +-
tests/tcg/aarch64/system/semiconsole.c |   2 +-
tests/tcg/aarch64/system/semiheap.c    |   2 +-
tests/tcg/multiarch/system/memory.c    |   2 +-
6 files changed, 105 insertions(+), 70 deletions(-)
[PATCH 0/2] build: make tests/tcg compiler detection code more generic
Posted by Paolo Bonzini 1 year, 10 months ago
Configure is trying to fall back on cross compilers for targets that
can have bi-arch or bi-endian toolchains, but there are many corner
cases where just checking the name can go wrong.  For example, the RHEL
ppc64le compiler is bi-arch and bi-endian, but multilibs are disabled.
Therefore it cannot be used to build 32-bit hosted binaries like the
linux-user TCG tests.

Trying the cross compiler first also does not work, and an example for
this is also ppc64le.  The powerpc64-linux-gnu-gcc binary from the
cross-gcc package is theoretically multilib-friendly, but it cannot
find the CRT files on a ppc64le host, because they are not in the .../le
multilib subdirectory.

This can be fixed by testing both the native compiler and the cross
compiler, and proceeding with the first one that works.  To do this,
move the compiler usability check from the tests/tcg snippet to inside
probe_target_compiler.

While at it, restrict it to just the user-mode emulation tests; if
a compiler is not able to build nostdlib freestanding binaries the
installation is broken.  This however detects a problem with some
system emulation tests that are using inttypes.h instead of stdint.h,
and not passing -ffreestanding to the compiler.  The first patch
fixes that.

Paolo

Based-on: <20220621075147.36297-1-pbonzini@redhat.com>


 configure                              | 166 +++++++++++++++----------
 tests/tcg/Makefile.target              |   1 +
 tests/tcg/aarch64/system/pauth-3.c     |   2 +-
 tests/tcg/aarch64/system/semiconsole.c |   2 +-
 tests/tcg/aarch64/system/semiheap.c    |   2 +-
 tests/tcg/multiarch/system/memory.c    |   2 +-
 6 files changed, 105 insertions(+), 70 deletions(-)

-- 
2.36.1