Subject: Re: c compilers
To: None <collver@linuxfreemail.com>
From: Gregory McGarry <g.mcgarry@ieee.org>
List: port-i386
Date: 10/15/2001 10:39:38
collver@linuxfreemail.com wrote:

> > ...The problem here is that (stdin, stdout, stderr) are indexed to an array
> > of FILE structures, and that GCC and LCC produce FILE structures of
> > different sizes.  The array is defined in GCC compiled code
> > (/usr/lib/libc.so), but indexed by LCC compiled code...
> 
> NetBSD 1.5.2's libc:
> $ grep '	std[ioe]' /usr/include/stdio.h
> #define stdin   (&__sF[0])
> #define stdout  (&__sF[1])
> #define stderr  (&__sF[2])
> 
> Linux's libc:
> $ grep '\*std' /usr/src/glibc-2.2.3/sysdeps/posix/defs.c  
> FILE *stdin = &stdstreams[0];
> FILE *stdout = &stdstreams[1];
> FILE *stderr = &stdstreams[2];
> 
> In this case, GNU's way makes libc work with compilers other than what
> libc was compiled with.

I have a fix for this which seems to have missed the original commit.

I did use LCC to compile much of the NetBSD tree, unless it used
bitfields (which the ip header files use).  LCC has stricter
type-checking than GCC, which is useful.

In the end I conceded that the NetBSD header files are GCC-specific.
And the windy maze of header files looked too dangerous for me to
tinker with.

	-- Gregory McGarry <g.mcgarry@ieee.org>