Skip to contentSkip to conversation

parisc: Show error if wrong 32/64-bit compiler is being used

PATCH New Helge Deller 1 participant 1 message Feb 13, 2022

Subsystems (2)
lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 parisc: Show error if wrong 32/64-bit compiler is being used

It happens quite often that people use the wrong compiler to build the kernel:

make ARCH=parisc -> builds the 32-bit kernel
make ARCH=parisc64 -> builds the 64-bit kernel

This patch adds a sanity check which errors out with an instruction how use the correct ARCH= option.

---
 arch/parisc/include/asm/bitops.h | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/parisc/include/asm/bitops.h +8 -0
index 0ec9cfc5131f..56ffd260c669 100644
@@ -12,6 +12,14 @@
 #include <asm/barrier.h>
 #include <linux/atomic.h>
 
+/* compiler build environment sanity checks: */
+#if !defined(CONFIG_64BIT) && defined(__LP64__)
+#error "Please use 'ARCH=parisc' to build the 32-bit kernel."
+#endif
+#if defined(CONFIG_64BIT) && !defined(__LP64__)
+#error "Please use 'ARCH=parisc64' to build the 64-bit kernel."
+#endif
+
 /* See http://marc.theaimsgroup.com/?t=108826637900003 for discussion
  * on use of volatile and __*_bit() (set/clear/change):
  *	*_bit() want use of volatile.

--
2.34.1