Use an internal symbol to determine library directory.

Exported symbols with protected visibility (change made in the next
patch) have a relocation type that is incompatible with passing their
address to dladdr(). Instead we can use a static local variable.

Bug b/110884149

Change-Id: I3e38280276ec00913b28ff97b007490619a99f58
Reviewed-on: https://swiftshader-review.googlesource.com/19710
Reviewed-by: Alexis Hétu <sugoi@google.com>
Tested-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/libEGL/libEGL.hpp b/src/OpenGL/libEGL/libEGL.hpp
index 74ddf65..b6d9d63 100644
--- a/src/OpenGL/libEGL/libEGL.hpp
+++ b/src/OpenGL/libEGL/libEGL.hpp
@@ -73,7 +73,7 @@
 class LibEGL
 {
 public:
-	LibEGL(const std::string libraryDirectory) : libraryDirectory(libraryDirectory)
+	LibEGL()
 	{
 	}
 
@@ -118,7 +118,8 @@
 				#error "libEGL::loadExports unimplemented for this platform"
 			#endif
 
-			libEGL = loadLibrary(libraryDirectory, libEGL_lib, "libEGL_swiftshader");
+			std::string directory = getModuleDirectory();
+			libEGL = loadLibrary(directory, libEGL_lib, "libEGL_swiftshader");
 
 			if(libEGL)
 			{
@@ -132,7 +133,6 @@
 
 	void *libEGL = nullptr;
 	LibEGLexports *libEGLexports = nullptr;
-	const std::string libraryDirectory;
 };
 
 #endif   // libEGL_hpp