On May 25, 2006, at 1:59 PM, Marc Respass wrote:
I just built my second Cocoa framework in as many days :). Since before yesterday, I had never built a Cocoa framework, I've been studying up. It's all pretty straight forward except for this -seg1addr linker flag. I can't find any information on this except that my framework needs to be built with -seg1addr in the range of 0x00000000 to 0x3FFFFFFF or anything above 0x900000000. My question is, how do I decide what to use for an address? For my first framework, I used -seg1addr 0x10000000 and for the second, -seg1addr 0x20000000.
Hey Marc,
The seg1addr has to do with prebinding, which is basically a way to speed up launch time for applications using frameworks. I'll let the documentation explain better:
"Prior to Mac OS X v10.3.4, Mac OS X used a feature called prebinding to eliminate the load-time delays incurred by executables linked to dynamic libraries. Prebinding involved the precalculation of symbol addresses in each framework and library on the system. The goal of this precalculation was to avoid address-space conflicts among the libraries and frameworks. Such conflicts incurred tremendous performance penalties at load-time and would noticeably slow down the launch time of an application."
Prebinding isn't required if you are developing frameworks that will only run on 10.4 or later. If you are targeting older versions of OS X, choosing a correct seg1addr (which is the framework's preferred binding address) will help enable prebinding:
" When prebinding frameworks, it is especially important to specify a preferred address using the -seg1addr option. If you enable prebinding but do not specify a preferred address, Xcode uses the default address 0x00000000. This is a problem because that address is also the preferred address for all applications. Instead, you should set the initial address to a region of memory reserved for use by your application code and frameworks. For a list of valid address ranges, see “Prebinding Your Application” in Launch Time Performance Guidelines."
Check out the following pages, which should help you out:
-Murph |