Hello, guys,
Here is a question about Codewarrior's linking.
Before this question comes up, we link our program together with "Runtime.PPCEABI.H.a" supplied by Codewarrior. And it goes well.
But when "Runtime.PPCEABI.H.a" is not present in our project, there are more than 100 similar linking errors coming up, like "undefined _savegpr_23", "undefined _savegpr_27", etc.
In my opinion, it seems that if possible, CodeWarrior will use general purpose registers to store local variables in function block,
The sample code goes below:
Does anybody has experience in dealing with this kind of errors ?
Any suggestion is welcome.
Thanks in advance.
Best Regards,
Shawn
Solved! Go to Solution.
Hi ShawnBai,
As far as I know It's not possible to force the compiler to allocate the local variables on stack. The local variables are being placed according to the spec. defined by EABI standard. You can change the ABI used.
What is the goal of having the loacal variables on stack rather then in registers?
BTW: how do you use ANSI-C libraries routines e.g. printf, strcpy,...they are located in a library (MSL/EWL) as well...
Stanish
Hello, Shawn,
I have the same question with you.
For some special purpose, I don't want to use the runtime library in my project.
Besides to add runtime.c into the project, have you found any other good methods to fix this problem?
Best regards,
John
And, if we donot want Runtime.PPCEABI.H.a to involve in our project, what shoud we do ?
Hi ShawnBai,
Which specific CodeWarrior do you use?
You can add the runtime source files into your project to get rid of runtime library.
E.g. _savegpr* and _restgpr* are implemented in the file runtime.c located here (in case of CodeWarrior for MPC55xx/56xx):
"<CW for MPC55xx and MPC56xx>\PowerPC_EABI_Support\Runtime\Src\runtime.c"
You should be aware that runtime library includes also other important runtime routines e.g. 64bit integer arithmetic, casting routines, startup code, etc...
Stanish
Hi, Stanish,
Which specific CodeWarrior do you use?
You mean for which processor's family?
It's MPC83xx serial.
Ya, you are right, file runtime.c may be what we need.
Actually, we just want Codewarrior to be a compiler, linker, loader, debugger for our project, and we do not want to depond on source code or archive or object file it supplies.
we have rewritten startup code for our board according to U-BOOT.
we are minimizing code size of our project.
To the end,
what should we do to make local variables allocate in stack, not registers by default?
Thanks.
Hi ShawnBai,
As far as I know It's not possible to force the compiler to allocate the local variables on stack. The local variables are being placed according to the spec. defined by EABI standard. You can change the ABI used.
What is the goal of having the loacal variables on stack rather then in registers?
BTW: how do you use ANSI-C libraries routines e.g. printf, strcpy,...they are located in a library (MSL/EWL) as well...
Stanish
Hi, Stanish,
Actually, wanting to use local variabls in stack is the consequence of removing runtime libraries supplied by CodeWarrior.
As I say before, it seems that, by default, local variables is allocated in general purpose registers, So, in my opinion, if we can allocate these local variabls in stack, it should be enough to move runtime libraries away.
Truthfully, I am not very familiar with EABI standard.
As you said, if locating variables in gpr is the behavior of EABI, and if we wanna go on together with EABI, it seems that this is an impossible mission.
Speaking of ANSI-C libraries routines, in fact, we do not use them often, that is, thers is no strong requirement of them.
If needded, the usual way we goes is to impliment them ourself.
Next, I will go to specs standardized by EABI to learn more about how to locate variable reigsters.
Thanks.