On Mon, Aug 6, 2018 at 6:17 PM, Nadav Har'El <n...@scylladb.com> wrote:

>
> Oh, I found the problem. It is OSv's bug, on the way we define uint64_t
> (we define it ourselves, we don't use gcc's headers):
> In:
>
> include/api/x64/bits/alltypes.h.sh:TYPEDEF unsigned long      uint64_t;
>
> This is incorrect for -m32, where "unsigned long" is just 32 bits, not 64
> bits!
>
> I think this should either be changed to "unsigned long long" (but need to
> check the implications...) or probably better - use an #ifdef:
>
> #if __WORDSIZE == 64
> typedef signed long int int64_t;
> typedef unsigned long int uint64_t;
> #else
> typedef signed long long int __int64_t;
> typedef unsigned long long int __uint64_t;
> #endif
>
> then you wouldn't need to manually change the existing use of uint64_t.
>

I thought __WORDSIZE was a gcc builtin, but it isn't... So we can use the
builtin __x86_64__ :

#ifdef __x86_64__
typedef signed long int int64_t;
typedef unsigned long int uint64_t;
#else
typedef signed long long int int64_t;
typedef unsigned long long int uint64_t;
#endif

Also need to define the __* variants of the same type (they should just be
aliases to the ones without the __, I don't know why we didn't do that).

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to