On Tue, Jan 03, 2017 at 12:43:51AM -0500, Rich Felker wrote: > - Dependency-order ctor execution. I think the walk order looks > something like, starting at a given node (initially the main app or > new library being loaded dynamically), traversing to its first > deps[] entry that hasn't been constructed, or, if none remain, > executing its ctors then traversing back to its needed_by. This > process avoids the need for any call recursion and should be > near-optimal (if not optimal) provided the position in a dso's > deps[] list is saved in the dso struct. Attached is a proposed, completely untested patch to implement dependency order loading, posted for review/comments. In order to work, I think it also needs p->deps to be setup unconditionally (right now it's only setup for dynamically loaded libs). Rich