Subject: Re: c compilers
To: None <collver@linuxfreemail.com>
From: Wojciech Puchar <wojtek@wojtek.3miasto.net>
List: port-i386
Date: 10/13/2001 15:24:23
> 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.  I don't know what the elegant fix is, but the following
> makes your program work.  Substitute GCC's sizeof(FILE) for "88" on yours.
>
> Ben
>
> bash-2.05$ diff --unified=1 plconv.c.orig plconv.c
> --- plconv.c.orig       Sat Oct 13 04:52:49 2001
> +++ plconv.c    Sat Oct 13 06:11:07 2001
> @@ -1,2 +1,5 @@
>  #include <stdio.h>
> +#define libc_sizeof_FILE 88
> +#define stdout (FILE *)((int)__sF + libc_sizeof_FILE)
> +#define stderr (FILE *)((int)__sF + (2 * libc_sizeof_FILE))
>  const char *pldefs[]={
>
in fact gcc is annoying in it's structure etc. paddings.
once i've done a code with hundreds of 33*4 byte constants and gcc of
course padded it to 32 byte boundary filling with zeros so 80% of code
were zeros.