]> granicus.if.org Git - llvm/commit
Refactor DynamicLibrary so searching for a symbol will have a defined order and
authorFrederich Munch <colsebas@hotmail.com>
Mon, 24 Apr 2017 19:55:16 +0000 (19:55 +0000)
committerFrederich Munch <colsebas@hotmail.com>
Mon, 24 Apr 2017 19:55:16 +0000 (19:55 +0000)
commitf5d6c7c2d36e57453623e232cf2d2894fb4a5e87
tree998672a3dfde7db80656efedd074f8defc451822
parentf3b0bf3070ff92a53129058ecdc47942d20d8dc6
Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

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

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

Differential Revision: https://reviews.llvm.org/D30107

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301236 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Support/DynamicLibrary.h
lib/Support/CMakeLists.txt
lib/Support/DynamicLibrary.cpp
lib/Support/SearchForAddressOfSpecialSymbol.cpp [deleted file]
lib/Support/Unix/DynamicLibrary.inc [new file with mode: 0644]
lib/Support/Windows/DynamicLibrary.inc
unittests/Support/CMakeLists.txt
unittests/Support/DynamicLibrary/CMakeLists.txt [new file with mode: 0644]
unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp [new file with mode: 0644]
unittests/Support/DynamicLibrary/PipSqueak.cxx [new file with mode: 0644]
unittests/Support/DynamicLibrary/PipSqueak.h [new file with mode: 0644]