[llvm] r288246 - [Support] Use HAVE_DLOPEN to guard dlopen(3) usage

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 07:34:30 PST 2016


Author: labath
Date: Wed Nov 30 09:34:29 2016
New Revision: 288246

URL: http://llvm.org/viewvc/llvm-project?rev=288246&view=rev
Log:
[Support] Use HAVE_DLOPEN to guard dlopen(3) usage

Summary:
The usage was previously guarded by HAVE_DLFCN. This breaks on Android with
LLVM_BUILD_STATIC as the platform does not provide a static version of libdl.
Using HAVE_DLOPEN fixes it as the code will only get used if we are actually able
to link an executable using dlopen.

Reviewers: rafael, beanz

Subscribers: tberghammer, danalbert, llvm-commits

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

Modified:
    llvm/trunk/lib/Support/DynamicLibrary.cpp

Modified: llvm/trunk/lib/Support/DynamicLibrary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DynamicLibrary.cpp?rev=288246&r1=288245&r2=288246&view=diff
==============================================================================
--- llvm/trunk/lib/Support/DynamicLibrary.cpp (original)
+++ llvm/trunk/lib/Support/DynamicLibrary.cpp Wed Nov 30 09:34:29 2016
@@ -41,7 +41,7 @@ char llvm::sys::DynamicLibrary::Invalid
 
 #else
 
-#if HAVE_DLFCN_H
+#if defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN)
 #include <dlfcn.h>
 using namespace llvm;
 using namespace llvm::sys;
@@ -119,7 +119,7 @@ void* DynamicLibrary::SearchForAddressOf
       return i->second;
   }
 
-#if HAVE_DLFCN_H
+#if defined(HAVE_DLFCN_H) && defined(HAVE_DLOPEN)
   // Now search the libraries.
   if (OpenedHandles) {
     for (DenseSet<void *>::iterator I = OpenedHandles->begin(),




More information about the llvm-commits mailing list