From owner-freebsd-current@FreeBSD.ORG Thu Sep 4 15:47:22 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 3C6D216A4BF for ; Thu, 4 Sep 2003 15:47:22 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4E44A43FE1 for ; Thu, 4 Sep 2003 15:47:19 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from ns1.xcllnt.net (localhost [127.0.0.1]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id h84Ml9wO048851; Thu, 4 Sep 2003 15:47:09 -0700 (PDT) (envelope-from marcel@ns1.xcllnt.net) Received: (from marcel@localhost) by ns1.xcllnt.net (8.12.9/8.12.9/Submit) id h84Ml9ap048850; Thu, 4 Sep 2003 15:47:09 -0700 (PDT) (envelope-from marcel) Date: Thu, 4 Sep 2003 15:47:09 -0700 From: Marcel Moolenaar To: Alexander Leidinger Message-ID: <20030904224709.GA48780@ns1.xcllnt.net> References: <20030904180448.021a1b6b.Alexander@Leidinger.net> <20030904162858.GI98381@dan.emsphone.com> <20030905001411.3a9030b3.Alexander@Leidinger.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030905001411.3a9030b3.Alexander@Leidinger.net> User-Agent: Mutt/1.5.1i cc: Dan Nelson 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: Thu, 04 Sep 2003 22:47:22 -0000 On Fri, Sep 05, 2003 at 12:14:11AM +0200, Alexander Leidinger wrote: > On Thu, 4 Sep 2003 11:28:58 -0500 > Dan Nelson wrote: > > > If you're talking FreeBSD 5, you should be able to simply subsitute a > > C99 "flexible array member" (basically replace "[0]" with "[]") and get > > the same effect. 0-length arrays are a gcc extension: > > > > http://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > > > Under FreeBSD 4.x, you can't use them because gcc 2.95 only supports > > the gcc extension. Intel has added support for a lot of gcc extensions > > recently; they may be willing to add this to the list. > > Please read my mail again, icc already supports my_array[0], but the > resulting array in the binary has size '1'. The actual showstopper is > the output of genassym.sh. To me it seems it's just a genassym.sh issue, > but I don't really know what's going on in the kernel, so I ask here. 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. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net