From: Helge Deller <deller@xxxxxx> commit b160628e9ebcdc85d0db9d7f423c26b3c7c179d0 upstream. 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. Signed-off-by: Helge Deller <deller@xxxxxx> Cc: stable@xxxxxxxxxxxxxxx # v5.15+ Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/parisc/include/asm/bitops.h | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/arch/parisc/include/asm/bitops.h +++ b/arch/parisc/include/asm/bitops.h @@ -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. Patches currently in stable-queue which might be from deller@xxxxxx are queue-5.15/parisc-show-error-if-wrong-32-64-bit-compiler-is-being-used.patch queue-5.15/serial-parisc-gsc-fix-build-when-iosapic-is-not-set.patch queue-5.15/parisc-drop-__init-from-map_pages-declaration.patch queue-5.15/parisc-fix-data-tlb-miss-in-sba_unmap_sg.patch queue-5.15/parisc-fix-sglist-access-in-ccio-dma.c.patch queue-5.15/parisc-add-ioread64_lo_hi-and-iowrite64_lo_hi.patch