Messages in this thread | | | Date | Thu, 12 Jun 2014 13:01:31 -0700 | From | "H. Peter Anvin" <> | 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
| |