当在 cygwin 中遇到 dll/forking 错误时,我调用 rebaseall
脚本,一切都神奇地再次工作。我知道它以某种方式修改了 cygwin 安装中的 dll,因为我已经在有问题的 dll 和重新设置基础的 dll 之间进行了比较。
它究竟修改了这些二进制文件中的哪些内容并使它们再次工作?
最佳答案
根据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.
来自 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).
关于dll - Cygwin 中的 rebaseall 是做什么的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33125842/