if (fixup_mmaps_after_fork (parent))
api_fatal ("recreate_mmaps_after_fork_failed");
+
+ /* We need to occupy the address space for dynamically loaded dlls
+ before we allocate any dynamic object, or we may end up with
+ error "address space needed by <dll> is already occupied"
+ for no good reason (seen with some relocated dll). */
+ dlls.reserve_space ();
}
bool
{
HANDLE& hParent = ch.parent;
- /* NOTE: Logically this belongs in dll_list::load_after_fork, but by
- doing it here, before the first sync_with_parent, we can exploit
- the existing retry mechanism in hopes of getting a more favorable
- address space layout next time. */
- dlls.reserve_space ();
-
sync_with_parent ("after longjmp", true);
debug_printf ("child is running. pid %d, ppid %d, stack here %p",
myself->pid, myself->ppid, __builtin_frame_address (0));