Commit e7dee540 by Nicolas Capens Committed by Nicolas Capens

Use global libX11 symbols when present.

Bug 20754549 Change-Id: I029310192d638a2769bf6e2d2950717d6a4c484b Reviewed-on: https://swiftshader-review.googlesource.com/3050Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 9b81871a
......@@ -19,8 +19,8 @@
#endif
void *getLibraryHandle(const char *path);
void *loadLibrary(const char *path);
void freeLibrary(void *library);
void *loadLibrary(const char *path);
void freeLibrary(void *library);
void *getProcAddress(void *library, const char *name);
template<int n>
......@@ -114,8 +114,15 @@ void *loadLibrary(const char *(&names)[n], const char *mustContainSymbol = nullp
inline void *getProcAddress(void *library, const char *name)
{
return library ? dlsym(library, name) : 0;
}
void *symbol = dlsym(library, name);
if(!symbol)
{
const char *reason = dlerror(); // Silence the error
}
return symbol;
}
#endif
#endif // SharedLibrary_hpp
#define MAJOR_VERSION 3
#define MINOR_VERSION 2
#define BUILD_VERSION 9
#define BUILD_REVISION 47659
#define BUILD_VERSION 10
#define BUILD_REVISION 47660
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
......
......@@ -46,9 +46,18 @@ LibX11exports *LibX11::loadExports()
if(libX11)
{
libXext = loadLibrary("libXext.so");
libX11exports = new LibX11exports(libX11, libXext);
}
libXext = loadLibrary("libXext.so");
libX11exports = new LibX11exports(libX11, libXext);
}
else // Might have failed to load due to sandboxing. Search the global scope for pre-loaded library.
{
if(getProcAddress(RTLD_DEFAULT, "XOpenDisplay"))
{
libX11exports = new LibX11exports(RTLD_DEFAULT, RTLD_DEFAULT);
}
libX11 = (void*)-1; // Don't attempt loading more than once.
}
}
return libX11exports;
......
......@@ -144,7 +144,6 @@ public:
release();
}
protected:
const GLsizei width;
const GLsizei height;
......
......@@ -120,6 +120,7 @@
<Unit filename="../common/Object.cpp" />
<Unit filename="../common/Object.hpp" />
<Unit filename="../common/debug.cpp" />
<Unit filename="../common/debug.h" />
<Unit filename="Config.cpp" />
<Unit filename="Config.h" />
<Unit filename="Display.cpp" />
......
......@@ -22,7 +22,6 @@
#include "Common/SharedLibrary.hpp"
#include "common/debug.h"
#define EGL_EGLEXT_PROTOTYPES
#include <EGL/eglext.h>
static sw::Thread::LocalStorageKey currentTLS = TLS_OUT_OF_INDEXES;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment