summaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/DynamicLibrary.inc7
-rw-r--r--lib/Support/Unix/Path.inc2
-rw-r--r--lib/Support/Unix/Signals.inc2
-rw-r--r--lib/Support/Unix/Threading.inc8
4 files changed, 10 insertions, 9 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);
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc
index ce638d453c19..b6774692595b 100644
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -75,8 +75,8 @@
#define STATVFS_F_FRSIZE(vfs) vfs.f_frsize
#else
#if defined(__OpenBSD__) || defined(__FreeBSD__)
-#include <sys/param.h>
#include <sys/mount.h>
+#include <sys/param.h>
#elif defined(__linux__)
#if defined(HAVE_LINUX_MAGIC_H)
#include <linux/magic.h>
diff --git a/lib/Support/Unix/Signals.inc b/lib/Support/Unix/Signals.inc
index 88ad21e9806e..aaf760c5b616 100644
--- a/lib/Support/Unix/Signals.inc
+++ b/lib/Support/Unix/Signals.inc
@@ -15,9 +15,9 @@
#include "Unix.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Demangle/Demangle.h"
-#include "llvm/Support/Format.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/FileUtilities.h"
+#include "llvm/Support/Format.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Program.h"
diff --git a/lib/Support/Unix/Threading.inc b/lib/Support/Unix/Threading.inc
index 407b194e1b6a..267af388ecdb 100644
--- a/lib/Support/Unix/Threading.inc
+++ b/lib/Support/Unix/Threading.inc
@@ -26,19 +26,19 @@
#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#include <errno.h>
#include <sys/sysctl.h>
#include <sys/user.h>
-#include <errno.h>
#include <unistd.h>
#endif
#if defined(__NetBSD__)
-#include <lwp.h> // For _lwp_self()
+#include <lwp.h> // For _lwp_self()
#endif
#if defined(__linux__)
-#include <unistd.h> // For syscall()
-#include <sys/syscall.h> // For syscall codes
+#include <sys/syscall.h> // For syscall codes
+#include <unistd.h> // For syscall()
#endif
namespace {