grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generating init and fini functions


From: Hollis Blanchard
Subject: Re: Generating init and fini functions
Date: Wed, 9 Nov 2005 00:02:32 -0600

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]