0004-QLibrary-Unix-do-not-attempt-to-load-a-library-relat.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From e6f1fde24f77f63fb16b2df239f82a89d2bf05dd Mon Sep 17 00:00:00 2001
  2. From: Thiago Macieira <thiago.macieira@intel.com>
  3. Date: Fri, 10 Jan 2020 09:26:27 -0800
  4. Subject: [PATCH] QLibrary/Unix: do not attempt to load a library relative to
  5. $PWD
  6. I added the code in commit 5219c37f7c98f37f078fee00fe8ca35d83ff4f5d to
  7. find libraries in a haswell/ subdir of the main path, but we only need
  8. to do that transformation if the library is contains at least one
  9. directory seprator. That is, if the user asks to load "lib/foo", then we
  10. should try "lib/haswell/foo" (often, the path prefix will be absolute).
  11. When the library name the user requested has no directory separators, we
  12. let dlopen() do the transformation for us. Testing on Linux confirms
  13. glibc does so:
  14. $ LD_DEBUG=libs /lib64/ld-linux-x86-64.so.2 --inhibit-cache ./qml -help |& grep Xcursor
  15. 1972475: find library=libXcursor.so.1 [0]; searching
  16. 1972475: trying file=/usr/lib64/haswell/avx512_1/libXcursor.so.1
  17. 1972475: trying file=/usr/lib64/haswell/libXcursor.so.1
  18. 1972475: trying file=/usr/lib64/libXcursor.so.1
  19. 1972475: calling init: /usr/lib64/libXcursor.so.1
  20. 1972475: calling fini: /usr/lib64/libXcursor.so.1 [0]
  21. Fixes: QTBUG-81272
  22. Change-Id: I596aec77785a4e4e84d5fffd15e89689bb91ffbb
  23. Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
  24. Upstream: https://code.qt.io/cgit/qt/qtbase.git/commit/?id=e6f1fde24f77f63fb16b2df239f82a89d2bf05dd
  25. Signed-off-by: Peter Seiderer <ps.report@gmx.net>
  26. ---
  27. src/corelib/plugin/qlibrary_unix.cpp | 4 +++-
  28. 1 file changed, 3 insertions(+), 1 deletion(-)
  29. diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
  30. index f0de1010d7..135b82cd37 100644
  31. --- a/src/corelib/plugin/qlibrary_unix.cpp
  32. +++ b/src/corelib/plugin/qlibrary_unix.cpp
  33. @@ -1,7 +1,7 @@
  34. /****************************************************************************
  35. **
  36. ** Copyright (C) 2016 The Qt Company Ltd.
  37. -** Copyright (C) 2018 Intel Corporation
  38. +** Copyright (C) 2020 Intel Corporation
  39. ** Contact: https://www.qt.io/licensing/
  40. **
  41. ** This file is part of the QtCore module of the Qt Toolkit.
  42. @@ -218,6 +218,8 @@ bool QLibraryPrivate::load_sys()
  43. for(int suffix = 0; retry && !pHnd && suffix < suffixes.size(); suffix++) {
  44. if (!prefixes.at(prefix).isEmpty() && name.startsWith(prefixes.at(prefix)))
  45. continue;
  46. + if (path.isEmpty() && prefixes.at(prefix).contains(QLatin1Char('/')))
  47. + continue;
  48. if (!suffixes.at(suffix).isEmpty() && name.endsWith(suffixes.at(suffix)))
  49. continue;
  50. if (loadHints & QLibrary::LoadArchiveMemberHint) {
  51. --
  52. 2.25.0