[PATCH] D30107: Make DynamicLibrary::getPermanentLibrary on Windows have a defined ordering.

Frederich Munch via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 17 11:25:44 PST 2017


marsupial created this revision.

This is mostly affecting usage of the JIT...
When using DynamicLibrary::getPermanentLibrary(0,0) to get a list of the loaded libs, on Windows this is currently stored in a set which makes iteration unordered / undefined. Additionally there is a problem as newer Windows are using ucrt.dll for a lot of stdlib functions which cause a disagreement between the JIT and native code as to what the address and implementation of that function is:

JIT: putenv_s("TEST", "VALUE") calls msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" calls msvcrt.dll, getenv
BIN: getenv("TEST") -> NULL // calls ucrt.dll, getenv

The patch simply changes the way modules are loaded and stored to how Windows says they were.
Searches for symbols in reverse order so newer modules will override older ones.
And always tries to give priority to the process' symbols (what dlsym does I believe)


https://reviews.llvm.org/D30107

Files:
  lib/Support/Windows/DynamicLibrary.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30107.88930.patch
Type: text/x-patch
Size: 6117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170217/09063fe9/attachment.bin>


More information about the cfe-commits mailing list