When bumping in dll/forking errors in cygwin, i'm calling the rebaseall
script and everything magically works again. I know that it somehow modifies the dlls in the cygwin installation because i've run a diff between the problematic ones and the rebased ones.
What does it exactly modify in these binary files and makes them work again?
According to Error messages about module base addresses:
DLLs on Windows need to be loaded into memory at non-conflicting base addresses. rebaseall is a cygwin utility that scans all the libraries currently installed and sets each to request a different base address so that none will conflict.
A bit more technical explanation from Handling repeated failures of rebaseall to allow cygwin remaps:
Because of unix fork semantics (presumably), cygwin libraries must be mapped in the same location in both parent and child of a fork. All cygwin libraries have hints in them as to where they should be mapped in a processes address space; if those hints are followed, each library will be mapped in the same location in both address spaces. However, Windows is perfectly happy mapping a DLL anywhere in the address space; the hint is not considered controlling. The remapping error occurs when a cygwin process starts and one of its libraries cannot be mapped to the location specified by its hint.
/usr/bin/rebaseall changes the DLL hints for all of the cygwin libraries so that there are no inter-library conflicts; it does this by choosing a contiguous but not overlapping library layout starting at a base address and working down. This process makes sure there are no intra-cygwin conflicts, but cannot deal with conflicts with external DLLs that are in cygwin process address spaces (e.g. anti-virus DLLs).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With