Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - how does arm-gcc use fp register?: (7 Items)
   
how does arm-gcc use fp register?  
I tried with -O2 to compile an test application but it still uses fp register, is this normal?
but I tried on arm host linux with native gcc 4.1.2 then I didn't see fp is used.
Re: how does arm-gcc use fp register?  
Our arm tools use a different ABI than most Linux arm toolschains. We follow apcs-gnu, and they typically follow the 
EABi (aapcs-linux). By default, our gcc uses -mapcs-frame which means the complaint apcs frame will be emitted. The only
 case the frame pointer is not required is in a leaf function.

Regards,

Ryan Mansfield
Re: how does arm-gcc use fp register?  
> Our arm tools use a different ABI than most Linux arm toolschains. We follow 
> apcs-gnu, and they typically follow the EABi (aapcs-linux). By default, our 
> gcc uses -mapcs-frame which means the complaint apcs frame will be emitted. 
> The only case the frame pointer is not required is in a leaf function.
> 
> Regards,
> 
> Ryan Mansfield


Thanks Ryan!
It seems that apcs is out of date? apcs save at least fp,ip,lr,pc but aapcs didn't when omit-frame-pointer is enabled. I
 didn't understand why pc is saved in stack with apcs? what is that for? Also when I debug arm Linux  binary gdb still 
can show backtrace, how is that done if no fp is saved.
Re: how does arm-gcc use fp register?  
looks like apcs-gnu will not save fp when -fomit-frame-pointer is enabled with leaf function.
but I tried -mno-apcs-frame then it will not save so many registers any more so this should be faster. why we enabled 
this default? In gcc document -mno-apcs-frame is default.
Re: how does arm-gcc use fp register?  
Yao Zhao wrote:
> looks like apcs-gnu will not save fp when -fomit-frame-pointer is enabled with leaf function.
> but I tried -mno-apcs-frame then it will not save so many registers any more so this should be faster. why we enabled 
this default? In gcc document -mno-apcs-frame is default.

-mno-apcs-frame would mean debugging would not always work properly. 
-mno-apcs-frame is the default for targets that follow the newer ABIs.

Regards,

Ryan Mansfield
Re: how does arm-gcc use fp register?  
Yao Zhao wrote:
> Thanks Ryan!
> It seems that apcs is out of date? 

Yes, apcs is old but for us to switch would mean breaking binary 
compatibility with all existing ARM binaries.

apcs save at least fp,ip,lr,pc but aapcs didn't when omit-frame-pointer 
is enabled. I didn't understand why pc is saved in stack with apcs? what 
is that for?

There was a historical reason for saving the PC but I can't recall at 
the moment but it's rarely needed. It still gets saved because the ABI 
says so.

Also when I debug arm Linux  binary gdb still can show backtrace, how is 
that done if no fp is saved.

The eabi requires per function unwind tables.

Regards,

Ryan Mansfield
Re: how does arm-gcc use fp register?  
thanks!
now understood!