On 06/12/2014 11:47 AM, Andy Lutomirski wrote:
>  
> +#include <asm/bitsperlong.h>
> +

This isn't portable in any way.  This is probably not the right way to
do this.

The portable way to do this would be something like:

#include <limits.h>

#if ULONG_MAX > 0xffffffffUL
# define ELF_BITS 64
#else
# define ELF_BITS 32
#endif

There is also the option of looking for either __LP64__ or __ILP32__
which isn't 100% portable but works with all newer versions of gcc:

#ifndef ELF_BITS
# ifdef __LP64__
#  define ELF_BITS 64
# elif defined(__ILP32__)
#  define ELF_BITS 32
# else
#  error "Unknown size, please define ELF_BITS"
# endif
#endif

... or something like that.

        -hpa

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to