* Build failure on ARM <5
@ 2017-10-20 19:04 Reiner Herrmann
2017-10-20 19:36 ` Szabolcs Nagy
0 siblings, 1 reply; 4+ messages in thread
From: Reiner Herrmann @ 2017-10-20 19:04 UTC (permalink / raw)
To: musl
[-- Attachment #1.1: Type: text/plain, Size: 311 bytes --]
Hi,
musl 1.1.17 fails to build [1] on arm versions <5 because
of an unsupported clz instruction.
The attached patch by Adrian Bunk [2] fixes this issue.
Kind regards,
Reiner
[1] https://buildd.debian.org/status/fetch.php?pkg=musl&arch=armel&ver=1.1.17-1&stamp=1508450839
[2] https://bugs.debian.org/879190
[-- Attachment #1.2: 0001-CLZ-is-only-available-with-ARM-5.patch --]
[-- Type: text/x-diff, Size: 703 bytes --]
From 1e98ea50a49712931c482ca490a0ca38e0501602 Mon Sep 17 00:00:00 2001
From: Adrian Bunk <bunk@debian.org>
Date: Fri, 20 Oct 2017 20:57:23 +0200
Subject: [PATCH] CLZ is only available with ARM >= 5
---
arch/arm/atomic_arch.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
index a121010f..c5c56f81 100644
--- a/arch/arm/atomic_arch.h
+++ b/arch/arm/atomic_arch.h
@@ -82,9 +82,13 @@ static inline void a_crash()
: : : "memory");
}
+#if __ARM_ARCH >= 5
+
#define a_clz_32 a_clz_32
static inline int a_clz_32(uint32_t x)
{
__asm__ ("clz %0, %1" : "=r"(x) : "r"(x));
return x;
}
+
+#endif
--
2.15.0.rc1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Build failure on ARM <5
2017-10-20 19:04 Build failure on ARM <5 Reiner Herrmann
@ 2017-10-20 19:36 ` Szabolcs Nagy
2017-10-20 21:26 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: Szabolcs Nagy @ 2017-10-20 19:36 UTC (permalink / raw)
To: musl
* Reiner Herrmann <reiner@reiner-h.de> [2017-10-20 21:04:00 +0200]:
> Hi,
>
> musl 1.1.17 fails to build [1] on arm versions <5 because
> of an unsupported clz instruction.
> The attached patch by Adrian Bunk [2] fixes this issue.
>
this is my bug sorry,
> diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
> index a121010f..c5c56f81 100644
> --- a/arch/arm/atomic_arch.h
> +++ b/arch/arm/atomic_arch.h
> @@ -82,9 +82,13 @@ static inline void a_crash()
> : : : "memory");
> }
>
> +#if __ARM_ARCH >= 5
> +
this is not enough: v5t and v6 only supports clz in arm mode
v6t2 and v7 supports it in thumb mode too.
i think we should either check for >= 7 conservatively or check
__ARM_FEATURE_CLZ which is defined in
https://developer.arm.com/docs/ihi0053/b/arm-c-language-extensions-release-11
> #define a_clz_32 a_clz_32
> static inline int a_clz_32(uint32_t x)
> {
> __asm__ ("clz %0, %1" : "=r"(x) : "r"(x));
> return x;
> }
> +
> +#endif
> --
> 2.15.0.rc1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Build failure on ARM <5
2017-10-20 19:36 ` Szabolcs Nagy
@ 2017-10-20 21:26 ` Rich Felker
2017-10-25 16:56 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2017-10-20 21:26 UTC (permalink / raw)
To: musl
On Fri, Oct 20, 2017 at 09:36:45PM +0200, Szabolcs Nagy wrote:
> * Reiner Herrmann <reiner@reiner-h.de> [2017-10-20 21:04:00 +0200]:
> > Hi,
> >
> > musl 1.1.17 fails to build [1] on arm versions <5 because
> > of an unsupported clz instruction.
> > The attached patch by Adrian Bunk [2] fixes this issue.
> >
>
> this is my bug sorry,
>
> > diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
> > index a121010f..c5c56f81 100644
> > --- a/arch/arm/atomic_arch.h
> > +++ b/arch/arm/atomic_arch.h
> > @@ -82,9 +82,13 @@ static inline void a_crash()
> > : : : "memory");
> > }
> >
> > +#if __ARM_ARCH >= 5
> > +
>
> this is not enough: v5t and v6 only supports clz in arm mode
> v6t2 and v7 supports it in thumb mode too.
I don't think this matters yet because thumb1 is not supported at all.
If we support it in the future it will matter, though.
Rich
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Build failure on ARM <5
2017-10-20 21:26 ` Rich Felker
@ 2017-10-25 16:56 ` Rich Felker
0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2017-10-25 16:56 UTC (permalink / raw)
To: musl
On Fri, Oct 20, 2017 at 05:26:14PM -0400, Rich Felker wrote:
> On Fri, Oct 20, 2017 at 09:36:45PM +0200, Szabolcs Nagy wrote:
> > * Reiner Herrmann <reiner@reiner-h.de> [2017-10-20 21:04:00 +0200]:
> > > Hi,
> > >
> > > musl 1.1.17 fails to build [1] on arm versions <5 because
> > > of an unsupported clz instruction.
> > > The attached patch by Adrian Bunk [2] fixes this issue.
> > >
> >
> > this is my bug sorry,
> >
> > > diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
> > > index a121010f..c5c56f81 100644
> > > --- a/arch/arm/atomic_arch.h
> > > +++ b/arch/arm/atomic_arch.h
> > > @@ -82,9 +82,13 @@ static inline void a_crash()
> > > : : : "memory");
> > > }
> > >
> > > +#if __ARM_ARCH >= 5
> > > +
> >
> > this is not enough: v5t and v6 only supports clz in arm mode
> > v6t2 and v7 supports it in thumb mode too.
>
> I don't think this matters yet because thumb1 is not supported at all.
> If we support it in the future it will matter, though.
After discussion on #musl, committed with additional notes on the
regression and limitations of the fix, and credit to the patch author.
Thanks.
Rich
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-25 16:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-20 19:04 Build failure on ARM <5 Reiner Herrmann
2017-10-20 19:36 ` Szabolcs Nagy
2017-10-20 21:26 ` Rich Felker
2017-10-25 16:56 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).