[llvm] [Windows] Use absolute path when loading system shared library (PR #90520)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 14:26:05 PDT 2024


mstorsjo wrote:

> > And it most probably can make binaries unportable, in case the files are available in different directories on different machines.
> 
> It depends on how portable find_library searching vs LoadProcessW searching compare to one another. find_library is more general and configurable. We can restrict its search path further; having it match LoadProcessW for all Windows might be tricky.

My point is, the absolute path where DLLs exist can differ between machines. On some versions of Windows, the default is `c:\winnt`, on others it's `c:\windows`. Perhaps it's even configurable at install time? So if you build your binaries on one machine, they won't be able to load these DLLs on one with a different layout.

Worse - if you have a i386 binary, running on i386 Windows, it will perhaps find these DLLs in `c:\windows\system32`. However on an x86_64 Windows install, there are DLLs with those names in that directory, but they're incompatible; the right ones will be in `c:\windows\SysWOW64`.


https://github.com/llvm/llvm-project/pull/90520


More information about the llvm-commits mailing list