Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] arch/loongarch: Fix toolchain triple ABI suffix
@ 2025-07-08 22:56 Jiaxun Yang
  2025-07-09 21:26 ` Julien Olivain via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Jiaxun Yang @ 2025-07-08 22:56 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain, Jiaxun Yang

LoongArch GCC infers ABI from triple suffix, thus it's necesessary
to set up proper triple ABI suffixes for different ABI types.

Adjust ABI suffix as per Table 10. List of possible <fabi-suffix>
in "LoongArch Toolchain Conventions Version 1.00".

Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html
Link: https://lore.kernel.org/all/20250706105859.292908-1-ju.o@free.fr/
Suggested-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 package/Makefile.in | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/package/Makefile.in b/package/Makefile.in
index 829636900ba950f4e2af4e070b7f979646600bcc..5ebb5f9ba8abd55cf9519cf3eb2a9a774ef9e271 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -83,6 +83,14 @@ ABI := $(ABI)hf
 endif
 endif
 
+# LoongArch Float ABI suffixes
+ifeq ($(BR2_LOONGARCH_ABI_LP64F),y)
+ABI = f32
+endif
+ifeq ($(BR2_LOONGARCH_ABI_LP64S),y)
+ABI = sf
+endif
+
 # For FSL PowerPC there's SPE
 ifeq ($(BR2_POWERPC_CPU_HAS_SPE),y)
 ABI = spe

---
base-commit: 09880508cb26260f30608137f697b6bdf11483fa
change-id: 20250708-loongarch-fabi-ce44d983eca1

Best regards,
-- 
Jiaxun Yang <jiaxun.yang@flygoat.com>

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] arch/loongarch: Fix toolchain triple ABI suffix
  2025-07-08 22:56 [Buildroot] [PATCH] arch/loongarch: Fix toolchain triple ABI suffix Jiaxun Yang
@ 2025-07-09 21:26 ` Julien Olivain via buildroot
  2025-07-10 10:14   ` Jiaxun Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Olivain via buildroot @ 2025-07-09 21:26 UTC (permalink / raw)
  To: Jiaxun Yang; +Cc: buildroot

Hi Jiaxun,

Thanks for the patch!

On 09/07/2025 00:56, Jiaxun Yang wrote:
> LoongArch GCC infers ABI from triple suffix, thus it's necesessary
> to set up proper triple ABI suffixes for different ABI types.
> 
> Adjust ABI suffix as per Table 10. List of possible <fabi-suffix>
> in "LoongArch Toolchain Conventions Version 1.00".
> 
> Link: 
> https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html
> Link: https://lore.kernel.org/all/20250706105859.292908-1-ju.o@free.fr/
> Suggested-by: Julien Olivain <ju.o@free.fr>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  package/Makefile.in | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 
> 829636900ba950f4e2af4e070b7f979646600bcc..5ebb5f9ba8abd55cf9519cf3eb2a9a774ef9e271 
> 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -83,6 +83,14 @@ ABI := $(ABI)hf
>  endif
>  endif
> 
> +# LoongArch Float ABI suffixes
> +ifeq ($(BR2_LOONGARCH_ABI_LP64F),y)
> +ABI = f32
> +endif
> +ifeq ($(BR2_LOONGARCH_ABI_LP64S),y)
> +ABI = sf
> +endif
> +

Unfortunately, while this patch fixes the configure error and goes a bit
further, it is not sufficient for a complete a build for the lp64f and
lp64s ABIs.

The following config to test "lp64d" ABI works
(same as without with patch).

     cat >.config <<EOF
     BR2_loongarch64=y
     BR2_LINUX_KERNEL=y
     BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
     BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
     BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
     BR2_TARGET_ROOTFS_EXT2=y
     # BR2_TARGET_ROOTFS_TAR is not set
     BR2_TARGET_EDK2=y
     BR2_TARGET_GRUB2=y
     BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
     EOF
     make olddefconfig
     make

Testing the "lp64f" ABI with commands:

     cat >.config <<EOF
     BR2_loongarch64=y
     BR2_LOONGARCH_FPU_32=y
     BR2_LINUX_KERNEL=y
     BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
     BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
     BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
     BR2_TARGET_ROOTFS_EXT2=y
     # BR2_TARGET_ROOTFS_TAR is not set
     EOF
     make olddefconfig
     make

fails in host-gcc-initial with output:

     Assembler messages:
     /tmp/ccEkwSsD.s:28: Error: register save offset not a multiple of 8
     /tmp/ccEkwSsD.s:30: Error: register save offset not a multiple of 8
     /tmp/ccEkwSsD.s:50: Error: register save offset not a multiple of 8

Testing the "lp46s" ABI with commands:

     cat >.config <<EOF
     BR2_loongarch64=y
     BR2_LOONGARCH_FPU_NONE=y
     BR2_LINUX_KERNEL=y
     BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
     BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
     BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
     BR2_TARGET_ROOTFS_EXT2=y
     # BR2_TARGET_ROOTFS_TAR is not set
     EOF
     make olddefconfig
     make

fails in host-gcc-final with output:

     /buildroot/output/host/loongarch64-buildroot-linux-gnusf/bin/ld: 
cannot find crti.o: No such file or directory
     /buildroot/output/host/loongarch64-buildroot-linux-gnusf/bin/ld: 
cannot find -lc: No such file or directory
     /buildroot/output/host/loongarch64-buildroot-linux-gnusf/bin/ld: 
cannot find crtn.o: No such file or directory

Note, the crt files are in "sf" subdirectory:
output/host/loongarch64-buildroot-linux-gnusf/sysroot/usr/lib/sf/crti.o

Could you have a look, please?

Best regards,

Julien.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] arch/loongarch: Fix toolchain triple ABI suffix
  2025-07-09 21:26 ` Julien Olivain via buildroot
