diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 13:44:06 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 13:44:06 +0000 |
commit | 7ab83427af0f77b59941ceba41d509d7d097b065 (patch) | |
tree | cc41c05b1db454e3d802f34df75e636ee922ad87 /lib/Support/Unix/DynamicLibrary.inc | |
parent | d288ef4c1788d3a951a7558c68312c2d320612b1 (diff) |
Diffstat (limited to 'lib/Support/Unix/DynamicLibrary.inc')
-rw-r--r-- | lib/Support/Unix/DynamicLibrary.inc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Support/Unix/DynamicLibrary.inc b/lib/Support/Unix/DynamicLibrary.inc index a0526fa2c1b8..aad77f19c35a 100644 --- a/lib/Support/Unix/DynamicLibrary.inc +++ b/lib/Support/Unix/DynamicLibrary.inc @@ -15,7 +15,8 @@ #include <dlfcn.h> DynamicLibrary::HandleSet::~HandleSet() { - for (void *Handle : Handles) + // Close the libraries in reverse order. + for (void *Handle : llvm::reverse(Handles)) ::dlclose(Handle); if (Process) ::dlclose(Process); @@ -101,10 +102,10 @@ static void *DoSearch(const char* SymbolName) { #define EXPLICIT_SYMBOL(SYM) \ if (!strcmp(SymbolName, #SYM)) return &SYM -// On linux we have a weird situation. The stderr/out/in symbols are both +// Under glibc we have a weird situation. The stderr/out/in symbols are both // macros and global variables because of standards requirements. So, we // boldly use the EXPLICIT_SYMBOL macro without checking for a #define first. -#if defined(__linux__) and !defined(__ANDROID__) +#if defined(__GLIBC__) { EXPLICIT_SYMBOL(stderr); EXPLICIT_SYMBOL(stdout); |