* Support of building Xen with Clang/LLVM on Arm?
@ 2025-10-23 23:34 Saman Dehghan
2025-10-23 23:45 ` Andrew Cooper
0 siblings, 1 reply; 6+ messages in thread
From: Saman Dehghan @ 2025-10-23 23:34 UTC (permalink / raw)
To: xen-devel; +Cc: Wentao Zhang
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.
[1] https://lists.xenproject.org/archives/html/xen-devel/2025-10/msg00010.html
Thanks,
Saman
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Support of building Xen with Clang/LLVM on Arm?
2025-10-23 23:34 Support of building Xen with Clang/LLVM on Arm? Saman Dehghan
@ 2025-10-23 23:45 ` Andrew Cooper
2025-10-24 16:57 ` saman dehghan
2025-11-04 10:43 ` Julien Grall
0 siblings, 2 replies; 6+ messages in thread
From: Andrew Cooper @ 2025-10-23 23:45 UTC (permalink / raw)
To: Saman Dehghan, xen-devel; +Cc: Wentao Zhang
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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Support of building Xen with Clang/LLVM on Arm?
2025-10-23 23:45 ` Andrew Cooper
@ 2025-10-24 16:57 ` saman dehghan
2025-11-04 10:43 ` Julien Grall
1 sibling, 0 replies; 6+ messages in thread
From: saman dehghan @ 2025-10-24 16:57 UTC (permalink / raw)
To: Andrew Cooper; +Cc: xen-devel, Wentao Zhang
[-- Attachment #1: Type: text/plain, Size: 4491 bytes --]
Thank you Andrew for your prompt clarification.
We'll see what the best we can contribute while developing our coverage
patch.
Thanks,
Saman
On Thu, Oct 23, 2025 at 6:45 PM Andrew Cooper <andrew.cooper3@citrix.com>
wrote:
> 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
>
[-- Attachment #2: Type: text/html, Size: 6763 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Support of building Xen with Clang/LLVM on Arm?
2025-10-23 23:45 ` Andrew Cooper
2025-10-24 16:57 ` saman dehghan
@ 2025-11-04 10:43 ` Julien Grall
2025-11-04 11:35 ` Julien Grall
1 sibling, 1 reply; 6+ messages in thread
From: Julien Grall @ 2025-11-04 10:43 UTC (permalink / raw)
To: Andrew Cooper, Saman Dehghan, xen-devel; +Cc: Wentao Zhang
Hi,
On 24/10/2025 00:45, Andrew Cooper wrote:
> 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.
Happy to review any patches for clang support on Arm.
Cheers,
--
Julien Grall
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Support of building Xen with Clang/LLVM on Arm?
2025-11-04 10:43 ` Julien Grall
@ 2025-11-04 11:35 ` Julien Grall
2025-11-10 21:17 ` Saman Dehghan
0 siblings, 1 reply; 6+ messages in thread
From: Julien Grall @ 2025-11-04 11:35 UTC (permalink / raw)
To: Andrew Cooper, Saman Dehghan, xen-devel, Volodymyr Babchuk; +Cc: Wentao Zhang
Le mar. 4 nov. 2025 à 10:44, Julien Grall <julien@xen.org> a écrit :
> Happy to review any patches for clang support on Arm.
I was told privately that there is a series on the ML to add support
for Clang (see [1]). It looks like there series
had some reviews but needs a new version. Adding Volodymyr as the
original author.
[1] https://lore.kernel.org/all/20241129014850.2852844-1-volodymyr_babchuk@epam.com/
>
> Cheers,
>
> --
> Julien Grall
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Support of building Xen with Clang/LLVM on Arm?
2025-11-04 11:35 ` Julien Grall
@ 2025-11-10 21:17 ` Saman Dehghan
0 siblings, 0 replies; 6+ messages in thread
From: Saman Dehghan @ 2025-11-10 21:17 UTC (permalink / raw)
To: Julien Grall; +Cc: Andrew Cooper, xen-devel, Volodymyr Babchuk, Wentao Zhang
On Tue, Nov 4, 2025 at 5:35 AM Julien Grall <julien.grall.oss@gmail.com> wrote:
>
> Le mar. 4 nov. 2025 à 10:44, Julien Grall <julien@xen.org> a écrit :
> > Happy to review any patches for clang support on Arm.
>
> I was told privately that there is a series on the ML to add support
> for Clang (see [1]). It looks like there series
> had some reviews but needs a new version. Adding Volodymyr as the
> original author.
>
> [1] https://lore.kernel.org/all/20241129014850.2852844-1-volodymyr_babchuk@epam.com/
>
Thanks for the pointer. We have tested this patch from our side and it
already solved our problems (specifically patch 1, 4 and 5). Shall we
resubmit this patch again or follow up on the original thread?
Also regarding the comment [1] shall we explore alternative fixes?
[1] https://lore.kernel.org/all/1d1684b2-ed0e-47cb-ab78-72cd2f51aafc@suse.com/
Thanks,
Saman
> >
> > Cheers,
> >
> > --
> > Julien Grall
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-11-10 21:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 23:34 Support of building Xen with Clang/LLVM on Arm? Saman Dehghan
2025-10-23 23:45 ` Andrew Cooper
2025-10-24 16:57 ` saman dehghan
2025-11-04 10:43 ` Julien Grall
2025-11-04 11:35 ` Julien Grall
2025-11-10 21:17 ` Saman Dehghan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).