Skip to contentSkip to conversation

arm64/neon: Disable -Wincompatible-pointer-types when building with Clang

PATCH In review Nathan Chancellor 6 participants 11 messages Feb 15, 2019 – Feb 19, 2019 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/neon: Disable -Wincompatible-pointer-types when building with Clang

After commit cc9f8349cb33 ("arm64: crypto: add NEON accelerated XOR implementation"), Clang builds for arm64 started failing with the following error message.

arch/arm64/lib/xor-neon.c:58:28: error: incompatible pointer types assigning to 'const unsigned long *' from 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]

                v3 = veorq_u64(vld1q_u64(dp1 +  6), vld1q_u64(dp2 + 6));
                                         ^~~~~~~~
/usr/lib/llvm-9/lib/clang/9.0.0/include/arm_neon.h:7538:47: note:
expanded from macro 'vld1q_u64'
  __ret = (uint64x2_t) __builtin_neon_vld1q_v(__p0, 51); \
                                              ^~~~

There has been quite a bit of debate and triage that has gone into figuring out what the proper fix is, viewable at the link below, which is still ongoing. Ard suggested disabling this warning with Clang with a pragma so no neon code will have this type of error. While this is not at all an ideal solution, this build error is the only thing preventing KernelCI from having successful arm64 defconfig and allmodconfig builds on linux-next. Getting continuous integration running is more important so new warnings/errors or boot failures can be caught and fixed quickly.

---
 arch/arm64/include/asm/neon-intrinsics.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/include/asm/neon-intrinsics.h +4 -0
index 2ba6c6b9541f..71abfc7612b2 100644
@@ -36,4 +36,8 @@
 #include <arm_neon.h>
 #endif
 
+#ifdef CONFIG_CC_IS_CLANG
+#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
+#endif
+
 #endif /* __ASM_NEON_INTRINSICS_H */
Signature · 1 line
2.21.0.rc1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Nathan Chancellor

After commit cc9f8349cb33 ("arm64: crypto: add NEON accelerated XOR implementation"), Clang builds for arm64 started failing with the following error message.

#2 lore raw
In reply to Nathan Chancellor
Quoted 35 lines · Nathan Chancellor

After commit cc9f8349cb33 ("arm64: crypto: add NEON accelerated XOR implementation"), Clang builds for arm64 started failing with the following error message.

arch/arm64/lib/xor-neon.c:58:28: error: incompatible pointer types assigning to 'const unsigned long *' from 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]

                v3 = veorq_u64(vld1q_u64(dp1 +  6), vld1q_u64(dp2 + 6));
                                         ^~~~~~~~
/usr/lib/llvm-9/lib/clang/9.0.0/include/arm_neon.h:7538:47: note:
expanded from macro 'vld1q_u64'
  __ret = (uint64x2_t) __builtin_neon_vld1q_v(__p0, 51); \
                                              ^~~~

There has been quite a bit of debate and triage that has gone into figuring out what the proper fix is, viewable at the link below, which is still ongoing. Ard suggested disabling this warning with Clang with a pragma so no neon code will have this type of error. While this is not at all an ideal solution, this build error is the only thing preventing KernelCI from having successful arm64 defconfig and allmodconfig builds on linux-next. Getting continuous integration running is more important so new warnings/errors or boot failures can be caught and fixed quickly.

---
 arch/arm64/include/asm/neon-intrinsics.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/include/asm/neon-intrinsics.h +0 -0
index 2ba6c6b9541f..71abfc7612b2 100644

arch/arm64/include/asm/neon-intrinsics.h line 41

Quoted 6 lines
arch/arm64/include/asm/neon-intrinsics.h +3 -0
@@ -36,4 +36,8 @@
 #include <arm_neon.h>
 #endif
 
+#ifdef CONFIG_CC_IS_CLANG
+#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
+#endif

I'd like Ard's ack on this one, please.

Will

#3 lore raw
Quoted 40 lines · Will Deacon
Quoted 38 lines · Nathan Chancellor

After commit cc9f8349cb33 ("arm64: crypto: add NEON accelerated XOR implementation"), Clang builds for arm64 started failing with the following error message.

arch/arm64/lib/xor-neon.c:58:28: error: incompatible pointer types assigning to 'const unsigned long *' from 'uint64_t *' (aka 'unsigned long long *') [-Werror,-Wincompatible-pointer-types]

                v3 = veorq_u64(vld1q_u64(dp1 +  6), vld1q_u64(dp2 + 6));
                                         ^~~~~~~~
/usr/lib/llvm-9/lib/clang/9.0.0/include/arm_neon.h:7538:47: note:
expanded from macro 'vld1q_u64'
  __ret = (uint64x2_t) __builtin_neon_vld1q_v(__p0, 51); \
                                              ^~~~

