* Re: Userspace compiler support of "long long"
[not found] ` <20070627173240.GR1094@stusta.de>
@ 2007-06-27 22:30 ` Kyle Moffett
2007-06-27 22:57 ` Randy Dunlap
` (3 more replies)
0 siblings, 4 replies; 16+ messages in thread
From: Kyle Moffett @ 2007-06-27 22:30 UTC (permalink / raw)
To: Adrian Bunk; +Cc: LKML Kernel, David Woodhouse, david, linux-arch
On Jun 27, 2007, at 13:32:40, Adrian Bunk wrote:
> AFAIR the Intel compiler claims to be gcc.
>
> But these are by far not the only C compilers under Linux, and the
> more important points are:
>
> Is there any userspace Linux compiler that does not support "long
> long"?
Don't know, but I'd guess not.
> If yes, is there any other way to tell that something is a 64bit
> int on 32bit architectures?
Not that I know of. Probably the straight #else conditional is OK.
We should also merge up the types since *EVERY* linux architecture
has these same types:
typedef signed char __s8;
typedef unsigned char __u8;
typedef signed short __s16;
typedef unsigned short __u16;
typedef signed int __s32;
typedef unsigned int __u32;
Then all 64-bit archs have:
typedef signed long __s64;
typedef unsigned long __u64;
While all 32-bit archs have:
typedef signed long long __s64;
typedef unsigned long long __u64;
The only trick is if you care about building 32-bit compat code using
64-bit linux kernel headers. In that case we should probably just
make all archs use "long long" for their 64-bit integers, unless
there's some platform I'm not remembering where "long long" is 128-
bits or bigger. The other benefit is that people could then just use
the printf format "%llu" for 64-bit integers instead of having to
conditionalize it all over the place.
I'm working on a patch now.
Cheers,
Kyle Moffett
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-27 22:30 ` Userspace compiler support of "long long" Kyle Moffett
@ 2007-06-27 22:57 ` Randy Dunlap
2007-06-27 23:16 ` Randy Dunlap
2007-06-28 0:30 ` Andi Kleen
` (2 subsequent siblings)
3 siblings, 1 reply; 16+ messages in thread
From: Randy Dunlap @ 2007-06-27 22:57 UTC (permalink / raw)
To: Kyle Moffett; +Cc: Adrian Bunk, LKML Kernel, David Woodhouse, david, linux-arch
On Wed, 27 Jun 2007 18:30:52 -0400 Kyle Moffett wrote:
> On Jun 27, 2007, at 13:32:40, Adrian Bunk wrote:
> > AFAIR the Intel compiler claims to be gcc.
> >
> > But these are by far not the only C compilers under Linux, and the
> > more important points are:
> >
> > Is there any userspace Linux compiler that does not support "long
> > long"?
>
> Don't know, but I'd guess not.
>
>
> > If yes, is there any other way to tell that something is a 64bit
> > int on 32bit architectures?
>
> Not that I know of. Probably the straight #else conditional is OK.
> We should also merge up the types since *EVERY* linux architecture
> has these same types:
>
> typedef signed char __s8;
> typedef unsigned char __u8;
> typedef signed short __s16;
> typedef unsigned short __u16;
> typedef signed int __s32;
> typedef unsigned int __u32;
>
> Then all 64-bit archs have:
> typedef signed long __s64;
> typedef unsigned long __u64;
>
> While all 32-bit archs have:
> typedef signed long long __s64;
> typedef unsigned long long __u64;
>
> The only trick is if you care about building 32-bit compat code using
> 64-bit linux kernel headers. In that case we should probably just
> make all archs use "long long" for their 64-bit integers, unless
> there's some platform I'm not remembering where "long long" is 128-
> bits or bigger. The other benefit is that people could then just use
> the printf format "%llu" for 64-bit integers instead of having to
> conditionalize it all over the place.
>
> I'm working on a patch now.
LDD3 ch. 11 says that long on Sparc64 is 32 bits.
Same for "ppc" (don't know which power* arch. they mean by that).
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-27 22:57 ` Randy Dunlap
@ 2007-06-27 23:16 ` Randy Dunlap
2007-06-28 2:12 ` Geert Uytterhoeven
2007-06-28 3:06 ` Kyle McMartin
0 siblings, 2 replies; 16+ messages in thread
From: Randy Dunlap @ 2007-06-27 23:16 UTC (permalink / raw)
To: Kyle Moffett; +Cc: Adrian Bunk, LKML Kernel, David Woodhouse, david, linux-arch
On Wed, 27 Jun 2007 15:57:15 -0700 Randy Dunlap wrote:
> On Wed, 27 Jun 2007 18:30:52 -0400 Kyle Moffett wrote:
>
> > On Jun 27, 2007, at 13:32:40, Adrian Bunk wrote:
> > > AFAIR the Intel compiler claims to be gcc.
> > >
> > > But these are by far not the only C compilers under Linux, and the
> > > more important points are:
> > >
> > > Is there any userspace Linux compiler that does not support "long
> > > long"?
> >
> > Don't know, but I'd guess not.
> >
> >
> > > If yes, is there any other way to tell that something is a 64bit
> > > int on 32bit architectures?
> >
> > Not that I know of. Probably the straight #else conditional is OK.
> > We should also merge up the types since *EVERY* linux architecture
> > has these same types:
> >
> > typedef signed char __s8;
> > typedef unsigned char __u8;
> > typedef signed short __s16;
> > typedef unsigned short __u16;
> > typedef signed int __s32;
> > typedef unsigned int __u32;
> >
> > Then all 64-bit archs have:
> > typedef signed long __s64;
> > typedef unsigned long __u64;
> >
> > While all 32-bit archs have:
> > typedef signed long long __s64;
> > typedef unsigned long long __u64;
> >
> > The only trick is if you care about building 32-bit compat code using
> > 64-bit linux kernel headers. In that case we should probably just
> > make all archs use "long long" for their 64-bit integers, unless
> > there's some platform I'm not remembering where "long long" is 128-
> > bits or bigger. The other benefit is that people could then just use
> > the printf format "%llu" for 64-bit integers instead of having to
> > conditionalize it all over the place.
> >
> > I'm working on a patch now.
>
> LDD3 ch. 11 says that long on Sparc64 is 32 bits.
> Same for "ppc" (don't know which power* arch. they mean by that).
Hm, I suppose that table only applies to userspace, not kernel...
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-27 22:30 ` Userspace compiler support of "long long" Kyle Moffett
2007-06-27 22:57 ` Randy Dunlap
@ 2007-06-28 0:30 ` Andi Kleen
2007-06-28 11:42 ` Kyle Moffett
2007-06-28 3:57 ` Matthew Wilcox
2007-06-28 4:03 ` H. Peter Anvin
3 siblings, 1 reply; 16+ messages in thread
From: Andi Kleen @ 2007-06-28 0:30 UTC (permalink / raw)
To: Kyle Moffett; +Cc: Adrian Bunk, LKML Kernel, David Woodhouse, david, linux-arch
On Thursday 28 June 2007 00:30:52 Kyle Moffett wrote:
> On Jun 27, 2007, at 13:32:40, Adrian Bunk wrote:
> > AFAIR the Intel compiler claims to be gcc.
> >
> > But these are by far not the only C compilers under Linux, and the
> > more important points are:
> >
> > Is there any userspace Linux compiler that does not support "long
> > long"?
>
> Don't know, but I'd guess not.
Tendra C and probably lcc. I would guess tinycc too.
> The only trick is if you care about building 32-bit compat code using
> 64-bit linux kernel headers. In that case we should probably just
> make all archs use "long long" for their 64-bit integers, unless
> there's some platform I'm not remembering where "long long" is 128-
> bits or bigger. The other benefit is that people could then just use
> the printf format "%llu" for 64-bit integers instead of having to
> conditionalize it all over the place.
>
> I'm working on a patch now.
Changing this will give you a zillion warnings for printk formats.
-Andi
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-27 23:16 ` Randy Dunlap
@ 2007-06-28 2:12 ` Geert Uytterhoeven
2007-06-28 6:50 ` Jan Engelhardt
2007-06-28 3:06 ` Kyle McMartin
1 sibling, 1 reply; 16+ messages in thread
From: Geert Uytterhoeven @ 2007-06-28 2:12 UTC (permalink / raw)
To: Randy Dunlap
Cc: Kyle Moffett, Adrian Bunk, LKML Kernel, David Woodhouse, david,
linux-arch
On Wed, 27 Jun 2007, Randy Dunlap wrote:
> On Wed, 27 Jun 2007 15:57:15 -0700 Randy Dunlap wrote:
> > LDD3 ch. 11 says that long on Sparc64 is 32 bits.
> > Same for "ppc" (don't know which power* arch. they mean by that).
>
> Hm, I suppose that table only applies to userspace, not kernel...
32-bit userspace?
On 64-bit, `long' is 64-bit on all platforms supported by Linux.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-27 23:16 ` Randy Dunlap
2007-06-28 2:12 ` Geert Uytterhoeven
@ 2007-06-28 3:06 ` Kyle McMartin
1 sibling, 0 replies; 16+ messages in thread
From: Kyle McMartin @ 2007-06-28 3:06 UTC (permalink / raw)
To: Randy Dunlap
Cc: Kyle Moffett, Adrian Bunk, LKML Kernel, David Woodhouse, david,
linux-arch
On Wed, Jun 27, 2007 at 04:16:48PM -0700, Randy Dunlap wrote:
> > LDD3 ch. 11 says that long on Sparc64 is 32 bits.
> > Same for "ppc" (don't know which power* arch. they mean by that).
>
> Hm, I suppose that table only applies to userspace, not kernel...
>
Doing 64-bit Linux non-LP64 would be an interesting exercise in masochism...
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-27 22:30 ` Userspace compiler support of "long long" Kyle Moffett
2007-06-27 22:57 ` Randy Dunlap
2007-06-28 0:30 ` Andi Kleen
@ 2007-06-28 3:57 ` Matthew Wilcox
2007-06-28 11:53 ` Kyle Moffett
2007-06-28 4:03 ` H. Peter Anvin
3 siblings, 1 reply; 16+ messages in thread
From: Matthew Wilcox @ 2007-06-28 3:57 UTC (permalink / raw)
To: Kyle Moffett; +Cc: Adrian Bunk, LKML Kernel, David Woodhouse, david, linux-arch
On Wed, Jun 27, 2007 at 06:30:52PM -0400, Kyle Moffett wrote:
> Then all 64-bit archs have:
> typedef signed long __s64;
> typedef unsigned long __u64;
>
> While all 32-bit archs have:
> typedef signed long long __s64;
> typedef unsigned long long __u64;
include/asm-parisc/types.h:typedef unsigned long long __u64;
For both 32 and 64-bit.
include/asm-sh64/types.h:typedef unsigned long long __u64;
include/asm-x86_64/types.h:typedef unsigned long long __u64;
So that's three architectures that violate your first assertion.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-27 22:30 ` Userspace compiler support of "long long" Kyle Moffett
` (2 preceding siblings ...)
2007-06-28 3:57 ` Matthew Wilcox
@ 2007-06-28 4:03 ` H. Peter Anvin
3 siblings, 0 replies; 16+ messages in thread
From: H. Peter Anvin @ 2007-06-28 4:03 UTC (permalink / raw)
To: Kyle Moffett; +Cc: Adrian Bunk, LKML Kernel, David Woodhouse, david, linux-arch
Kyle Moffett wrote:
>>
> The only trick is if you care about building 32-bit compat code using
> 64-bit linux kernel headers. In that case we should probably just make
> all archs use "long long" for their 64-bit integers, unless there's some
> platform I'm not remembering where "long long" is 128-bits or bigger.
> The other benefit is that people could then just use the printf format
> "%llu" for 64-bit integers instead of having to conditionalize it all
> over the place.
>
No, you really don't want to do that, because then u64 != uint64_t on
those platforms.
-hpa
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 2:12 ` Geert Uytterhoeven
@ 2007-06-28 6:50 ` Jan Engelhardt
2007-06-28 11:34 ` Geert Uytterhoeven
0 siblings, 1 reply; 16+ messages in thread
From: Jan Engelhardt @ 2007-06-28 6:50 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Randy Dunlap, Kyle Moffett, Adrian Bunk, LKML Kernel,
David Woodhouse, david, linux-arch
On Jun 28 2007 04:12, Geert Uytterhoeven wrote:
>On Wed, 27 Jun 2007, Randy Dunlap wrote:
>> On Wed, 27 Jun 2007 15:57:15 -0700 Randy Dunlap wrote:
>> > LDD3 ch. 11 says that long on Sparc64 is 32 bits.
>> > Same for "ppc" (don't know which power* arch. they mean by that).
>>
>> Hm, I suppose that table only applies to userspace, not kernel...
>
>32-bit userspace?
>
>On 64-bit, `long' is 64-bit on all platforms supported by Linux.
All types are as wide as the compiler makes them.
Compiler short int long llong
Turbo C 16 16 32 -
GCC -m32 16 32 32 64
GCC -m64 16 32 64 64
Jan
--
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 6:50 ` Jan Engelhardt
@ 2007-06-28 11:34 ` Geert Uytterhoeven
2007-06-28 11:36 ` David Woodhouse
0 siblings, 1 reply; 16+ messages in thread
From: Geert Uytterhoeven @ 2007-06-28 11:34 UTC (permalink / raw)
To: Jan Engelhardt
Cc: Randy Dunlap, Kyle Moffett, Adrian Bunk, LKML Kernel,
David Woodhouse, david, linux-arch
On Thu, 28 Jun 2007, Jan Engelhardt wrote:
> On Jun 28 2007 04:12, Geert Uytterhoeven wrote:
> >On Wed, 27 Jun 2007, Randy Dunlap wrote:
> >> On Wed, 27 Jun 2007 15:57:15 -0700 Randy Dunlap wrote:
> >> > LDD3 ch. 11 says that long on Sparc64 is 32 bits.
> >> > Same for "ppc" (don't know which power* arch. they mean by that).
> >>
> >> Hm, I suppose that table only applies to userspace, not kernel...
> >
> >32-bit userspace?
> >
> >On 64-bit, `long' is 64-bit on all platforms supported by Linux.
>
> All types are as wide as the compiler makes them.
>
> Compiler short int long llong
> Turbo C 16 16 32 -
> GCC -m32 16 32 32 64
> GCC -m64 16 32 64 64
We do not support building Linux with Turbo C (or MS Visual C for Win64
P64).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 11:34 ` Geert Uytterhoeven
@ 2007-06-28 11:36 ` David Woodhouse
2007-06-28 12:20 ` Kyle Moffett
0 siblings, 1 reply; 16+ messages in thread
From: David Woodhouse @ 2007-06-28 11:36 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Jan Engelhardt, Randy Dunlap, Kyle Moffett, Adrian Bunk,
LKML Kernel, david, linux-arch
On Thu, 2007-06-28 at 13:34 +0200, Geert Uytterhoeven wrote:
> We do not support building Linux with Turbo C (or MS Visual C for
> Win64 P64).
We're talking about types which are exposed to userspace.
--
dwmw2
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 0:30 ` Andi Kleen
@ 2007-06-28 11:42 ` Kyle Moffett
0 siblings, 0 replies; 16+ messages in thread
From: Kyle Moffett @ 2007-06-28 11:42 UTC (permalink / raw)
To: Andi Kleen; +Cc: Adrian Bunk, LKML Kernel, David Woodhouse, david, linux-arch
On Jun 27, 2007, at 20:30:42, Andi Kleen wrote:
> On Thursday 28 June 2007 00:30:52 Kyle Moffett wrote:
>> The only trick is if you care about building 32-bit compat code
>> using 64-bit linux kernel headers. In that case we should
>> probably just make all archs use "long long" for their 64-bit
>> integers, unless there's some platform I'm not remembering where
>> "long long" is 128-bits or bigger. The other benefit is that
>> people could then just use the printf format "%llu" for 64-bit
>> integers instead of having to conditionalize it all over the place.
>>
>> I'm working on a patch now.
>
> Changing this will give you a zillion warnings for printk formats.
Why? If this were a problem then we'd be getting a zillion warnings
*now* from all the 32-bit archs (which already use "long long" for 64-
bit. This would actually make it _easier_ to get the printk formats
right, as you could always use %ull for 64-bit types without having
to cast for 64-bit platforms.
This is another way to get around the "build 32-bit-compat userspace
on 64-bit kernel headers" problem: It tells GCC to use the
"smallest" available type of the given size, which ends up being
exactly the types we use now. On the other hand, it only works for
GCC which sort of ruins most of the reason for changing the types in
the first place.
typedef signed __s8 __attribute__((__mode__(__QI__)));
typedef unsigned __u8 __attribute__((__mode__(__QI__)));
typedef signed __s16 __attribute__((__mode__(__HI__)));
typedef unsigned __u16 __attribute__((__mode__(__HI__)));
typedef signed __s32 __attribute__((__mode__(__SI__)));
typedef unsigned __u32 __attribute__((__mode__(__SI__)));
typedef signed __s64 __attribute__((__mode__(__DI__)));
typedef unsigned __u64 __attribute__((__mode__(__DI__)));
Cheers,
Kyle Moffett
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 3:57 ` Matthew Wilcox
@ 2007-06-28 11:53 ` Kyle Moffett
2007-06-28 12:08 ` Jakub Jelinek
0 siblings, 1 reply; 16+ messages in thread
From: Kyle Moffett @ 2007-06-28 11:53 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Adrian Bunk, LKML Kernel, David Woodhouse, david, Andi Kleen,
linux-arch
On Jun 27, 2007, at 23:57:54, Matthew Wilcox wrote:
> On Wed, Jun 27, 2007 at 06:30:52PM -0400, Kyle Moffett wrote:
>> Then all 64-bit archs have:
>> typedef signed long __s64;
>> typedef unsigned long __u64;
>>
>> While all 32-bit archs have:
>> typedef signed long long __s64;
>> typedef unsigned long long __u64;
>
> include/asm-parisc/types.h:typedef unsigned long long __u64;
>
> For both 32 and 64-bit.
>
> include/asm-sh64/types.h:typedef unsigned long long __u64;
> include/asm-x86_64/types.h:typedef unsigned long long __u64;
>
> So that's three architectures that violate your first assertion.
Oh, ok, that makes it even easier to say this with certainty:
Changing the other 64-bit archs to use "long long" for their 64-bit
numbers will not cause additional warnings. I'm also almost certain
there are no architectures which use "long long" for 128-bit
integers. (Moreover, I can't find hardly anything which does 128-bit
integers at all).
Cheers,
Kyle Moffett
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 11:53 ` Kyle Moffett
@ 2007-06-28 12:08 ` Jakub Jelinek
2007-06-28 12:18 ` Kyle Moffett
0 siblings, 1 reply; 16+ messages in thread
From: Jakub Jelinek @ 2007-06-28 12:08 UTC (permalink / raw)
To: Kyle Moffett
Cc: Matthew Wilcox, Adrian Bunk, LKML Kernel, David Woodhouse, david,
Andi Kleen, linux-arch
On Thu, Jun 28, 2007 at 07:53:51AM -0400, Kyle Moffett wrote:
> On Jun 27, 2007, at 23:57:54, Matthew Wilcox wrote:
> >On Wed, Jun 27, 2007 at 06:30:52PM -0400, Kyle Moffett wrote:
> >>Then all 64-bit archs have:
> >>typedef signed long __s64;
> >>typedef unsigned long __u64;
> >>
> >>While all 32-bit archs have:
> >>typedef signed long long __s64;
> >>typedef unsigned long long __u64;
> >
> >include/asm-parisc/types.h:typedef unsigned long long __u64;
> >
> >For both 32 and 64-bit.
> >
> >include/asm-sh64/types.h:typedef unsigned long long __u64;
> >include/asm-x86_64/types.h:typedef unsigned long long __u64;
> >
> >So that's three architectures that violate your first assertion.
>
> Oh, ok, that makes it even easier to say this with certainty:
> Changing the other 64-bit archs to use "long long" for their 64-bit
> numbers will not cause additional warnings. I'm also almost certain
> there are no architectures which use "long long" for 128-bit
> integers. (Moreover, I can't find hardly anything which does 128-bit
> integers at all).
unsigned long and unsigned long long have the same size, precision
and alignment on all LP64 arches, that's true. But they have
different ranks and more importantly they mangle differently in C++.
So, whether some user exposed type uses unsigned long or unsigned long long
is part of the ABI, whether that's size_t, uintptr_t, uint64_t, u_int64_t
or any other type, you can't change it without breaking the ABI.
Jakub
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 12:08 ` Jakub Jelinek
@ 2007-06-28 12:18 ` Kyle Moffett
0 siblings, 0 replies; 16+ messages in thread
From: Kyle Moffett @ 2007-06-28 12:18 UTC (permalink / raw)
To: Jakub Jelinek
Cc: Matthew Wilcox, Adrian Bunk, LKML Kernel, David Woodhouse, david,
Andi Kleen, linux-arch
On Jun 28, 2007, at 08:08:03, Jakub Jelinek wrote:
> On Thu, Jun 28, 2007 at 07:53:51AM -0400, Kyle Moffett wrote:
>> Oh, ok, that makes it even easier to say this with certainty:
>> Changing the other 64-bit archs to use "long long" for their 64-
>> bit numbers will not cause additional warnings. I'm also almost
>> certain there are no architectures which use "long long" for 128-
>> bit integers. (Moreover, I can't find hardly anything which does
>> 128-bit integers at all).
>
> unsigned long and unsigned long long have the same size, precision
> and alignment on all LP64 arches, that's true. But they have
> different ranks and more importantly they mangle differently in C+
> +. So, whether some user exposed type uses unsigned long or
> unsigned long long is part of the ABI, whether that's size_t,
> uintptr_t, uint64_t, u_int64_t or any other type, you can't change
> it without breaking the ABI.
That sounds *extraordinarily* broken. Hopefully this would *not*
affect the type of a function which is passed a C "struct" containing
the "long long", right?
Hmm, I guess the question is: Do we support people directly passing
__u64 to C++ functions in userspace? I could understand, perhaps,
passing around structures defined in the kernel headers, but
certainly not the kernel-internal types. The only reason we even
export those is so we can have a private set of bit-size-defined
types with which to define kernel ABI structures.
Cheers,
Kyle Moffett
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Userspace compiler support of "long long"
2007-06-28 11:36 ` David Woodhouse
@ 2007-06-28 12:20 ` Kyle Moffett
0 siblings, 0 replies; 16+ messages in thread
From: Kyle Moffett @ 2007-06-28 12:20 UTC (permalink / raw)
To: David Woodhouse
Cc: Geert Uytterhoeven, Jan Engelhardt, Randy Dunlap, Adrian Bunk,
LKML Kernel, david, linux-arch
On Jun 28, 2007, at 07:36:14, David Woodhouse wrote:
> On Thu, 2007-06-28 at 13:34 +0200, Geert Uytterhoeven wrote:
>> We do not support building Linux with Turbo C (or MS Visual C for
>> Win64 P64).
>
> We're talking about types which are exposed to userspace.
Yes, and all 64-bit software built using kernel headers must be built
in LP64 mode, anything else is pure insanity. On LP64 (IE: how the
kernel itself is compiled on EVERY 64-bit arch):
char == 8 bits
short == 16 bits
int == 32 bits
long == 64 bits
pointer == 64 bits
long long == 64 bits
On LP32 (IE: how the kernel itself is compiled on EVERY 32-bit arch):
char == 8 bits
short == 16 bits
int == 32 bits
long == 32 bits
pointer == 32 bits
long long == 64 bits
Ergo we can simply require that if you want to use kernel headers you
must be using the same mode as the kernel is compiled in (LP32 or LP64).
The simplest guaranteed-not-to-break way to do this on _every_
supported platform is:
typedef signed char __s8;
typedef unsigned char __s8;
typedef signed short __s16;
typedef unsigned short __s16;
typedef signed int __s32;
typedef unsigned int __s32;
# if __STDC_VERSION__ >= 19901L
typedef signed long long __s64;
typedef unsigned long long __s64;
# elif defined(__GNUC__)
__extension__ typedef signed long long __s64;
__extension__ typedef unsigned long long __s64;
# endif
If you have some other compiler that works under linux *AND* supports
a 64-bit type in non-C99-mode (whether "long long" or something
else), then they are welcome to submit patches to fix it.
Cheers,
Kyle Moffett
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2007-06-28 12:20 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <467afc63.OnsqEXOk5zqMYzym%Joerg.Schilling@fokus.fraunhofer.de>
[not found] ` <Pine.LNX.4.64.0706211620080.31603@asgard.lang.hm>
[not found] ` <467b0bf2.Xfs7T8Ys4nY9ZNLW%Joerg.Schilling@fokus.fraunhofer.de>
[not found] ` <1182483527.10524.31.camel@shinybook.infradead.org>
[not found] ` <20070622150038.GN23017@stusta.de>
[not found] ` <E27BAC4D-2F1E-4191-A75D-4DD18231C320@mac.com>
[not found] ` <20070627154046.GN1094@stusta.de>
[not found] ` <468287a8.spBb6PdAZ4QV0j2Y%Joerg.Schilling@fokus.fraunhofer.de>
[not found] ` <20070627173240.GR1094@stusta.de>
2007-06-27 22:30 ` Userspace compiler support of "long long" Kyle Moffett
2007-06-27 22:57 ` Randy Dunlap
2007-06-27 23:16 ` Randy Dunlap
2007-06-28 2:12 ` Geert Uytterhoeven
2007-06-28 6:50 ` Jan Engelhardt
2007-06-28 11:34 ` Geert Uytterhoeven
2007-06-28 11:36 ` David Woodhouse
2007-06-28 12:20 ` Kyle Moffett
2007-06-28 3:06 ` Kyle McMartin
2007-06-28 0:30 ` Andi Kleen
2007-06-28 11:42 ` Kyle Moffett
2007-06-28 3:57 ` Matthew Wilcox
2007-06-28 11:53 ` Kyle Moffett
2007-06-28 12:08 ` Jakub Jelinek
2007-06-28 12:18 ` Kyle Moffett
2007-06-28 4:03 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox