Mailing Lists: Apple Mailing Lists

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

Re: Continuing Linux Porting issues



This appears to be doing lazy linking of symbols in the library, but at some point it just gives up and hangs in the mutex, I'm not sure why. I do know that initializing the classes in libapplication will require initializing many classes in the other libraries as well.

This sounds very much like a problem we identified. For us a work-around was to always build dylibs with -single_module.

The problem was dead-lock in the C++ run time on a mutex around the standard allocators. It running global constructors for library X, one of them would call something in standard C++ library that used standard allocators, and in the *middle* of the call to malloc it would end up calling global constructors in some totally unrelated library Y (I assume because it happened to look for malloc there and triggered constructors to run), which would call standard C++ library again, into allocators -- and lock up because the mutex was already held.

This seems to be compatible with what Geoffrey Schmit said. Always using -single_module to link seemed to help a lot. No need to bind at launch.

Now, I doubt there's much code out there that can cope with that level of random calls / re-entrancy issues. I mean if I call "sin()", I sure don't expect my code to get called again from some unrelated library in the middle of that!

It would be nice for someone to confirm if this is a bug and somebody is looking into fixing it, or if C++ simply requires -single_module when building dylib (in which case it would be nice to make it the default...).

Cheers,
Lassi
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.


References: 
 >Continuing Linux Porting issues (From: 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.