dlopen() has no NO_LOAD option before Android L.

This change could result in multiple instances of the shared library being
loaded when using alternate paths. This will be addressed by b/18752589.

Change-Id: Icf26a0c6f76edfd4f1c710e14f1005138d97e77a
Reviewed-on: https://swiftshader-review.googlesource.com/2664
Reviewed-by: Nicolas Capens <capn@google.com>
Tested-by: Greg Hartman <ghartman@google.com>
diff --git a/src/Common/SharedLibrary.hpp b/src/Common/SharedLibrary.hpp
index b9d5a51..adaa7fc 100644
--- a/src/Common/SharedLibrary.hpp
+++ b/src/Common/SharedLibrary.hpp
@@ -74,14 +74,19 @@
 

 	inline void *getLibraryHandle(const char *path)

 	{

-		void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD);

+		#ifdef __ANDROID__

+			// bionic doesn't support RTLD_NOLOAD before L

+			return dlopen(path, RTLD_NOW);

+		#else

+			void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD);

 

-		if(resident)

-		{

-			return dlopen(path, RTLD_LAZY);   // Increment reference count

-		}

+			if(resident)

+			{

+				return dlopen(path, RTLD_LAZY);   // Increment reference count

+			}

 

-		return 0;

+			return 0;

+		#endif

 	}

 

     inline void freeLibrary(void *library)