Subject: Re: CVS commit: basesrc/usr.bin/file
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Simon Burge <firstname.lastname@example.org>
Date: 06/06/2002 00:29:34
der Mouse wrote:
> >> have attribute(packed) to struct magic to make it packed in the same
> >> way across different archs.
> > This works fine with gcc, but the problem is that this code is
> > compiled with HOST_CC (to cross-build the magic file using mkmagic).
> > HOST_CC may not be gcc, and thus not know the packed attribute.
> > So, it most be solved in another way, probably by padding struct file
> > in such a way that it's the same on all archs.
> That's only a better-guess "solution" (ie, it works on more hosts but
> still is not C-guaranteed to work). If you really want to generate the
> same data on all arches, you have to pack and unpack it yourself,
> rather than depending on overlaying a struct onto it.
The object of the magic.mgc is so that you don't have to interpret the
uncompiled file each time around. If the overhead of unpacking the
struct all the time is going to outweigh the advantages of the compiled
format, we may as well not worry about using the compiled format.
Simon Burge <email@example.com>
NetBSD CDs, Support and Service: http://www.wasabisystems.com/