[PATCH v6 05/19] arm64:uapi: set __BITS_PER_LONG correctly for ILP32 and LP64

Catalin Marinas catalin.marinas at arm.com
Thu Dec 3 03:31:58 PST 2015


On Wed, Nov 18, 2015 at 12:16:45AM +0300, Yury Norov wrote:
> diff --git a/arch/arm64/include/uapi/asm/bitsperlong.h b/arch/arm64/include/uapi/asm/bitsperlong.h
> index fce9c29..4265243 100644
> --- a/arch/arm64/include/uapi/asm/bitsperlong.h
> +++ b/arch/arm64/include/uapi/asm/bitsperlong.h
> @@ -16,7 +16,14 @@
>  #ifndef __ASM_BITSPERLONG_H
>  #define __ASM_BITSPERLONG_H
>  
> -#define __BITS_PER_LONG 64
> +#if defined(__LP64__)
> +/* Assuming __LP64__ will be defined for native ELF64's and not for ILP32. */
> +#  define __BITS_PER_LONG 64
> +#elif defined(__ILP32__)
> +#  define __BITS_PER_LONG 32
> +#else
> +#  error "Neither LP64 nor ILP32: unsupported ABI in asm/bitsperlong.h"
> +#endif

Quick question: IIRC, earlier aarch64 gcc versions did not generate
__ILP32__ when -mabi=ilp32, they only removed __LP64__. When did the
change happen? Could we assume that all compiler versions used to
generate ILP32 would define this?

-- 
Catalin



More information about the linux-arm-kernel mailing list