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

Re: Support of building Xen with Clang/LLVM on Arm?


  • To: Saman Dehghan <samaan.dehghan@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Fri, 24 Oct 2025 00:45:53 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=sfiaqGUD8Ep+N6lp00WKhZ9MkCPJDxDmGXtlKRUfxBM=; b=Q+FZgRXsDaNs9s2dfEybwzSemA72IHmeJQRPgu55Qsn7cJ4UhYtXwgq8sfa0uygsX0prYc5yD+J92ko5ZBNPSCk6Axqf9zP6V8kFFGSzceWTHKbCWv5v0dJEtLmBxukhsuTLcqfu22xnn/eMW1UPuRb+EsvVF2mBi1zGWqs4UT7f/C3H0LKS03zQIbqxTBexXYRpObBwVttXHkhxre0fGjxRxs2sEbc2dBqoEdAzMa6DSY/BWIpD16O1mNq6BJUzE2JTkVyuW1HKGl9dR9WBpYiZ0hxeGgLCcauGe5WKLKjiwYgxdihNYhp9T8GdMrU8FNb9ux3W2S5aMH3u48T6RQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qT492TYZAVLB8GgBOxtl4adiTkrJn8KKfasUMJs5ON2UkMdYaGwWSmIlw+bl5x6lLnpBL1yv09GlKE3Jxmbw1Gz73YXh0uls5xyFZBRnVXWLgT4UvuJwnFUO1Jkf1XQYtkH5Ovu+DX60t7pKvXS9Uf6Hcq/1YOGuFgzZu9OjE+j2qBPJbl6o78wL7ahZUbpwUDcz5xeSgYPzHG9dSDXrvbRdkHbkDG88LLPUEZtainSPkfWshSgdMTOcVvBNIlFN1ahvKi03P0sTClx8Gp9zcCR39rPpTTDjFg3k6DL4ie3y18qsfHQG+VnoUEKatIGrbvxL9Im1O/O2n3lxKLbGKQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Wentao Zhang <wentaoz5@xxxxxxxxxxxx>
  • Delivery-date: Thu, 23 Oct 2025 23:46:09 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 24/10/2025 12:34 am, Saman Dehghan wrote:
> Hi xen-devel,
>
> When preparing and testing another of my patch for LLVM coverage [1], I
> encountered a few problems with Clang/LLVM build on ARM 64 platforms.
>
> The first two are clang errors.
>
> I observe the following errors when building the Xen master branch
> for ARM 64 with Clang 19 and 20. If I comment out 
> "CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only" in "xen/arch/arm/arch.mk"
> the error is gone but the build fails during linking (see the third). 
>
> Error message:
>
> arch/arm/arm64/vfp.c:9:18: error: instruction requires: fp-armv8  
>     9 |     asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"          
>       |                  ^                                        
> <inline asm>:1:2: note: instantiated into assembly here           
>     1 |         stp q0, q1, [x8, #16 * 0]                        
>       |         ^                                                 
> arch/arm/arm64/vfp.c:9:46: error: instruction requires: fp-armv8              
>                                                       
>     9 |     asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"          
>       |                                              ^            
> <inline asm>:2:2: note: instantiated into assembly here           
>     2 |         stp q2, q3, [x8, #16 * 2]                         
>       |         ^                                                 
> arch/arm/arm64/vfp.c:10:46: error: instruction requires: fp-armv8
>    10 |                  "stp q2, q3, [%1, #16 * 2]\n\t"          
>       |                                              ^           
> <inline asm>:3:2: note: instantiated into assembly here
>     3 |         stp q4, q5, [x8, #16 * 4]
>       |         ^
> arch/arm/arm64/vfp.c:11:46: error: instruction requires: fp-armv8
>    11 |                  "stp q4, q5, [%1, #16 * 4]\n\t"
>       |                                              ^
> <inline asm>:4:2: note: instantiated into assembly here
>     4 |         stp q6, q7, [x8, #16 * 6]
>       |         ^
> arch/arm/arm64/vfp.c:12:46: error: instruction requires: fp-armv8
>    12 |                  "stp q6, q7, [%1, #16 * 6]\n\t"
>       |                                              ^
> <inline asm>:5:2: note: instantiated into assembly here
>     5 |         stp q8, q9, [x8, #16 * 8]
>       |         ^
> arch/arm/arm64/vfp.c:13:46: error: instruction requires: fp-armv8
>    13 |                  "stp q8, q9, [%1, #16 * 8]\n\t"
>       |                                              ^
> <inline asm>:6:2: note: instantiated into assembly here
>     6 |         stp q10, q11, [x8, #16 * 10]
>       |         ^
>
> Reprroduction steps:
>
> $ git clone https://xenbits.xen.org/git-http/xen
> $ cd xen
> $ git checkout eff32008be0d2718d32d60245650ff6f88fb3d13
> $ make -C xen menuconfig clang=y
> $ make xen clang=y
>
> Tested with the following setup:
>
> - Clang version: Ubuntu clang version 19.1.1 (1ubuntu1~24.04.2)
> - Host: Ubuntu 24.04.3 LTS /  aarch64
>
> Second, for Clang 18 or below there are another set of errors despite
> commenting out the "-mgeneral-regs-only" flag:
>
> arch/arm/arm64/mmu/head.S:288:13: error: expected writable system register or 
> pstate
>         msr TTBR0_EL2, x4
>             ^
> arch/arm/arm64/mmu/head.S:509:13: error: expected writable system register or 
> pstate
>         msr TTBR0_EL2, x0
>             ^
>
> Tested with:
>
> - Clang version: Ubuntu clang version 18.1.3 (1ubuntu1)
> - Host: Ubuntu 24.04.3 LTS /  aarch64
>
> This works with GCC. It also works with Clang on x86 builds.
>
> Third, if I specify "LD=ld.lld" with Clang 19 and 20 after commenting out
> the "-mgeneral-regs-only" flag. I got this linking error:
>
> ld.lld: error: common/device-tree/static-evtchn.init.o:(.rodata.str): offset 
> is outside the section
>
> As I read from the project README, under "C compiler and linker - For ARM",
> only GCC is listed. So my general question is whether Xen supports building
> with Clang/LLVM on ARM platforms.
>
> Let me know if you need more details or a patch attempt.

Clang/LLVM is only supported for x86.

Personally I think the other architectures would benefit from using both
compilers, but it's up to the relevant maintainers.

~Andrew



 


Rackspace

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