[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <539A071B.2080101@zytor.com>
Date: Thu, 12 Jun 2014 13:01:31 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Andy Lutomirski <luto@...capital.net>,
Kui Zhang <kuizhang@...il.com>
CC: x86@...nel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Stefani Seibold <stefani@...bold.net>
Subject: Re: [PATCH 2/3] doc,vdso: Make vDSO examples more portable
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists