It is true that to build prebound libraries an address must be specified, but not so for executables.

So on the Mac simply adding -prebind flags to all compiles and links will not cause any problems for executables or libraries. If the prebind fails when building an executable (because one or more of the dependant libraries was not built prebound) or when building a library (because an address was not specified, and/or one or more of it's dependant libraries was also not built prebound) then the compiler just spits out a warning and proceeds building without prebinding.

Of course if there is some other error caused by multiple symbol definitions or _dyld_make_delayed_module_initializer_calls (I don't know as much about this as I sound like I do) then prebinding will also fail, but the building continues. The executable will be fine (except in the case of _dyld_make_delayed_module_initializer_calls, which would create an unusable binary anyway even without any -prebind flags specified during build; LDFLAGS=-r or LDFLAGS=-bind_at_load are needed).

If an executable only links against Apple-supplied dylibs (and none from /sw/lib) prebinding will work (and I recommend it) because Apple has pre-assigned load addresses to all of their libs when they built them.

Unfortunately there is no way to automatically assign unique load addresses to dylibs, it is up to developers to pick addresses and co-ordinate with any other developer in the universe to make sure addresses don't clash. :(

* This whole prebinding dylibs addresses scenario smells to me like the nightmarish FONT/FOND ID conflicts back in the old days of Mac System 6 and 7!

For fink to build prebound libraries, there is a tool someone here made called gcc-prebind 0.1 (search the mailing list archives around last November). It might be useful to get started in the process but ultimately I think each shlib package would have to patched to hard-code in the bind address. Also I believe someone will still have to create a web page somewhere to track all the prebinding load addresses which have been assigned to the various fink-built dylibs so they can be built identical on everyone's system.

Carsten

On Saturday, February 8, 2003, at 08:44 am, David wrote:
On Samstag, Februar 8, 2003, at 02:56  Uhr, Ben Hines wrote:

On Friday, February 7, 2003, at 10:36  AM, David wrote:


Furthermore it is not as simple as simply adding --prebind. Many pieces of software are not yet fixed to fully support prebinding, much less proper relocation nor 'reentrancy'.

This is wrong.

Then please explain to me how that is wrong. I will admit, that I do not know too much about Macho-O yet and thus I might be falsely applying issues that come up with ELF prebinding, yet one problem always remains. To properly prebind you need to know which addresses to prebind into. The hinting information has to be announced properly and that would require something like a global registry. Does Mach-O have that? Furthermore try prebinding with something like sudo, it will not work. There have been numerous issues trying to accomplish that on elf for various reasons, at least with my testing. Maybe it does work with Mach-O.

So please do explain to me a) why it is wrong and b) where I can find more information. I was looking trhough apples website, but it was not too helpful as usual.


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Fink-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/fink-devel

Reply via email to