Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

saveFP, restFP



I'm starting work on moving some code up from Mac OX X 10.3 
and XCode 1.1's GCC 3.3 to Mac OS X 10.4 and XCode 2.2's 
GCC 4.0.1. I'm not building in the XCode IDE; I'm calling 
GCC and ld from shell scripts for reasons that are long and
complex and utterly unchangeable. The code is all C, with 
no Objective-C or C++. 

I found, somewhat to my surprise, that GCC doesn't generate
calls to saveFP and restFP at -O3, but does at -O1 and -O2.
In GCC 4.0.1, those routines are supplied by libgcc_static.a
in /usr/lib/gcc/powerpc-apple-darwin8/4.0.1, and when gcc 
is driving ld itself, it includes that archive library 
without any fuss. 

However, that doesn't happen when I use ld to build a dylib.
That's fair enough in many ways: libgcc_static.a is clearly 
quite tightly bound to that particular version of GCC. But 
embedding the explicit path 

  /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc_static.a

in my link script is not really attractive; it's the kind of 
thing that could easily be forgotten when one upgrades to a
later GCC in a year's time. I'm using ld to build a dylib 
because I couldn't find a satisfactory way to do it with 
gcc or libtool. Here's the command line: 

$export="/path/to/text/file/with/symbols/to/be/exported"
$archive="/path/to/archive/library/with/all/our/code/for/the/dylib"

ld -dylib -flat_namespace -single_module 				\
   -dylib_compatibility_version 17.1				\
   -headerpad_max_install_names					\
   -exported_symbols_list $export /usr/lib/dylib1.o		\
   -lSystem -lSystemStubs						\
   /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/libgcc_static.a \
   -o name.dylib

Can anyone suggest a better way to point ld at libgcc_static.a,
or to remove the need to do that? 

"Build in the XCode IDE" isn't a usable answer. 

thanks,

-- 
John Dallman, Parasolid Porting Engineer, +44-1223-371554 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.