1From acd25c4b8d5b7e420a7a89bdfd6551c70de828b3 Mon Sep 17 00:00:00 2001 2From: Trevor Woerner <twoerner@gmail.com> 3Date: Thu, 23 Sep 2021 19:36:43 -0400 4Subject: [PATCH] use library sonames for linking 5 6The recommended "best practices" for applications is to link to library 7sonames (e.g. libGL.so.1) instead of library names (e.g. libGL.so). This 8ensures that applications don't try to use libraries if an incompatible ABI 9change occurs. 10 11Upstream-Status: Submitted [https://github.com/KhronosGroup/VK-GL-CTS/pull/288] 12Signed-off-by: Trevor Woerner <twoerner@gmail.com> 13--- 14 framework/egl/egluGLContextFactory.cpp | 4 ++-- 15 framework/egl/wrapper/eglwLibrary.cpp | 2 +- 16 framework/platform/android/tcuAndroidPlatform.cpp | 2 +- 17 framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp | 2 +- 18 .../platform/lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp | 2 +- 19 framework/platform/surfaceless/tcuSurfacelessPlatform.cpp | 6 +++--- 20 6 files changed, 9 insertions(+), 9 deletions(-) 21 22diff --git a/framework/egl/egluGLContextFactory.cpp b/framework/egl/egluGLContextFactory.cpp 23index 8fbea2af1..8d42f19eb 100644 24--- a/framework/egl/egluGLContextFactory.cpp 25+++ b/framework/egl/egluGLContextFactory.cpp 26@@ -63,7 +63,7 @@ using std::vector; 27 # if (DE_OS == DE_OS_WIN32) 28 # define DEQP_GLES2_LIBRARY_PATH "libGLESv2.dll" 29 # else 30-# define DEQP_GLES2_LIBRARY_PATH "libGLESv2.so" 31+# define DEQP_GLES2_LIBRARY_PATH "libGLESv2.so.2" 32 # endif 33 #endif 34 35@@ -75,7 +75,7 @@ using std::vector; 36 # if (DE_OS == DE_OS_WIN32) 37 # define DEQP_OPENGL_LIBRARY_PATH "opengl32.dll" 38 # else 39-# define DEQP_OPENGL_LIBRARY_PATH "libGL.so" 40+# define DEQP_OPENGL_LIBRARY_PATH "libGL.so.1" 41 # endif 42 #endif 43 44diff --git a/framework/egl/wrapper/eglwLibrary.cpp b/framework/egl/wrapper/eglwLibrary.cpp 45index d7e07fe18..ebdf68b14 100644 46--- a/framework/egl/wrapper/eglwLibrary.cpp 47+++ b/framework/egl/wrapper/eglwLibrary.cpp 48@@ -148,7 +148,7 @@ DefaultLibrary::~DefaultLibrary (void) 49 const char* DefaultLibrary::getLibraryFileName (void) 50 { 51 #if (DE_OS == DE_OS_ANDROID) || (DE_OS == DE_OS_UNIX) 52- return "libEGL.so"; 53+ return "libEGL.so.1"; 54 #elif (DE_OS == DE_OS_WIN32) 55 return "libEGL.dll"; 56 #else 57diff --git a/framework/platform/android/tcuAndroidPlatform.cpp b/framework/platform/android/tcuAndroidPlatform.cpp 58index b9a4c716f..05cec0b49 100644 59--- a/framework/platform/android/tcuAndroidPlatform.cpp 60+++ b/framework/platform/android/tcuAndroidPlatform.cpp 61@@ -57,7 +57,7 @@ static const eglu::NativeWindow::Capability WINDOW_CAPABILITIES = (eglu::Nativ 62 class NativeDisplay : public eglu::NativeDisplay 63 { 64 public: 65- NativeDisplay (void) : eglu::NativeDisplay(DISPLAY_CAPABILITIES), m_library("libEGL.so") {} 66+ NativeDisplay (void) : eglu::NativeDisplay(DISPLAY_CAPABILITIES), m_library("libEGL.so.1") {} 67 virtual ~NativeDisplay (void) {} 68 69 virtual EGLNativeDisplayType getLegacyNative (void) { return EGL_DEFAULT_DISPLAY; } 70diff --git a/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp b/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp 71index 009c05e18..237c5e16f 100644 72--- a/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp 73+++ b/framework/platform/lnx/X11/tcuLnxX11EglDisplayFactory.cpp 74@@ -75,7 +75,7 @@ class Library : public eglw::DefaultLibrary 75 { 76 public: 77 Library (void) 78- : eglw::DefaultLibrary("libEGL.so") 79+ : eglw::DefaultLibrary("libEGL.so.1") 80 { 81 } 82 83diff --git a/framework/platform/lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp b/framework/platform/lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp 84index 97bc3a0ed..3a20d63d3 100644 85--- a/framework/platform/lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp 86+++ b/framework/platform/lnx/wayland/tcuLnxWaylandEglDisplayFactory.cpp 87@@ -66,7 +66,7 @@ public: 88 EGL_PLATFORM_WAYLAND_KHR, 89 "EGL_KHR_platform_wayland") 90 , m_display (waylandDisplay) 91- , m_library ("libEGL.so") {} 92+ , m_library ("libEGL.so.1") {} 93 94 ~Display(void) {} 95 wayland::Display& getWaylandDisplay (void) { return *m_display; } 96diff --git a/framework/platform/surfaceless/tcuSurfacelessPlatform.cpp b/framework/platform/surfaceless/tcuSurfacelessPlatform.cpp 97index 9783eaeab..a1d8ac667 100644 98--- a/framework/platform/surfaceless/tcuSurfacelessPlatform.cpp 99+++ b/framework/platform/surfaceless/tcuSurfacelessPlatform.cpp 100@@ -69,7 +69,7 @@ using std::vector; 101 102 // Default library names 103 #if !defined(DEQP_GLES2_LIBRARY_PATH) 104-# define DEQP_GLES2_LIBRARY_PATH "libGLESv2.so" 105+# define DEQP_GLES2_LIBRARY_PATH "libGLESv2.so.2" 106 #endif 107 108 #if !defined(DEQP_GLES3_LIBRARY_PATH) 109@@ -77,7 +77,7 @@ using std::vector; 110 #endif 111 112 #if !defined(DEQP_OPENGL_LIBRARY_PATH) 113-# define DEQP_OPENGL_LIBRARY_PATH "libGL.so" 114+# define DEQP_OPENGL_LIBRARY_PATH "libGL.so.1" 115 #endif 116 117 namespace tcu 118@@ -238,7 +238,7 @@ glu::RenderContext* ContextFactory::createContext(const glu::RenderConfig& confi 119 } 120 121 EglRenderContext::EglRenderContext(const glu::RenderConfig& config, const tcu::CommandLine& cmdLine) 122- : m_egl("libEGL.so") 123+ : m_egl("libEGL.so.1") 124 , m_contextType(config.type) 125 , m_eglDisplay(EGL_NO_DISPLAY) 126 , m_eglContext(EGL_NO_CONTEXT) 127