@ 2025-07-10 10:14   ` Jiaxun Yang
  0 siblings, 0 replies; 3+ messages in thread
From: Jiaxun Yang @ 2025-07-10 10:14 UTC (permalink / raw)
  To: Julien Olivain, Xi Ruoyao; +Cc: buildroot



在2025年7月9日周三 下午10:26,Julien Olivain写道:
> Hi Jiaxun,
>
> Thanks for the patch!

Hi Julien,

Oh sorry for not test it properly before sending out, I was travelling
so I only did smoke test of generated triple on my laptop, will make
sure it's build tested next time :-)

Meanwhile, I'll mark these two options depends on BR2_BROKEN at the moment
while toolchain folks looking into it.

@Xi Ruoyao, since you are the GCC guru, can you help us to investigate?

Thanks

>
> On 09/07/2025 00:56, Jiaxun Yang wrote:
>> LoongArch GCC infers ABI from triple suffix, thus it's necesessary
>> to set up proper triple ABI suffixes for different ABI types.
>> 
>> Adjust ABI suffix as per Table 10. List of possible <fabi-suffix>
>> in "LoongArch Toolchain Conventions Version 1.00".
>> 
>> Link: 
>> https://loongson.github.io/LoongArch-Documentation/LoongArch-toolchain-conventions-EN.html
>> Link: https://lore.kernel.org/all/20250706105859.292908-1-ju.o@free.fr/
>> Suggested-by: Julien Olivain <ju.o@free.fr>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>>  package/Makefile.in | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>> 
>> diff --git a/package/Makefile.in b/package/Makefile.in
>> index 
>> 829636900ba950f4e2af4e070b7f979646600bcc..5ebb5f9ba8abd55cf9519cf3eb2a9a774ef9e271 
>> 100644
>> --- a/package/Makefile.in
>> +++ b/package/Makefile.in
>> @@ -83,6 +83,14 @@ ABI := $(ABI)hf
>>  endif
>>  endif
>> 
>> +# LoongArch Float ABI suffixes
>> +ifeq ($(BR2_LOONGARCH_ABI_LP64F),y)
>> +ABI = f32
>> +endif
>> +ifeq ($(BR2_LOONGARCH_ABI_LP64S),y)
>> +ABI = sf
>> +endif
>> +
>
> Unfortunately, while this patch fixes the configure error and goes a bit
> further, it is not sufficient for a complete a build for the lp64f and
> lp64s ABIs.
>
> The following config to test "lp64d" ABI works
> (same as without with patch).
>
>      cat >.config <<EOF
>      BR2_loongarch64=y
>      BR2_LINUX_KERNEL=y
>      BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
>      BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
>      BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
>      BR2_TARGET_ROOTFS_EXT2=y
>      # BR2_TARGET_ROOTFS_TAR is not set
>      BR2_TARGET_EDK2=y
>      BR2_TARGET_GRUB2=y
>      BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
>      EOF
>      make olddefconfig
>      make
>
> Testing the "lp64f" ABI with commands:
>
>      cat >.config <<EOF
>      BR2_loongarch64=y
>      BR2_LOONGARCH_FPU_32=y
>      BR2_LINUX_KERNEL=y
>      BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
>      BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
>      BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
>      BR2_TARGET_ROOTFS_EXT2=y
>      # BR2_TARGET_ROOTFS_TAR is not set
>      EOF
>      make olddefconfig
>      make
>
> fails in host-gcc-initial with output:
>
>      Assembler messages:
>      /tmp/ccEkwSsD.s:28: Error: register save offset not a multiple of 8
>      /tmp/ccEkwSsD.s:30: Error: register save offset not a multiple of 8
>      /tmp/ccEkwSsD.s:50: Error: register save offset not a multiple of 8
>
> Testing the "lp46s" ABI with commands:
>
>      cat >.config <<EOF
>      BR2_loongarch64=y
>      BR2_LOONGARCH_FPU_NONE=y
>      BR2_LINUX_KERNEL=y
>      BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
>      BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
>      BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
>      BR2_TARGET_ROOTFS_EXT2=y
>      # BR2_TARGET_ROOTFS_TAR is not set
>      EOF
>      make olddefconfig
>      make
>
> fails in host-gcc-final with output:
>
>      /buildroot/output/host/loongarch64-buildroot-linux-gnusf/bin/ld: 
> cannot find crti.o: No such file or directory
>      /buildroot/output/host/loongarch64-buildroot-linux-gnusf/bin/ld: 
> cannot find -lc: No such file or directory
>      /buildroot/output/host/loongarch64-buildroot-linux-gnusf/bin/ld: 
> cannot find crtn.o: No such file or directory
>
> Note, the crt files are in "sf" subdirectory:
> output/host/loongarch64-buildroot-linux-gnusf/sysroot/usr/lib/sf/crti.o
>
> Could you have a look, please?
>
> Best regards,
>
> Julien.

-- 
- Jiaxun
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-10 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08 22:56 [Buildroot] [PATCH] arch/loongarch: Fix toolchain triple ABI suffix Jiaxun Yang
2025-07-09 21:26 ` Julien Olivain via buildroot
2025-07-10 10:14   ` Jiaxun Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox