Discussion:
[musl] [PATCH] arm: respect both __ARM_ARCH_6KZ__ and __ARM_ARCH_6ZK__ macros
Andre McCurdy
2017-11-30 05:57:55 UTC
Permalink
6KZ is the correct form, 6ZK is a gcc specific historical typo.
Respect both for the widest compatibility with clang and older
versions of gcc.

Signed-off-by: Andre McCurdy <***@gmail.com>
---
arch/arm/atomic_arch.h | 2 +-
arch/arm/pthread_arch.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
index c5c56f8..d1d09d8 100644
--- a/arch/arm/atomic_arch.h
+++ b/arch/arm/atomic_arch.h
@@ -7,7 +7,7 @@
extern uintptr_t __attribute__((__visibility__("hidden")))
__a_cas_ptr, __a_barrier_ptr;

-#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \
+#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7

#define a_ll a_ll
diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h
index 197752e..6657e19 100644
--- a/arch/arm/pthread_arch.h
+++ b/arch/arm/pthread_arch.h
@@ -1,4 +1,4 @@
-#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \
+#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7

static inline pthread_t __pthread_self()
--
1.9.1
Rich Felker
2017-11-30 06:01:09 UTC
Permalink
Post by Andre McCurdy
6KZ is the correct form, 6ZK is a gcc specific historical typo.
Respect both for the widest compatibility with clang and older
versions of gcc.
Probably ok, but is it needed? Ideally we would just use
__ARM_ARCH>=N, but old gcc lacked __ARM_ARCH, thus necessitating all
the awful cases.

Rich
Post by Andre McCurdy
---
arch/arm/atomic_arch.h | 2 +-
arch/arm/pthread_arch.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/atomic_arch.h b/arch/arm/atomic_arch.h
index c5c56f8..d1d09d8 100644
--- a/arch/arm/atomic_arch.h
+++ b/arch/arm/atomic_arch.h
@@ -7,7 +7,7 @@
extern uintptr_t __attribute__((__visibility__("hidden")))
__a_cas_ptr, __a_barrier_ptr;
-#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \
+#if ((__ARM_ARCH_6__ || __ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
#define a_ll a_ll
diff --git a/arch/arm/pthread_arch.h b/arch/arm/pthread_arch.h
index 197752e..6657e19 100644
--- a/arch/arm/pthread_arch.h
+++ b/arch/arm/pthread_arch.h
@@ -1,4 +1,4 @@
-#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6ZK__) && !__thumb__) \
+#if ((__ARM_ARCH_6K__ || __ARM_ARCH_6KZ__ || __ARM_ARCH_6ZK__) && !__thumb__) \
|| __ARM_ARCH_7A__ || __ARM_ARCH_7R__ || __ARM_ARCH >= 7
static inline pthread_t __pthread_self()
--
1.9.1
Andre McCurdy
2017-11-30 07:20:48 UTC
Permalink
Post by Rich Felker
Post by Andre McCurdy
6KZ is the correct form, 6ZK is a gcc specific historical typo.
Respect both for the widest compatibility with clang and older
versions of gcc.
Probably ok, but is it needed?
As far as I know, __ARM_ARCH_6ZK__ is gcc specific and clang only ever
defines __ARM_ARCH_6KZ__. Older versions of gcc only define
__ARM_ARCH_6ZK__ and newer versions of gcc define both
__ARM_ARCH_6KZ__ and __ARM_ARCH_6ZK__.
Post by Rich Felker
Ideally we would just use
__ARM_ARCH>=N, but old gcc lacked __ARM_ARCH, thus necessitating all
the awful cases.
In atomic_arch.h, replacing the current ARMv6 tests with __ARM_ARCH >=
6 would be OK (if we could rely on __ARM_ARCH).

For pthread_arch.h, there are ARMv6 cores which lack the c13
coprocessor thread and process ID registers so __ARM_ARCH >= 6
wouldn't be fine grained enough.
Rich Felker
2017-11-30 16:08:30 UTC
Permalink
Post by Andre McCurdy
Post by Rich Felker
Post by Andre McCurdy
6KZ is the correct form, 6ZK is a gcc specific historical typo.
Respect both for the widest compatibility with clang and older
versions of gcc.
Probably ok, but is it needed?
As far as I know, __ARM_ARCH_6ZK__ is gcc specific and clang only ever
defines __ARM_ARCH_6KZ__. Older versions of gcc only define
__ARM_ARCH_6ZK__ and newer versions of gcc define both
__ARM_ARCH_6KZ__ and __ARM_ARCH_6ZK__.
Post by Rich Felker
Ideally we would just use
__ARM_ARCH>=N, but old gcc lacked __ARM_ARCH, thus necessitating all
the awful cases.
In atomic_arch.h, replacing the current ARMv6 tests with __ARM_ARCH >=
6 would be OK (if we could rely on __ARM_ARCH).
For pthread_arch.h, there are ARMv6 cores which lack the c13
coprocessor thread and process ID registers so __ARM_ARCH >= 6
wouldn't be fine grained enough.
I see. That's the core issue here -- that it's needed to choose the
right (or at least optimal) thread pointer access method for v6 vs
v6kz.

Rich

Loading...