[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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Fri, 29 Nov 2024 22:12:30 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zDI37MTGwsTOjaf0fbNTmdswCc6H9iBRmrI5tKAopRc=; b=J7t9wje1yHh2aeZa5DxWYkOwcDw6l1Bjk7XS7lZOg23vW0FdyTtXF5S0PdFraO8BI8g8wIwtrdTn/yidikZUjBzBdUaM3Pzo/j2DgCcTXC//udjO3npTcOYpMUao1OyG9vsgOEZr1InAGx1WR1nSUQZ64K5WlaKPnwxIvP4Tf2e8OU0/eN+EvLEUgXwd0Buhe52brQwFSaUgnt8Jt52K+klNgLeW2wWwBCX9dQESlwjOjRZnRAuwH4cEqSm3OXPzezFMctECUMRWPacQIhKTfy6JvoIsNbYdm6HV08oTKudVgTTsvSMNJTXaqOVmPYHaz6GZUdKeq/1+3xIVArL/dA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n9P2qEdI8waFsh57ETUH0CTkZ6cv9NacmsjcJm3QItRgpLxXipR/2IUjvDhy5ByBj9xbH4FlQQypeFwT6o+/n9UzWp2s/IK3nkCMve5eerOyUgtnAS6t4Q7+2tSng4uT7wUTjMY/n0mYDFQ++qmOVGk1a9d6p7S1TKK/NdAW23S8Pqq1QpzBGHAApS2t/hCtOFdE5qE6h+jMVxjfXzY+m37xIJ1c4JBSv08dSsBZMvVCVe6yZDPpCLqWTOihJnLt3eHTtGl6Ty/7eyt/pV2Aj0sMTxVWayIaWX7DXYQP6y3ue5v69qE2QsrgTPtAIL3aJWlHvOSBe3rjns0S/dt1CQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Fri, 29 Nov 2024 22:12:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbQgDiBM9r6Gu0CEmbvf51boI0mQ==
  • Thread-topic: [PATCH 3/5] build: arm64: provide -target and -march if using clang

Hi Jan,

Jan Beulich <jbeulich@xxxxxxxx> writes:

> On 29.11.2024 02: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.
>> 
>> 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
>> +endif
>
> Why is this dependent on (just?) $(clang), not (also?) $(llvm)?

Because this parameter is handled by clang only. There is no harm in
providing it explicitly. When building on arm64, value of this parameter
will match the default value for the platform. When building on x86, we
need to tell clang that it should generate arm64 code anyways. There is
no reason in trying to make ARM build with x86 instruction set.

> Also
> this affects both toolstack builds and hypervisor. Is applying -march
> like this actually appropriate for the toolstack?

This is a good question. I can't see why this can't be appropriate for
toolstack. I.e. what bad can happen when building the toolstack.

-- 
WBR, Volodymyr


 


Rackspace

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