Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1EZj2e-0007AH-WA for mharc-grub-devel@gnu.org; Wed, 09 Nov 2005 01:02:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EZj2c-00078J-Oj for grub-devel@gnu.org; Wed, 09 Nov 2005 01:02:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EZj2a-00076B-Gy for grub-devel@gnu.org; Wed, 09 Nov 2005 01:02:38 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EZj2Z-00075k-8Q for grub-devel@gnu.org; Wed, 09 Nov 2005 01:02:36 -0500 Received: from [209.86.89.67] (helo=smtpauth07.mail.atl.earthlink.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EZj2Y-0005bH-QE for grub-devel@gnu.org; Wed, 09 Nov 2005 01:02:35 -0500 Received: from [63.246.184.80] (helo=[192.168.0.101]) by smtpauth07.mail.atl.earthlink.net with asmtp (Exim 4.34) id 1EZj2W-0006bh-Ts for grub-devel@gnu.org; Wed, 09 Nov 2005 01:02:33 -0500 Mime-Version: 1.0 (Apple Message framework v623) In-Reply-To: <87wtjibufi.fsf@student.han.nl> References: <87wtjibufi.fsf@student.han.nl> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <7e77098236cf144d2d2aa39833380e21@penguinppc.org> Content-Transfer-Encoding: 7bit From: Hollis Blanchard Date: Wed, 9 Nov 2005 00:02:32 -0600 To: The development of GRUB 2 X-Mailer: Apple Mail (2.623) X-ELNK-Trace: 77a46389d001b1f223bcf3e39c2f8b5f1aa676d7e74259b7b3291a7d08dfec79bbae0cd1b9209007c5c60b8a284e7155350badd9bab72f9c350badd9bab72f9c X-Originating-IP: 63.246.184.80 Subject: Re: Generating init and fini functions X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Nov 2005 06:02:39 -0000 On Nov 8, 2005, at 5:18 PM, Marco Gerards wrote: > > At the moment I am working on things that irritate me while I am > working on GRUB. One thing is writing a duplicate _init and _fini > function (duplicate because it already is added in GRUB_MOD_INIT). > And another thing that irritates me is that I have to add a init line > to grub-emu. > > Here is a patch that solves that. First I removed all the init and > fini functions and let GRUB_MOD_INIT and GRUB_MOD_FINI generate these > functions. I have added a script that creates a header file with all > the function prototypes for these generated functions. And finally I > have added a script that can generate a C file with the functions > `grub_init_all' and `grub_fini_all'. This is good. :) The way Linux does this, avoiding shell scripting, is by inserting function pointers into a special ELF section, and that section is looped over using linker symbols defining the beginning and end. On the other hand, I seem to recall that some toolchain component (GDB perhaps) uses shell scripting like this: it finds all functions named in a particular way and produces code to call them. I can live with that. -Hollis