This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Controlling ld and as with GCC-Backend


2013/3/19 Jens Mehler <jens.mehler@mni.thm.de>:
> Hi jasonwucj
>
> thanks for the tip and sorry for bothering you while working on your stuff.
> I can run programs in my own simulator now ~ isn't that awesome?
> Well atm I am looking at varargs implementation.
> Do you happen to know anything about that?
>
> With best regards
> ~Jens


Hi Jens,

Generally speaking, there are two appoarches to
deal with varargs arguments in ABI.

The first approach is to have caller push all
unnamed arguments into the stack.
This is simplest way to support varargs.
You just need to implement TARGET_STRICT_ARGUMENT_NAMING
to guide compiler how you treat the last named argument.

For the second approach,
caller behaves in the way of calling a normal function.
It passes arguments via register and then stack.
In that case, callee is in charge of storing the unnamed register
arguments into the stack so that all the arguments appear
to have been passed consecutively on the stack.
You need to further implement TARGET_SETUP_INCOMING_VARARGS.
The value crtl->args.pretend_args_size will be servered
as additonal offset for setting up the stack frame.
You can refer to arm porting for more details.


Best regards,
jasonwucj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]