From owner-freebsd-current@FreeBSD.ORG Thu Sep 4 17:59:31 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 71D5C16A4BF for ; Thu, 4 Sep 2003 17:59:31 -0700 (PDT) Received: from newtrinity.zeist.de (newtrinity.zeist.de [217.24.217.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8892D43FE3 for ; Thu, 4 Sep 2003 17:59:29 -0700 (PDT) (envelope-from marius@newtrinity.zeist.de) Received: from newtrinity.zeist.de (localhost [127.0.0.1]) h850xRlc035296; Fri, 5 Sep 2003 02:59:27 +0200 (CEST) (envelope-from marius@newtrinity.zeist.de) Received: (from marius@localhost) by newtrinity.zeist.de (8.12.9/8.12.9/Submit) id h850xMM2035295; Fri, 5 Sep 2003 02:59:22 +0200 (CEST) (envelope-from marius) Date: Fri, 5 Sep 2003 02:59:22 +0200 From: Marius Strobl To: Marcel Moolenaar Message-ID: <20030905025922.A68885@newtrinity.zeist.de> References: <20030904180448.021a1b6b.Alexander@Leidinger.net> <20030904162858.GI98381@dan.emsphone.com> <20030905001411.3a9030b3.Alexander@Leidinger.net> <20030904224709.GA48780@ns1.xcllnt.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030904224709.GA48780@ns1.xcllnt.net>; from marcel@xcllnt.net on Thu, Sep 04, 2003 at 03:47:09PM -0700 cc: Alexander Leidinger cc: current@freebsd.org Subject: Re: Question about genassym, locore.s and 0-sized arrays (showstopper for an icc compiled kernel) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Sep 2003 00:59:31 -0000 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.