Re: i386 cleanups

Michael Meissner (meissner@spectacle-pond.org)
Wed, 18 Apr 2001 18:02:57 -0400


On Tue, Apr 17, 2001 at 02:46:09PM -0700, Linus Torvalds wrote:
>
>
> On Tue, 17 Apr 2001, Pavel Machek wrote:
> >
> > These are tiny cleanups you might like. sizes are "logically"
> > long.
>
> No. Sizes are not "logical". They are whatever you decide they are, ie
> it's purely a complier convention.

Not purely a compiler convention, but an ABI requirement. In particular, Linux
GCC adheres to the ABI specified in the System V UNIX Intel386 (tm) Processor
Supplement, and on page 6-66, in figure 6-70, the specification for stddef.h
says that:

typedef int ptrdiff_t;
typedef unsigned int size_t;
typedef long wchar_t;

> At least earlier, size_t was defined as "unsigned int" in user mode, and
> doing anything else would make gcc complain about clashes with its
> compiled-in __builtin_size_t that it uses for the builtin prototypes (ie
> if you had a declaration for "void *memcpy(void *dest, const void *src,
> size_t n);" and your size_t didn't match the gcc builtin_size_t, you'd get
> a "redefined with different arguments" warning or something).

While, I grant that this is one area the ABI could have been improved upon
(alignment of floating point, and reservation of EBX as GOT pointers are other
sore spots), it is the ABI of record. Yes, we could certainly choose a
different ABI for Linux, but it is probably too late for that in the case of
the x86.

-- 
Michael Meissner, Red Hat, Inc.  (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work:	  meissner@redhat.com		phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org	fax:   +1 978-692-4482
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/