restFP and saveFP
I frequently see questions from people who are wondering why their code reports restFP and saveFP as undefined symbols when linking on Mac OS X. In the hopes that this’ll be picked up by Google, I’ll answer that here.
restFP and saveFP are defined in /usr/lib/libgcc.a. This is usually added to your link line by the compiler or to your project by Xcode, but sometimes it isn’t. This often happens if you directly invoke ld to link.
To fix this, add -lgcc to your link line or link against /usr/lib/libgcc.a.
If you’re curious, you can verify that restFP is defined in libgcc.a by running
nm /usr/lib/libgcc.a | grep restFP
You’ll see a line like this in the output:
00000050 T restFP
The T means that the symbol is defined and exported.
ScienceMan Said,
November 25, 2003 @ 10:25 am
Thanks! Worked perfectly… and it did get picked up by Google.
Javier Said,
December 9, 2003 @ 3:35 pm
Thank you Eric !
I spent one morning trying to figure out what was going on until I found your web page.
Mike Said,
January 5, 2004 @ 2:39 pm
Many thanks. I had just the problem you described; googled restFP; found your link at the top of the page. Problem solved.
Howard Matis Said,
January 20, 2004 @ 5:23 pm
Solved my problem too.
cTh Said,
April 23, 2004 @ 5:31 am
thnx man, solved all ;), it was in codeWarrior
tom Said,
November 10, 2004 @ 6:39 pm
same story. thanks!