Ian, thanks for your reply.
However, I think I wasn't clear in my question, please let me try to
explain.
the problem I am trying to solve is that I want to save ecx, edx registers
around a specific function call, In my case I want to save them around
mcount call ( when you compile with -pg switch, mcount is inserted after the
prolog of each function ).
the problem is that mcount and moncount implementation on the MAC trashes
the value of ecx register, and gcc doesn't emit code to save registers
around mcount calls.. I was hoping to find a gcc code gen option to force
gcc to save and restore register values around mcount call.
I tried -fcall-saved-REG and -fcall-used-REG but this didn't work around
each function call
I hope anyone can help with this issue.
Thanks
--------------------------------------------------
From: "Ian Lance Taylor" <iant@xxxxxxxxxx>
Sent: Tuesday, December 22, 2009 7:55 AM
To: "Muhammed Fawzy" <mfawzymkh@xxxxxxxxxxx>
Cc: <gcc-help@xxxxxxxxxxx>
Subject: Re: DEFAULT_CALLER_SAVES doesn't work on the mac
"Muhammed Fawzy" <mfawzymkh@xxxxxxxxxxx> writes:
I am trying to force GCC to save ALL registers before functions
calls. I am running GCC 4.0.1 on MAC OS X leopard.
I am trying to achieve this by defining DEFAULT_CALLER_SAVES as well
as compiling with -fcaller-saves. however, disassemble of a simple
helloworld program that calls functions a from main doesn't show any
difference.
is there any special thing needed to force gcc to save all registers ?
-fcaller-saves is the default when optimizing.
Try using -fcall-used-REG for all your registers.
Ian