Move the check for -fPIC compile flag to qcompilerdetection.h

Task-number: QTBUG-99313
Change-Id: I9072b73a75599381f5f2be0799bca5bf149122de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Sona Kurazyan 2022-07-28 13:04:46 +02:00
parent ff8de321e2
commit 349e74c06c
2 changed files with 7 additions and 7 deletions

View File

@ -1203,4 +1203,11 @@ static_assert(!std::is_convertible_v<std::nullptr_t, bool>,
"On MSVC you must pass the /permissive- option to the compiler.");
#endif
#if defined(QT_BOOTSTRAPPED) || defined(QT_USE_PROTECTED_VISIBILITY) || !defined(__ELF__) || defined(__PIC__)
// this is fine
#elif defined(QT_REDUCE_RELOCATIONS)
# error "You must build your code with position independent code if Qt was configured with -reduce-relocations. "\
"Compile your code with -fPIC (and not with -fPIE)."
#endif
#endif // QCOMPILERDETECTION_H

View File

@ -1227,13 +1227,6 @@ Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nu
#define QT_MODULE(x)
#if defined(QT_BOOTSTRAPPED) || defined(QT_USE_PROTECTED_VISIBILITY) || !defined(__ELF__) || defined(__PIC__)
// this is fine
#elif defined(QT_REDUCE_RELOCATIONS)
# error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\
"Compile your code with -fPIC (and not with -fPIE)."
#endif
// This macro can be used to calculate member offsets for types with a non standard layout.
// It uses the fact that offsetof() is allowed to support those types since C++17 as an optional
// feature. All our compilers do support this, but some issue a warning, so we wrap the offsetof()