diff mbox series

libucontext: use hard/soft float

Message ID 20250630144814.255656-1-jdmason@kudzu.us
State New
Headers show
Series libucontext: use hard/soft float | expand

Commit Message

Jon Mason June 30, 2025, 2:48 p.m. UTC
From: Jon Mason <jon.mason@arm.com>

When building for qemuarm-secureboot in meta-arn with musl and clang,
the following compile error is seen:
- | ../sources/libucontext-1.3.2/arch/arm/swapcontext.S:23:11: error: unknown token in expression
- |  ldr r4, =#0x56465001
- |           ^

This is happening because 1.3 added ifdefs for assembly code for both
hard and soft float, and bcause neither is being defined, it is taking
this path with the issue.

Since we can tell if soft or hard float is being used via the TARGET_FPU
variable, use that and set the relevant makefile flag.

Signed-off-by: Jon Mason <jon.mason@arm.com>
---
 meta/recipes-core/musl/libucontext_1.3.2.bb | 3 +++
 1 file changed, 3 insertions(+)

Comments

Mark Hatle June 30, 2025, 4:32 p.m. UTC | #1
On 6/30/25 9:48 AM, Jon Mason wrote:
> From: Jon Mason <jon.mason@arm.com>
> 
> When building for qemuarm-secureboot in meta-arn with musl and clang,
> the following compile error is seen:
> - | ../sources/libucontext-1.3.2/arch/arm/swapcontext.S:23:11: error: unknown token in expression
> - |  ldr r4, =#0x56465001
> - |           ^
> 
> This is happening because 1.3 added ifdefs for assembly code for both
> hard and soft float, and bcause neither is being defined, it is taking
> this path with the issue.
> 
> Since we can tell if soft or hard float is being used via the TARGET_FPU
> variable, use that and set the relevant makefile flag.
> 
> Signed-off-by: Jon Mason <jon.mason@arm.com>
> ---
>   meta/recipes-core/musl/libucontext_1.3.2.bb | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/meta/recipes-core/musl/libucontext_1.3.2.bb b/meta/recipes-core/musl/libucontext_1.3.2.bb
> index 2362cba5c8a2..92001bbe7bb5 100644
> --- a/meta/recipes-core/musl/libucontext_1.3.2.bb
> +++ b/meta/recipes-core/musl/libucontext_1.3.2.bb
> @@ -48,3 +48,6 @@ def map_kernel_arch(a, d):
>   
>   EXTRA_OEMESON = "-Dcpu=${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
>   inherit meson
> +
> +TARGET_CPPFLAGS:arm += "${@bb.utils.contains('TARGET_FPU', 'hard', '-DFORCE_HARD_FLOAT', '', d)}"
> +TARGET_CPPFLAGS:arm += "${@bb.utils.contains('TARGET_FPU', 'soft', '-DFORCE_SOFT_FLOAT', '', d)}"

The above doesn't += to TARGET_CPPFLAGS, it _replaces_ TARGET_CPPFLAGS.

This is probably not what you want.

What I've done in the past is:

ARM_TARGET_CPPFLAGS = ""
ARM_TARGET_CPPFLAGS:append:arm = "${@bb.utils.contains('TARGET_FPU', 'hard', '- 
DFORCE_HARD_FLOAT', '', d)}"
ARM_TARGET_CPPFLAGS:append:arm = "${@bb.utils.contains('TARGET_FPU', 'soft', ' 
-DFORCE_SOFT_FLOAT', '', d)}"

TARGET_CPPFLAGS .= "${ARM_TARGET_CPPFLAGS}"

> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#219524): https://lists.openembedded.org/g/openembedded-core/message/219524
> Mute This Topic: https://lists.openembedded.org/mt/113909237/3616948
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mark.hatle@kernel.crashing.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/recipes-core/musl/libucontext_1.3.2.bb b/meta/recipes-core/musl/libucontext_1.3.2.bb
index 2362cba5c8a2..92001bbe7bb5 100644
--- a/meta/recipes-core/musl/libucontext_1.3.2.bb
+++ b/meta/recipes-core/musl/libucontext_1.3.2.bb
@@ -48,3 +48,6 @@  def map_kernel_arch(a, d):
 
 EXTRA_OEMESON = "-Dcpu=${@map_kernel_arch(d.getVar('TARGET_ARCH'), d)}"
 inherit meson
+
+TARGET_CPPFLAGS:arm += "${@bb.utils.contains('TARGET_FPU', 'hard', '-DFORCE_HARD_FLOAT', '', d)}"
+TARGET_CPPFLAGS:arm += "${@bb.utils.contains('TARGET_FPU', 'soft', '-DFORCE_SOFT_FLOAT', '', d)}"