There has been quite a bit of debate and triage that has gone into figuring out what the proper fix is, viewable at the link below, which is still ongoing. Ard suggested disabling this warning with Clang with a pragma so no neon code will have this type of error. While this is not at all an ideal solution, this build error is the only thing preventing KernelCI from having successful arm64 defconfig and allmodconfig builds on linux-next. Getting continuous integration running is more important so new warnings/errors or boot failures can be caught and fixed quickly.

---
 arch/arm64/include/asm/neon-intrinsics.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/include/asm/neon-intrinsics.h +0 -0
index 2ba6c6b9541f..71abfc7612b2 100644
@@ -36,4 +36,8 @@
 #include <arm_neon.h>
 #endif
 
Quoted 6 lines

arch/arm64/include/asm/neon-intrinsics.h line 41

Quoted 3 lines
arch/arm64/include/asm/neon-intrinsics.h +3 -0
+#ifdef CONFIG_CC_IS_CLANG
+#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
+#endif

I'd like Ard's ack on this one, please.

Provided that we stop sending Clang enablement patches to -stable:

#4 lore raw
Quoted 1 line · Ard Biesheuvel

Provided that we stop sending Clang enablement patches to -stable:

What does that mean? We're trying to provide clang support back to 4.4 LTS branches. (so 4.4, 4.9, 4.14, 4.19).

Signature · 2 lines
Thanks,
~Nick Desaulniers
#5 lore raw
Quoted 7 lines · Nick Desaulniers
Quoted 1 line · Ard Biesheuvel

Provided that we stop sending Clang enablement patches to -stable:

What does that mean? We're trying to provide clang support back to 4.4 LTS branches. (so 4.4, 4.9, 4.14, 4.19).

I understand that is what you are attempting, but that does not mean it /belongs/ in -stable.

There are rules for stable, and people that track stable kernels (such as the distros) should be able to rely on us to only backport bug fixes, not linker script changes and other updates that fix issues that did not exist when those kernels were released.

It is unclear to me how these clang changes benefit those users.

#6 lore raw
Quoted 13 lines · Ard Biesheuvel
Quoted 7 lines · Nick Desaulniers
Quoted 1 line · Ard Biesheuvel

Provided that we stop sending Clang enablement patches to -stable:

What does that mean? We're trying to provide clang support back to 4.4 LTS branches. (so 4.4, 4.9, 4.14, 4.19).

I understand that is what you are attempting, but that does not mean it /belongs/ in -stable.

Quoted 6 lines

There are rules for stable, and people that track stable kernels (such as the distros) should be able to rely on us to only backport bug fixes, not linker script changes and other updates that fix issues that did not exist when those kernels were released.

It is unclear to me how these clang changes benefit those users.

If you're referring to
https://www.spinics.net/lists/stable/msg278381.html, that's fair (I think those were helpful for LLD support on arm64).

Why didn't you speak up then? Why is this coming up now?

Signature · 2 lines
Thanks,
~Nick Desaulniers
#7 lore raw
Quoted 21 lines · Nick Desaulniers
Quoted 18 lines · Ard Biesheuvel
Quoted 7 lines · Nick Desaulniers
Quoted 1 line · Ard Biesheuvel

Provided that we stop sending Clang enablement patches to -stable:

What does that mean? We're trying to provide clang support back to 4.4 LTS branches. (so 4.4, 4.9, 4.14, 4.19).

I understand that is what you are attempting, but that does not mean it /belongs/ in -stable.

There are rules for stable, and people that track stable kernels (such as the distros) should be able to rely on us to only backport bug fixes, not linker script changes and other updates that fix issues that did not exist when those kernels were released.

Quoted 7 lines
Quoted 1 line

It is unclear to me how these clang changes benefit those users.

If you're referring to
https://www.spinics.net/lists/stable/msg278381.html, that's fair (I think those were helpful for LLD support on arm64).

Why didn't you speak up then? Why is this coming up now?

That is just one example, and I failed to realise it at the time.

I think the Clang/LLVM work you are doing is very important, but I simply don't think any of it belongs in -stable kernels.

#8 lore raw
Quoted 29 lines · Ard Biesheuvel
Quoted 27 lines · Nick Desaulniers
Quoted 13 lines · Ard Biesheuvel
Quoted 7 lines · Nick Desaulniers
Quoted 1 line · Ard Biesheuvel

Provided that we stop sending Clang enablement patches to -stable:

What does that mean? We're trying to provide clang support back to 4.4 LTS branches. (so 4.4, 4.9, 4.14, 4.19).

I understand that is what you are attempting, but that does not mean it /belongs/ in -stable.

