[parisc-linux] Missing directories from CVS

Helge Deller Helge.Deller@ruhr-uni-bochum.de
Fri, 24 Sep 1999 10:13:13 +0200


Am Thu, 23 Sep 1999 schrieb LaMont Jones:
> > And on this one "cc" gets picky about pointer math.
> > Here's my diff for mkImage.c:
> 
> > <     *entry_point = *(unsigned long*)(ptr + 6*sizeof(long));
> > ---
> > >     *entry_point = *(unsigned long*)((char *)ptr + 6*sizeof(long));
> OK, so I'm too lazy to go look...  what type is ptr?  I'd guess that
> it's declared void*, since that's the only way the pointer math could
> work in gcc and not in HP-cc.

Yes.

> 
> > Any objections to committing this change?
> > On second thought, both changes should be written as:
> > 	*entry_point = ((unsigned long *)ptr)[6];
> > and	
> > 	short magic = ((short *)ptr)[1];
> How about just using filehdr.h, or copying struct header from it, and
> using the real structure...?  (I think we've released the format enough
> that we could clone the structure, failing that:
> 
>   struct header {
> 	unsigned short magic;
> 	short fill0;
> 	long fill[5];
> 	unsigned long entry_point;
>   };
> will fit the bill quite nicely.

Yes, I think this would be the best solution. When I wrote the program, I tried
to include the header-files som.h and elf.h, but then I always got
different errors from every of the arch-compilers (iA32 or hpux).  So maybe it
is best to use the structure as above and write the structure-layout directly
into the source.  
Does someone want to fill it in and commit it ?

> 
> LaMont "I hate magic offsets" Jones
Helge "master of bad pointer arithmetic" Deller :-)