Date: Fri, 5 Sep 2003 02:59:22 +0200 From: Marius Strobl <marius@alchemy.franken.de> To: Marcel Moolenaar <marcel@xcllnt.net> Cc: current@freebsd.org Subject: Re: Question about genassym, locore.s and 0-sized arrays (showstopper for an icc compiled kernel) Message-ID: <20030905025922.A68885@newtrinity.zeist.de> In-Reply-To: <20030904224709.GA48780@ns1.xcllnt.net>; from marcel@xcllnt.net on Thu, Sep 04, 2003 at 03:47:09PM -0700 References: <20030904180448.021a1b6b.Alexander@Leidinger.net> <20030904162858.GI98381@dan.emsphone.com> <20030905001411.3a9030b3.Alexander@Leidinger.net> <20030904224709.GA48780@ns1.xcllnt.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Sep 04, 2003 at 03:47:09PM -0700, Marcel Moolenaar wrote: > > We use the size of the symbol (ie the size of the object identified > by the symbol) to pass around values. This we do by creating arrays. > If we want to export a C constant 'FOOBAR' to assembly and the constant > is defined to be 6, then we create an array for the sign, of which the > size is 1 for negative numbers and 0 otherwise. In this case the array > will be named FOOBARsign and its size is 0. We also create 4 arrays (*w0, > *w1, *w2 and *w3), each with a maximum of 64K and corresponding to the > 4 16-bit words that constitutes a single 64-bit entity. > In this case > 00000006 C FOOBARw0 > 00000000 C FOOBARw1 > 00000000 C FOOBARw2 > 00000000 C FOOBARw3 > > If the compiler creates arrays of size 1 for arrays we define as a > zero-sized array, you get exactly what you've observed. > Is this rather complex approach really necessary? I have successfully generated assyms.s' using genassym.sh(8) from NetBSD and both ICC and GCC on i386 which have exactly the same values as one generated with sys/kern/genassym.sh from FreeBSD. The genassym.sh(8) of NetBSD kind of directly exports the C-constants so it just needs one symbol per constant and doesn't require zero sized arrays. Given that it's from NetBSD their approach also should be very MI.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030905025922.A68885>