Quoted 6 lines

There are rules for stable, and people that track stable kernels (such as the distros) should be able to rely on us to only backport bug fixes, not linker script changes and other updates that fix issues that did not exist when those kernels were released.

It is unclear to me how these clang changes benefit those users.

If you're referring to
https://www.spinics.net/lists/stable/msg278381.html, that's fair (I think those were helpful for LLD support on arm64).

Quoted 6 lines
Quoted 1 line

Why didn't you speak up then? Why is this coming up now?

That is just one example, and I failed to realise it at the time.

I think the Clang/LLVM work you are doing is very important, but I simply don't think any of it belongs in -stable kernels.

OK, to clarify my position:

I have no problem whatsoever with taking this patch into v5.x, so

but going forward, I will push back on -stable backports for Clang/LLVM specific changes, since they are obviously in violation of the stable kernel rules.

#9 lore raw
Quoted 39 lines · Ard Biesheuvel
Quoted 29 lines · Ard Biesheuvel
Quoted 27 lines · Nick Desaulniers
Quoted 13 lines · Ard Biesheuvel
Quoted 7 lines · Nick Desaulniers
Quoted 1 line · Ard Biesheuvel

Provided that we stop sending Clang enablement patches to -stable:

What does that mean? We're trying to provide clang support back to 4.4 LTS branches. (so 4.4, 4.9, 4.14, 4.19).

I understand that is what you are attempting, but that does not mean it /belongs/ in -stable.

Quoted 6 lines

There are rules for stable, and people that track stable kernels (such as the distros) should be able to rely on us to only backport bug fixes, not linker script changes and other updates that fix issues that did not exist when those kernels were released.

It is unclear to me how these clang changes benefit those users.

If you're referring to
https://www.spinics.net/lists/stable/msg278381.html, that's fair (I think those were helpful for LLD support on arm64).

Quoted 6 lines
Quoted 1 line

Why didn't you speak up then? Why is this coming up now?

That is just one example, and I failed to realise it at the time.

I think the Clang/LLVM work you are doing is very important, but I simply don't think any of it belongs in -stable kernels.

OK, to clarify my position:

Quoted 7 lines

I have no problem whatsoever with taking this patch into v5.x, so

but going forward, I will push back on -stable backports for Clang/LLVM specific changes, since they are obviously in violation of the stable kernel rules.

Getting older kernels to build/run properly on newer compilers is just a part of life for the stable trees. If you note, we have done a lot of gcc7, then gcc8, and clang patches backported over the years in order to make it possible for people (like me and my testing infrastructure at the least) to keep building these old kernels on newer systems.

So while it's not part of the "documented" rules, I do take this type of change, as it does help out a huge population of users and testers.

thanks,

greg k-h

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#10 lore raw
Quoted 49 lines · Greg KH
Quoted 39 lines · Ard Biesheuvel
Quoted 29 lines · Ard Biesheuvel
Quoted 27 lines · Nick Desaulniers
Quoted 13 lines · Ard Biesheuvel
Quoted 7 lines · Nick Desaulniers
Quoted 1 line · Ard Biesheuvel

Provided that we stop sending Clang enablement patches to -stable:

What does that mean? We're trying to provide clang support back to 4.4 LTS branches. (so 4.4, 4.9, 4.14, 4.19).

I understand that is what you are attempting, but that does not mean it /belongs/ in -stable.

Quoted 6 lines

There are rules for stable, and people that track stable kernels (such as the distros) should be able to rely on us to only backport bug fixes, not linker script changes and other updates that fix issues that did not exist when those kernels were released.

It is unclear to me how these clang changes benefit those users.

If you're referring to
https://www.spinics.net/lists/stable/msg278381.html, that's fair (I think those were helpful for LLD support on arm64).

Quoted 6 lines
Quoted 1 line

Why didn't you speak up then? Why is this coming up now?

That is just one example, and I failed to realise it at the time.

I think the Clang/LLVM work you are doing is very important, but I simply don't think any of it belongs in -stable kernels.

OK, to clarify my position:

Quoted 7 lines

I have no problem whatsoever with taking this patch into v5.x, so

but going forward, I will push back on -stable backports for Clang/LLVM specific changes, since they are obviously in violation of the stable kernel rules.

Quoted 9 lines

Getting older kernels to build/run properly on newer compilers is just a part of life for the stable trees. If you note, we have done a lot of gcc7, then gcc8, and clang patches backported over the years in order to make it possible for people (like me and my testing infrastructure at the least) to keep building these old kernels on newer systems.

So while it's not part of the "documented" rules, I do take this type of change, as it does help out a huge population of users and testers.

That doesn't make a lot of sense to me, but that is the common practice, then I won't object any longer.