QtBase  v6.3.1
qlibraryinfo.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2021 The Qt Company Ltd.
4 ** Copyright (C) 2021 Intel Corporation.
5 ** Contact: https://www.qt.io/licensing/
6 **
7 ** This file is part of the QtCore module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** Commercial License Usage
11 ** Licensees holding valid commercial Qt licenses may use this file in
12 ** accordance with the commercial license agreement provided with the
13 ** Software or, alternatively, in accordance with the terms contained in
14 ** a written agreement between you and The Qt Company. For licensing terms
15 ** and conditions see https://www.qt.io/terms-conditions. For further
16 ** information use the contact form at https://www.qt.io/contact-us.
17 **
18 ** GNU Lesser General Public License Usage
19 ** Alternatively, this file may be used under the terms of the GNU Lesser
20 ** General Public License version 3 as published by the Free Software
21 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
22 ** packaging of this file. Please review the following information to
23 ** ensure the GNU Lesser General Public License version 3 requirements
24 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
25 **
26 ** GNU General Public License Usage
27 ** Alternatively, this file may be used under the terms of the GNU
28 ** General Public License version 2.0 or (at your option) the GNU General
29 ** Public license version 3 or any later version approved by the KDE Free
30 ** Qt Foundation. The licenses are as published by the Free Software
31 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32 ** included in the packaging of this file. Please review the following
33 ** information to ensure the GNU General Public License requirements will
34 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35 ** https://www.gnu.org/licenses/gpl-3.0.html.
36 **
37 ** $QT_END_LICENSE$
38 **
39 ****************************************************************************/
40 
41 #include "qdir.h"
42 #include "qstringlist.h"
43 #include "qfile.h"
44 #if QT_CONFIG(settings)
45 #include "qsettings.h"
46 #endif
47 #include "qlibraryinfo.h"
48 #include "qlibraryinfo_p.h"
49 #include "qscopedpointer.h"
50 
51 #include "qcoreapplication.h"
52 
53 #include "private/qglobal_p.h"
54 #include "archdetect.cpp"
55 #include "qconfig.cpp"
56 
57 #ifdef Q_OS_DARWIN
58 # include "private/qcore_mac_p.h"
59 #endif // Q_OS_DARWIN
60 
61 #if QT_CONFIG(relocatable) && QT_CONFIG(dlopen) && !QT_CONFIG(framework)
62 # include <dlfcn.h>
63 #endif
64 
65 #if QT_CONFIG(relocatable) && defined(Q_OS_WIN)
66 # include <qt_windows.h>
67 #endif
68 
70 
71 extern void qDumpCPUFeatures(); // in qsimd.cpp
72 
73 #if QT_CONFIG(settings)
74 
75 static QSettings *findConfiguration();
76 
77 struct QLibrarySettings
78 {
79  QLibrarySettings();
80  void load();
81  bool havePaths();
82  QSettings *configuration();
83 
85  bool paths;
86  bool reloadOnQAppAvailable;
87 };
88 Q_GLOBAL_STATIC(QLibrarySettings, qt_library_settings)
89 
90 QLibrarySettings::QLibrarySettings() : paths(false), reloadOnQAppAvailable(false)
91 {
92  load();
93 }
94 
95 QSettings *QLibrarySettings::configuration()
96 {
97  if (reloadOnQAppAvailable && QCoreApplication::instance() != nullptr)
98  load();
99  return settings.data();
100 }
101 
102 bool QLibrarySettings::havePaths()
103 {
104  if (reloadOnQAppAvailable && QCoreApplication::instance() != nullptr)
105  load();
106  return paths;
107 }
108 
110 {
111  // If we get any settings here, those won't change when the application shows up.
112  settings.reset(findConfiguration());
113  reloadOnQAppAvailable = (settings.data() == nullptr && QCoreApplication::instance() == nullptr);
114 
115  if (settings) {
116  // This code needs to be in the regular library, as otherwise a qt.conf that
117  // works for qmake would break things for dynamically built Qt tools.
118  QStringList children = settings->childGroups();
119  paths = !children.contains(QLatin1String("Platforms"))
120  || children.contains(QLatin1String("Paths"));
121  }
122 }
123 
124 static QSettings *findConfiguration()
125 {
126  if (QLibraryInfoPrivate::qtconfManualPath)
127  return new QSettings(*QLibraryInfoPrivate::qtconfManualPath, QSettings::IniFormat);
128 
129  QString qtconfig = QStringLiteral(":/qt/etc/qt.conf");
130  if (QFile::exists(qtconfig))
131  return new QSettings(qtconfig, QSettings::IniFormat);
132 #ifdef Q_OS_DARWIN
133  CFBundleRef bundleRef = CFBundleGetMainBundle();
134  if (bundleRef) {
135  QCFType<CFURLRef> urlRef = CFBundleCopyResourceURL(bundleRef,
136  QCFString(QLatin1String("qt.conf")),
137  0,
138  0);
139  if (urlRef) {
140  QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
141  qtconfig = QDir::cleanPath(path);
142  if (QFile::exists(qtconfig))
143  return new QSettings(qtconfig, QSettings::IniFormat);
144  }
145  }
146 #endif
149  qtconfig = pwd.filePath(QLatin1String("qt" QT_STRINGIFY(QT_VERSION_MAJOR) ".conf"));
150  if (QFile::exists(qtconfig))
151  return new QSettings(qtconfig, QSettings::IniFormat);
152  qtconfig = pwd.filePath(QLatin1String("qt.conf"));
153  if (QFile::exists(qtconfig))
154  return new QSettings(qtconfig, QSettings::IniFormat);
155  }
156  return nullptr; //no luck
157 }
158 
159 const QString *QLibraryInfoPrivate::qtconfManualPath = nullptr;
160 
161 QSettings *QLibraryInfoPrivate::configuration()
162 {
163  QLibrarySettings *ls = qt_library_settings();
164  return ls ? ls->configuration() : nullptr;
165 }
166 
167 void QLibraryInfoPrivate::reload()
168 {
169  if (qt_library_settings.exists())
170  qt_library_settings->load();
171 }
172 
173 static bool havePaths() {
174  QLibrarySettings *ls = qt_library_settings();
175  return ls && ls->havePaths();
176 }
177 
178 #endif // settings
179 
205 QLibraryInfo::QLibraryInfo()
206 { }
207 
208 #if defined(Q_CC_INTEL) // must be before GNU, Clang and MSVC because ICC/ICL claim to be them
209 # ifdef __INTEL_CLANG_COMPILER
210 # define ICC_COMPAT "Clang"
211 # elif defined(__INTEL_MS_COMPAT_LEVEL)
212 # define ICC_COMPAT "Microsoft"
213 # elif defined(__GNUC__)
214 # define ICC_COMPAT "GCC"
215 # else
216 # define ICC_COMPAT "no"
217 # endif
218 # if __INTEL_COMPILER == 1300
219 # define ICC_VERSION "13.0"
220 # elif __INTEL_COMPILER == 1310
221 # define ICC_VERSION "13.1"
222 # elif __INTEL_COMPILER == 1400
223 # define ICC_VERSION "14.0"
224 # elif __INTEL_COMPILER == 1500
225 # define ICC_VERSION "15.0"
226 # else
227 # define ICC_VERSION QT_STRINGIFY(__INTEL_COMPILER)
228 # endif
229 # ifdef __INTEL_COMPILER_UPDATE
230 # define COMPILER_STRING "Intel(R) C++ " ICC_VERSION "." QT_STRINGIFY(__INTEL_COMPILER_UPDATE) \
231  " build " QT_STRINGIFY(__INTEL_COMPILER_BUILD_DATE) " [" \
232  ICC_COMPAT " compatibility]"
233 # else
234 # define COMPILER_STRING "Intel(R) C++ " ICC_VERSION \
235  " build " QT_STRINGIFY(__INTEL_COMPILER_BUILD_DATE) " [" \
236  ICC_COMPAT " compatibility]"
237 # endif
238 #elif defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
239 # ifdef __apple_build_version__ // Apple clang has other version numbers
240 # define COMPILER_STRING "Clang " __clang_version__ " (Apple)"
241 # else
242 # define COMPILER_STRING "Clang " __clang_version__
243 # endif
244 #elif defined(Q_CC_GHS)
245 # define COMPILER_STRING "GHS " QT_STRINGIFY(__GHS_VERSION_NUMBER)
246 #elif defined(Q_CC_GNU)
247 # define COMPILER_STRING "GCC " __VERSION__
248 #elif defined(Q_CC_MSVC)
249 # if _MSC_VER < 1910
250 # define COMPILER_STRING "MSVC 2015"
251 # elif _MSC_VER < 1917
252 # define COMPILER_STRING "MSVC 2017"
253 # elif _MSC_VER < 1930
254 # define COMPILER_STRING "MSVC 2019"
255 # elif _MSC_VER < 2000
256 # define COMPILER_STRING "MSVC 2022"
257 # else
258 # define COMPILER_STRING "MSVC _MSC_VER " QT_STRINGIFY(_MSC_VER)
259 # endif
260 #else
261 # define COMPILER_STRING "<unknown compiler>"
262 #endif
263 #ifdef QT_NO_DEBUG
264 # define DEBUG_STRING " release"
265 #else
266 # define DEBUG_STRING " debug"
267 #endif
268 #ifdef QT_SHARED
269 # define SHARED_STRING " shared (dynamic)"
270 #else
271 # define SHARED_STRING " static"
272 #endif
273 #define QT_BUILD_STR "Qt " QT_VERSION_STR " (" ARCH_FULL SHARED_STRING DEBUG_STRING " build; by " COMPILER_STRING ")"
274 
283 const char *QLibraryInfo::build() noexcept
284 {
285  return QT_BUILD_STR;
286 }
287 
293 bool
295 {
296 #ifdef QT_DEBUG
297  return true;
298 #else
299  return false;
300 #endif
301 }
302 
310 {
311  return QVersionNumber(QT_VERSION_MAJOR, QT_VERSION_MINOR, QT_VERSION_PATCH);
312 }
313 
314 static QString prefixFromAppDirHelper()
315 {
316  QString appDir;
317 
319 #ifdef Q_OS_DARWIN
320  CFBundleRef bundleRef = CFBundleGetMainBundle();
321  if (bundleRef) {
322  QCFType<CFURLRef> urlRef = CFBundleCopyBundleURL(bundleRef);
323  if (urlRef) {
324  QCFString path = CFURLCopyFileSystemPath(urlRef, kCFURLPOSIXPathStyle);
325 #ifdef Q_OS_MACOS
326  QString bundleContentsDir = QString(path) + QLatin1String("/Contents/");
327  if (QDir(bundleContentsDir).exists())
328  return QDir::cleanPath(bundleContentsDir);
329 #else
330  return QDir::cleanPath(QString(path)); // iOS
331 #endif // Q_OS_MACOS
332  }
333  }
334 #endif // Q_OS_DARWIN
335  // We make the prefix path absolute to the executable's directory.
337  } else {
338  appDir = QDir::currentPath();
339  }
340 
341  return appDir;
342 }
343 
344 #if QT_CONFIG(relocatable)
345 #if !defined(QT_STATIC) && !(defined(Q_OS_DARWIN) && QT_CONFIG(framework)) \
346  && (QT_CONFIG(dlopen) || defined(Q_OS_WIN))
347 static QString prefixFromQtCoreLibraryHelper(const QString &qtCoreLibraryPath)
348 {
349  const QString qtCoreLibrary = QDir::fromNativeSeparators(qtCoreLibraryPath);
350  const QString libDir = QFileInfo(qtCoreLibrary).absolutePath();
351  const QString prefixDir = libDir + QLatin1Char('/')
352  + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH);
353  return QDir::cleanPath(prefixDir);
354 }
355 #endif
356 
357 #if defined(Q_OS_WIN)
358 static HMODULE getWindowsModuleHandle()
359 {
360  HMODULE hModule = NULL;
361  GetModuleHandleEx(
362  GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
363  (LPCTSTR)&QLibraryInfo::isDebugBuild, &hModule);
364  return hModule;
365 }
366 #endif // Q_OS_WIN
367 
368 static QString getRelocatablePrefix()
369 {
370  QString prefixPath;
371 
372  // For static builds, the prefix will be the app directory.
373  // For regular builds, the prefix will be relative to the location of the QtCore shared library.
374 #if defined(QT_STATIC)
375  prefixPath = prefixFromAppDirHelper();
376 #elif defined(Q_OS_DARWIN) && QT_CONFIG(framework)
377 #ifndef QT_LIBINFIX
378  #define QT_LIBINFIX ""
379 #endif
380  auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore" QT_LIBINFIX));
381  if (!qtCoreBundle) {
382  // When running Qt apps over Samba shares, CoreFoundation will fail to find
383  // the Resources directory inside the bundle, This directory is a symlink,
384  // and CF relies on readdir() and dtent.dt_type to detect symlinks, which
385  // does not work reliably for Samba shares. We work around it by manually
386  // looking for the QtCore bundle.
387  auto allBundles = CFBundleGetAllBundles();
388  auto bundleCount = CFArrayGetCount(allBundles);
389  for (int i = 0; i < bundleCount; ++i) {
390  auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i));
391  auto url = QCFType<CFURLRef>(CFBundleCopyBundleURL(bundle));
392  auto path = QCFType<CFStringRef>(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle));
393  if (CFStringHasSuffix(path, CFSTR("/QtCore" QT_LIBINFIX ".framework"))) {
394  qtCoreBundle = bundle;
395  break;
396  }
397  }
398  }
399  Q_ASSERT(qtCoreBundle);
400 
401  QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle);
402  Q_ASSERT(qtCorePath);
403 
404  QCFType<CFURLRef> qtCorePathAbsolute = CFURLCopyAbsoluteURL(qtCorePath);
405  Q_ASSERT(qtCorePathAbsolute);
406 
407  QCFType<CFURLRef> libDirCFPath = CFURLCreateCopyDeletingLastPathComponent(NULL, qtCorePathAbsolute);
408 
409  const QCFString libDirCFString = CFURLCopyFileSystemPath(libDirCFPath, kCFURLPOSIXPathStyle);
410 
411  const QString prefixDir = QString(libDirCFString) + QLatin1Char('/')
412  + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH);
413 
414  prefixPath = QDir::cleanPath(prefixDir);
415 #elif QT_CONFIG(dlopen)
416  Dl_info info;
417  int result = dladdr(reinterpret_cast<void *>(&QLibraryInfo::isDebugBuild), &info);
418  if (result > 0 && info.dli_fname)
419  prefixPath = prefixFromQtCoreLibraryHelper(QString::fromLocal8Bit(info.dli_fname));
420 #elif defined(Q_OS_WIN)
421  HMODULE hModule = getWindowsModuleHandle();
422  const int kBufferSize = 4096;
423  wchar_t buffer[kBufferSize];
424  DWORD pathSize = GetModuleFileName(hModule, buffer, kBufferSize);
425  const QString qtCoreFilePath = QString::fromWCharArray(buffer, int(pathSize));
426  const QString qtCoreDirPath = QFileInfo(qtCoreFilePath).absolutePath();
427  pathSize = GetModuleFileName(NULL, buffer, kBufferSize);
428  const QString exeDirPath = QFileInfo(QString::fromWCharArray(buffer, int(pathSize))).absolutePath();
429  if (QFileInfo(exeDirPath) == QFileInfo(qtCoreDirPath)) {
430  // QtCore DLL is next to the executable. This is either a windeployqt'ed executable or an
431  // executable within the QT_HOST_BIN directory. We're detecting the latter case by checking
432  // whether there's an import library corresponding to our QtCore DLL in PREFIX/lib.
433  const QString libdir = QString::fromLocal8Bit(
434  qt_configure_strs.viewAt(QLibraryInfo::LibrariesPath - 1));
435  const QLatin1Char slash('/');
436 #if defined(Q_CC_MINGW)
437  const QString implibPrefix = QStringLiteral("lib");
438  const QString implibSuffix = QStringLiteral(".a");
439 #else
440  const QString implibPrefix;
441  const QString implibSuffix = QStringLiteral(".lib");
442 #endif
443  const QString qtCoreImpLibFileName = implibPrefix
444  + QFileInfo(qtCoreFilePath).completeBaseName() + implibSuffix;
445  const QString qtCoreImpLibPath = qtCoreDirPath
446  + slash + QLatin1String(QT_CONFIGURE_LIBLOCATION_TO_PREFIX_PATH)
447  + slash + libdir
448  + slash + qtCoreImpLibFileName;
449  if (!QFileInfo::exists(qtCoreImpLibPath)) {
450  // We did not find a corresponding import library and conclude that this is a
451  // windeployqt'ed executable.
452  return exeDirPath;
453  }
454  }
455  if (!qtCoreFilePath.isEmpty())
456  prefixPath = prefixFromQtCoreLibraryHelper(qtCoreFilePath);
457 #else
458 #error "The chosen platform / config does not support querying for a dynamic prefix."
459 #endif
460 
461 #if defined(Q_OS_LINUX) && !defined(QT_STATIC) && defined(__GLIBC__)
462  // QTBUG-78948: libQt5Core.so may be located in subdirectories below libdir.
463  // See "Hardware capabilities" in the ld.so documentation and the Qt 5.3.0
464  // changelog regarding SSE2 support.
465  const QString libdir = QString::fromLocal8Bit(
466  qt_configure_strs.viewAt(QLibraryInfo::LibrariesPath - 1));
467  QDir prefixDir(prefixPath);
468  while (!prefixDir.exists(libdir)) {
469  prefixDir.cdUp();
470  prefixPath = prefixDir.absolutePath();
471  if (prefixDir.isRoot()) {
472  prefixPath.clear();
473  break;
474  }
475  }
476 #endif
477 
478  Q_ASSERT_X(!prefixPath.isEmpty(), "getRelocatablePrefix",
479  "Failed to find the Qt prefix path.");
480  return prefixPath;
481 }
482 #endif
483 
484 static QString getPrefix()
485 {
486 #if QT_CONFIG(relocatable)
487  return getRelocatablePrefix();
488 #else
489  return QString::fromLocal8Bit(QT_CONFIGURE_PREFIX_PATH);
490 #endif
491 }
492 
494 {
495  /*
496  * To add a new entry in QLibraryInfo::LibraryPath, add it to the enum
497  * in qtbase/src/corelib/global/qlibraryinfo.h and:
498  * - add its relative path in the qtConfEntries[] array below
499  * (the key is what appears in a qt.conf file)
500  */
501  static constexpr auto qtConfEntries = qOffsetStringArray(
502  "Prefix", ".",
503  "Documentation", "doc", // should be ${Data}/doc
504  "Headers", "include",
505  "Libraries", "lib",
506 #ifdef Q_OS_WIN
507  "LibraryExecutables", "bin",
508 #else
509  "LibraryExecutables", "libexec", // should be ${ArchData}/libexec
510 #endif
511  "Binaries", "bin",
512  "Plugins", "plugins", // should be ${ArchData}/plugins
513 
514  "QmlImports", "qml", // should be ${ArchData}/qml
515 
516  "ArchData", ".",
517  "Data", ".",
518  "Translations", "translations", // should be ${Data}/translations
519  "Examples", "examples",
520  "Tests", "tests"
521  );
522  static constexpr QByteArrayView dot = qtConfEntries.viewAt(1);
523  static_assert(dot.size() == 1);
524  static_assert(dot[0] == '.');
525 
527 
528  if (int(loc) < qtConfEntries.count()) {
529  result.key = QLatin1String(qtConfEntries.viewAt(loc * 2));
530  result.defaultValue = QLatin1String(qtConfEntries.viewAt(loc * 2 + 1));
531  if (result.key == u"QmlImports")
532  result.fallbackKey = u"Qml2Imports"_qs;
533 #ifndef Q_OS_WIN // On Windows we use the registry
534  } else if (loc == QLibraryInfo::SettingsPath) {
535  result.key = QLatin1String("Settings");
536  result.defaultValue = QLatin1String(dot);
537 #endif
538  }
539 
540  return result;
541 }
542 
554 {
555  const LibraryPath loc = p;
556  QString ret;
557  bool fromConf = false;
558 #if QT_CONFIG(settings)
559  if (havePaths()) {
560  fromConf = true;
561 
563  if (!li.key.isNull()) {
564  QSettings *config = QLibraryInfoPrivate::configuration();
565  Q_ASSERT(config != nullptr);
566  config->beginGroup(QLatin1String("Paths"));
567 
568  if (li.fallbackKey.isNull()) {
569  ret = config->value(li.key, li.defaultValue).toString();
570  } else {
571  QVariant v = config->value(li.key);
572  if (!v.isValid())
573  v = config->value(li.fallbackKey, li.defaultValue);
574  ret = v.toString();
575  }
576 
577  int startIndex = 0;
578  forever {
579  startIndex = ret.indexOf(QLatin1Char('$'), startIndex);
580  if (startIndex < 0)
581  break;
582  if (ret.length() < startIndex + 3)
583  break;
584  if (ret.at(startIndex + 1) != QLatin1Char('(')) {
585  startIndex++;
586  continue;
587  }
588  int endIndex = ret.indexOf(QLatin1Char(')'), startIndex + 2);
589  if (endIndex < 0)
590  break;
591  auto envVarName = QStringView{ret}.mid(startIndex + 2, endIndex - startIndex - 2);
592  QString value = QString::fromLocal8Bit(qgetenv(envVarName.toLocal8Bit().constData()));
593  ret.replace(startIndex, endIndex - startIndex + 1, value);
594  startIndex += value.length();
595  }
596 
597  config->endGroup();
598 
600  }
601  }
602 #endif // settings
603 
604  if (!fromConf) {
605  if (loc == PrefixPath) {
606  ret = getPrefix();
607  } else if (int(loc) <= qt_configure_strs.count()) {
608  ret = QString::fromLocal8Bit(qt_configure_strs.viewAt(loc - 1));
609 #ifndef Q_OS_WIN // On Windows we use the registry
610  } else if (loc == SettingsPath) {
611  // Use of volatile is a hack to discourage compilers from calling
612  // strlen(), in the inlined fromLocal8Bit(const char *)'s body, at
613  // compile-time, as Qt installers binary-patch the path, replacing
614  // the dummy path seen at compile-time, typically changing length.
615  const char *volatile path = QT_CONFIGURE_SETTINGS_PATH;
617 #endif
618  }
619  }
620 
621  if (!ret.isEmpty() && QDir::isRelativePath(ret)) {
622  QString baseDir;
623  if (loc == PrefixPath) {
624  baseDir = prefixFromAppDirHelper();
625  } else {
626  // we make any other path absolute to the prefix directory
627  baseDir = path(PrefixPath);
628  }
629  ret = QDir::cleanPath(baseDir + QLatin1Char('/') + ret);
630  }
631  return ret;
632 }
633 
648 {
649 #if QT_CONFIG(settings)
650  QScopedPointer<const QSettings> settings(findConfiguration());
651  if (!settings.isNull()) {
652  const QString key = QLatin1String("Platforms")
653  + QLatin1Char('/')
654  + platformName
655  + QLatin1String("Arguments");
656  return settings->value(key).toStringList();
657  }
658 #else
659  Q_UNUSED(platformName);
660 #endif // settings
661  return QStringList();
662 }
663 
696 
697 #if defined(Q_CC_GNU) && defined(ELF_INTERPRETER)
698 # include <elf.h>
699 # include <stdio.h>
700 # include <stdlib.h>
701 
702 #include "private/qcoreapplication_p.h"
703 
704 QT_WARNING_DISABLE_GCC("-Wformat-overflow")
705 QT_WARNING_DISABLE_GCC("-Wattributes")
706 QT_WARNING_DISABLE_CLANG("-Wattributes")
708 
709 # if defined(Q_OS_LINUX)
710 # include "minimum-linux_p.h"
711 # endif
712 # ifdef QT_ELF_NOTE_OS_TYPE
713 struct ElfNoteAbiTag
714 {
715  static_assert(sizeof(Elf32_Nhdr) == sizeof(Elf64_Nhdr),
716  "The size of an ELF note is wrong (should be 12 bytes)");
717  struct Payload {
718  Elf32_Word ostype = QT_ELF_NOTE_OS_TYPE;
719  Elf32_Word major = QT_ELF_NOTE_OS_MAJOR;
720  Elf32_Word minor = QT_ELF_NOTE_OS_MINOR;
721 # ifdef QT_ELF_NOTE_OS_PATCH
722  Elf32_Word patch = QT_ELF_NOTE_OS_PATCH;
723 # endif
724  };
725 
726  Elf32_Nhdr header = {
727  .n_namesz = sizeof(name),
728  .n_descsz = sizeof(Payload),
729  .n_type = NT_GNU_ABI_TAG
730  };
731  char name[sizeof ELF_NOTE_GNU] = ELF_NOTE_GNU; // yes, include the null terminator
732  Payload payload = {};
733 };
734 __attribute__((section(".note.ABI-tag"), aligned(4), used))
735 extern constexpr ElfNoteAbiTag QT_MANGLE_NAMESPACE(qt_abi_tag) = {};
736 # endif
737 
738 extern const char qt_core_interpreter[] __attribute__((section(".interp")))
739  = ELF_INTERPRETER;
740 
741 extern "C" void qt_core_boilerplate() __attribute__((force_align_arg_pointer));
742 void qt_core_boilerplate()
743 {
744  printf("This is the QtCore library version " QT_BUILD_STR "\n"
745  "Copyright (C) 2016 The Qt Company Ltd.\n"
746  "Contact: http://www.qt.io/licensing/\n"
747  "\n"
748  "Installation prefix: %s\n"
749  "Library path: %s\n"
750  "Plugin path: %s\n",
751  QT_CONFIGURE_PREFIX_PATH,
752  qt_configure_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::LibrariesPath - 1],
753  qt_configure_strs[QT_PREPEND_NAMESPACE(QLibraryInfo)::PluginsPath - 1]);
754 
756 
757  exit(0);
758 }
759 
760 #endif
small capitals from c petite p scientific f u
Definition: afcover.h:88
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
const QByteArray payload("Qt rocks!")
static QCoreApplication * instance()
static QString applicationDirPath()
The QDir class provides access to directory structures and their contents.
Definition: qdir.h:55
static bool isRelativePath(const QString &path)
Definition: qdir.cpp:2364
static QString fromNativeSeparators(const QString &pathName)
Definition: qdir.cpp:949
static QString cleanPath(const QString &path)
Definition: qdir.cpp:2350
static QString currentPath()
Definition: qdir.cpp:2006
bool exists() const
Definition: qfile.cpp:376
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:57
QString completeBaseName() const
Definition: qfileinfo.cpp:835
QString absolutePath() const
Definition: qfileinfo.cpp:599
bool exists() const
Definition: qfileinfo.cpp:697
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
Definition: qstring.h:84
The QLibraryInfo class provides information about the Qt library.
Definition: qlibraryinfo.h:50
static bool isDebugBuild()
static QStringList platformPluginArguments(const QString &platformName)
static QString path(LibraryPath p)
static QVersionNumber version() noexcept Q_DECL_CONST_FUNCTION
static const char * build() noexcept
static LocationInfo locationInfo(QLibraryInfo::LibraryPath loc)
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
The QSettings class provides persistent platform-independent application settings.
Definition: qsettings.h:66
@ IniFormat
Definition: qsettings.h:86
QVariant value(const QString &key, const QVariant &defaultValue) const
Definition: qsettings.cpp:3288
QStringList childGroups() const
Definition: qsettings.cpp:3105
The QString class provides a Unicode character string.
Definition: qstring.h:388
static QString fromLocal8Bit(QByteArrayView ba)
Definition: qstring.cpp:5563
void clear()
Definition: qstring.h:1240
bool isEmpty() const
Definition: qstring.h:1216
static QString fromWCharArray(const wchar_t *string, qsizetype size=-1)
The QStringList class provides a list of strings.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
Definition: qstringview.h:122
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
QStringList toStringList() const
Definition: qvariant.cpp:1396
The QVersionNumber class contains a version number with an arbitrary number of segments.
p1 load("image.bmp")
#define NULL
Definition: ftobjs.h:61
#define forever
Definition: ftrandom.c:53
#define __attribute__(x)
Definition: hb.hh:256
backing_store_ptr info
[4]
Definition: jmemsys.h:161
#define QT_ELF_NOTE_OS_PATCH
#define QT_ELF_NOTE_OS_TYPE
#define QT_ELF_NOTE_OS_MINOR
#define QT_ELF_NOTE_OS_MAJOR
#define QString()
Definition: parse-defines.h:51
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld[DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld endif[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld SRC pixld MASK if DST_R else pixld DST_R endif if
int loc
Definition: property.cpp:46
#define QT_WARNING_DISABLE_INTEL(number)
#define QT_WARNING_DISABLE_GCC(text)
#define QT_WARNING_DISABLE_CLANG(text)
QList< QString > QStringList
Definition: qcontainerfwd.h:64
EGLOutputLayerEXT EGLint EGLAttrib value
#define QT_STRINGIFY(x)
Definition: qglobal.h:131
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
#define QT_BUILD_STR
QT_BEGIN_NAMESPACE void qDumpCPUFeatures()
Definition: qsimd.cpp:634
constexpr auto qOffsetStringArray(const char(&...strings)[Nx]) noexcept
GLsizei const GLfloat * v
[13]
GLuint64 key
GLenum GLuint buffer
GLsizei const GLuint * paths
GLuint name
GLsizei const GLchar *const * path
Definition: qopenglext.h:4283
GLuint64EXT * result
[6]
Definition: qopenglext.h:10932
GLfloat GLfloat p
[1]
Definition: qopenglext.h:12698
#define Q_ASSERT(cond)
Definition: qrandom.cpp:84
#define Q_ASSERT_X(cond, x, msg)
Definition: qrandom.cpp:85
Int aligned(Int v, Int byteAlign)
Definition: qrhid3d11.cpp:165
int QT_PREPEND_NAMESPACE(QSharedMemoryPrivate)
#define QStringLiteral(str)
HINSTANCE HMODULE
Q_UNUSED(salary)
[21]
QString bundle
QSettings settings("MySoft", "Star Runner")
[0]
QUrl url("http://www.example.com/List of holidays.xml")
[0]
QHttpRequestHeader header("GET", QUrl::toPercentEncoding("/index.html"))
[1]
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:53