selftests: Fix clang cross compilation
authorMark Brown <broonie@kernel.org>
Tue, 14 Jun 2022 12:10:45 +0000 (13:10 +0100)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 14 Jun 2022 17:24:24 +0000 (11:24 -0600)
commit795285ef242543bb636556b7225f20adb7d3795c
tree7f8d04cef7d59d861a6b61ee0198945e1a343558
parentf2906aa863381afb0015a9eb7fefad885d4e5a56
selftests: Fix clang cross compilation

Unlike GCC clang uses a single compiler image to support multiple target
architectures meaning that we can't simply rely on CROSS_COMPILE to select
the output architecture. Instead we must pass --target to the compiler to
tell it what to output, kselftest was not doing this so cross compilation
of kselftest using clang resulted in kselftest being built for the host
architecture.

More work is required to fix tests using custom rules but this gets the
bulk of things building.

Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/lib.mk