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

Re: [PATCH 3/5] build: arm64: provide -target and -march if using clang



Hi Volodymyr,

On 29/11/2024 01:49, Volodymyr Babchuk wrote:
Provide -target and -march explicitly when building with clang. This
makes cross-compilation much easier, because clang accept this
parameters regardless of host platform. Basically,

   make XEN_TARGET_ARCH=arm64 clang=y llvm=y

will behave in the same way if building Xen on x86, or on arm64 or on
any other platform.

-march is required because with default value, clang will not
recognize EL2 registers.

Any chance this is happening because you are using "-target aarch64" rather than e.g. "arch64-arm-none-eabi"?

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
---
  config/arm64.mk | 4 ++++
  1 file changed, 4 insertions(+)

diff --git a/config/arm64.mk b/config/arm64.mk
index c4662f67d0..97eb9a82e7 100644
--- a/config/arm64.mk
+++ b/config/arm64.mk
@@ -5,6 +5,10 @@ CONFIG_XEN_INSTALL_SUFFIX :=
CFLAGS += #-marm -march= -mcpu= etc +ifeq ($(clang),y)
+CFLAGS += -target aarch64 -march=armv8-a

AFAIU, -target is the triplet similar to what one would set CROSS_COMPILE. If you don't specify some values, then it will assume the compiler defaults. I am not sure this is a good idea as this could change between compilers. So should we set the triplet properly (e.g. arch64-arm-none-eabi) or maybe let the user specify it via CROSS_COMPILE?

Regarding -march=armv8-a, if you want to keep it, then I think it should be outside of the 'if' because this could also apply for GCC.

Cheers,

--
Julien Grall




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.