This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Playing with attributes and functions...
- From: Fabio Alemagna <falemagn at studenti dot unina dot it>
- To: <gcc at gcc dot gnu dot org>
- Date: Mon, 5 May 2003 17:18:15 +0200 (CEST)
- Subject: Playing with attributes and functions...
Hello,
I have this need: a function declaration of the type
rtype fname(t1 arg1, ..., tn argn) __attribute__((amilibcall(libbase, offset)));
should be treated as if it were declared like this:
rtype fname(void *libbase, t1 arg1, ..., tn argn);
and calling such function should happen like this:
((typeof(&fname) *)libbase)[offset](libbase, arg1, ..., argn);
where libbase doesn't need to be a global symbol, but also just a local
one.
Taking the address of such function should return
((typeof(&fname) *)libbase)[offset]
and defining such function (as opposed to "declaring" it), should also
define a global static symbol (whose name is not rally important), which
contained the _real_ address of the function (that is, not the one taken
from the libbase), and should put it into a section named
"libbase.offset".
Now, how do I go about it? I'm rather new to gcc hacking so I really need
the help of someone who is more clever than me at this, or at least has
more knowledge than me. I've looked at the file gcc/call.c, and perhaps
that's the place where to start hacking? I'm not talking about the
attribute handling, that I know how to do, but rather about the other
points.
I'd appreciate very much if you could at least point me in the right
direction to solve the first 2 issues, and perhaps I can find out myself
how to solve the other ones.
Many thanks to whoever will be willing to help me.
Fabio Alemagna