qt5base-lts/mkspecs/features
Thiago Macieira 19b7f854a2 Enable -mno-direct-extern-access and ELF protected visibility
The -mno-direct-extern-access tells the compiler and linker that
references to symbols outside this ELF module mustn't be direct and must
instead always go through the GOT or PLT (the PLT can additionally be
disabled with -fno-plt). The ELF protected visibility tells the compiler
and linker that this symbol is present in the dynamic symbol table as an
export, but it cannot be interposed by another ELF module.

This option is required for user code to link properly to Qt, otherwise
they will get linker errors (assuming GNU binutils >= 2.39) or runtime
failures (glibc >= 2.35). Both versions of glibc and binutils are older
than GCC 12, so it's a safe assumption they are in use and downgrading
the toolchain or libc is not supported. Adding this option to the
compilation is assured for CMake and qmake-based projects.

For example, all accessess to QCoreApplication::self in QtCore, after
this change and with GCC 12 are relocation-free and direct:

000000000013ebf0 <QCoreApplicationPrivate::checkInstance(char const*)>:
  13ebf0:       cmpq   $0x0,0x4f73d0(%rip)        # 635fc8 <QCoreApplication::self>
  13ebf8:       setne  %al
  13ebfb:       je     a90fe <QCoreApplicationPrivate::checkInstance(char const*) [clone .cold]>
  13ec01:       ret

Meanwhile, accesses to the same variable in other modules are indirect
via the GOT:

   66650:       mov    0x876e1(%rip),%rax        # edd38 <QCoreApplication::self@Qt_6>
   66657:       cmpq   $0x0,(%rax)

This replaces the -Bsymbolic and -Bsymbolic-functions (broken)
functionality that Qt has been using or attempting to use since ~2006.

See https://gitlab.com/x86-psABIs/x86-64-ABI/-/issues/8#note_606975128

Change-Id: Iad4b0a3e5c06570b9f5f571b26ed564aa0811e47
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-03-10 17:10:57 -08:00
..
android android:qmake: Fix static libraries to include the QT_ARCH suffix 2021-12-02 20:29:58 +01:00
data CMake: Remove old Qt 5 CMake build system files 2020-10-01 14:57:16 +02:00
mac Fix version number when warning about Apple platform SDK mismatch 2021-11-03 17:12:47 +01:00
uikit iOS: Use generic simulator device for building apps via xcodebuild 2021-12-23 15:26:35 +00:00
unix Enable -mno-direct-extern-access and ELF protected visibility 2022-03-10 17:10:57 -08:00
unsupported Revert "Disable Docker-based test servers on Windows temporarily" 2019-07-09 13:49:18 +02:00
wasm wasm: don’t pass thread linker opts to compiler 2022-01-17 09:01:20 +00:00
win32 Generalize the winmain/qtmain entry-point library 2020-10-17 12:13:00 +02:00
benchmark.prf mkspecs: Add a benchmark "feature". 2016-03-02 21:24:54 +00:00
build_pass.prf
cmake_functions.prf CMake: Don't hard-code the sysroot in Qt5XXXConfigExtras.cmake 2020-05-14 21:36:59 +02:00
cmdline.prf Add cmdline feature to qmake 2019-02-18 07:12:14 +00:00
configure_base.prf configure: cache test output as well 2018-04-10 18:51:13 +00:00
configure.prf Remove winrt 2020-06-06 20:25:49 +02:00
coverage.prf configure: Add switch for clang's "source-based" code coverage feature 2020-01-28 20:26:15 +00:00
create_cmake.prf Merge remote-tracking branch 'origin/5.14' into 5.15 2020-01-29 01:00:56 +01:00
ctest_testcase_common.prf Remove ANGLE 2020-05-26 15:11:40 +02:00
ctest_testcase_installed.prf Only run the cmake test in the install location if not already done. 2013-07-15 21:56:51 +02:00
ctest_testcase.prf Always use forward slashes in paths passed to cmake. 2013-07-10 13:05:01 +02:00
dbusadaptors.prf de-duplicate dbusadaptors.prf vs. dbusinterfaces.prf 2012-08-04 00:52:38 +02:00
dbuscommon.pri don't override user-provided dependencies for our extra compilers 2016-06-23 13:25:22 +00:00
dbusinterfaces.prf de-duplicate dbusadaptors.prf vs. dbusinterfaces.prf 2012-08-04 00:52:38 +02:00
declarative_debug.prf Rename quick1_debug back to declarative_debug 2012-10-04 03:03:00 +02:00
default_post.prf Add c++20 alias for c++2a in qmake default mkspecs features 2022-02-10 15:30:48 +00:00
default_pre.prf Remove last trace of licheck 2021-04-07 11:00:41 +00:00
designer_defines.prf dispose of library-bound feature files 2012-06-19 16:39:52 +02:00
device_config.prf nuke configure -host-option 2016-12-13 18:55:59 +00:00
egl.prf qmake: make CONFIG+=egl work again 2019-01-07 19:07:02 +00:00
entrypoint.prf Move iOS entrypoint logic to entrypoint library 2020-11-10 16:53:31 +01:00
exceptions_off.prf turn off exceptions by default where they aren't required 2012-05-17 05:14:26 +02:00
exceptions.prf turn off exceptions by default where they aren't required 2012-05-17 05:14:26 +02:00
exclusive_builds_post.prf Say hello to Android multi arch build in one go 2019-08-26 12:59:15 +03:00
exclusive_builds.prf Fix duplicates in QMAKE_DIR_REPLACE 2019-07-10 12:35:52 +02:00
file_copies.prf qmake: Fix COPIES for Visual Studio projects 2019-02-21 06:43:56 +00:00
gc_binaries.prf Make the use of -fdata-sections and --gc-sections more generic in Qt 2018-04-27 06:47:35 +00:00
gcov.prf Distinguish between Objective-C and Objective-C++ sources 2015-10-09 15:15:17 +00:00
include_source_dir.prf
incredibuild_xge.prf untangle use of system vs. shell path(-list) semantics 2014-04-30 16:56:54 +02:00
java.prf Android: bump default javac build versions to 8 2020-09-16 20:55:10 +03:00
lex.prf Fix parallel lex/yacc invocation for debug_and_release builds 2019-06-06 15:21:37 +02:00
link_ltcg.prf Support different job counts also for ICC LTO 2017-04-07 17:45:04 +00:00
link_pkgconfig.prf make the pkg-config error message more precise 2014-01-07 19:45:15 +01:00
lrelease.prf Fix .qm file name calculation in lrelease.prf 2021-09-10 23:27:15 +02:00
ltcg.prf Merge remote-tracking branch 'origin/5.13' into 5.14 2019-11-13 07:21:33 +01:00
metatypes.prf Fix qmake's metatype generation feature after moving moc to libexec 2021-02-25 16:10:13 +01:00
moc.prf Move build tools to libexec instead of the bin dir 2021-02-23 17:02:30 +01:00
no_debug_info.prf qmake: Remove Windows CE support. 2016-03-10 13:33:44 +00:00
plugin_bundle.prf Ensure that CONFIG += plugin_bundle will create Mach-O bundles on OSX/iOS 2015-05-24 11:46:14 +00:00
precompile_header.prf Fix build with precompile headers 2014-01-14 10:38:29 +01:00
qgltf.prf don't override user-provided dependencies for our extra compilers 2016-06-23 13:25:22 +00:00
qlalr.prf Move build tools to libexec instead of the bin dir 2021-02-23 17:02:30 +01:00
qmake_use.prf Revert "configure: actually resolve libraries into full filepaths" 2019-09-13 10:47:38 +02:00
qml_debug.prf Rename the 'declarative debug support' to 'qml debug support' 2012-03-31 16:33:04 +02:00
qml_module.prf Android: Install the qmldir files when configuring for a single abi 2020-08-03 16:47:31 +02:00
qml_plugin.prf qml_plugin.prf: Use and prefer QML_IMPORT_VERSION over IMPORT_VERSION 2020-01-17 11:16:44 +01:00
qmltestcase.prf Fix running qml tests on Android 2020-08-24 14:50:56 +03:00
qt_android_deps.prf Android: Install the qmldir files when configuring for a single abi 2020-08-03 16:47:31 +02:00
qt_app.prf Make the use of -fdata-sections and --gc-sections more generic in Qt 2018-04-27 06:47:35 +00:00
qt_build_config.prf qmake: Allow using Windows 10 API in MinGW qmake internal projects 2022-01-21 19:55:27 +01:00
qt_build_extra.prf Merge remote-tracking branch 'origin/5.7' into 5.8 2016-08-29 15:30:17 +02:00
qt_build_paths.prf CMake: Use target install prefix for MODULE_BASE_OUTDIR 2020-07-01 10:03:50 +02:00
qt_clear_installs.prf disable install targets for non-prefix builds 2016-01-12 15:16:37 +00:00
qt_common.prf Make configure -force-asserts affect the Qt build only 2020-08-27 22:13:50 +02:00
qt_config.prf qmake: Introduce QT_HOST_LIBEXECS property 2021-02-18 11:46:42 +01:00
qt_configure.prf Make configure -qmake actually work 2020-10-20 09:16:27 +02:00
qt_docs_targets.prf generalize references to exclusive builds 2016-07-13 14:27:07 +00:00
qt_docs.prf Doc build: fix conflicting response file with moc 2021-11-29 22:50:00 +02:00
qt_example_installs.prf Allow building Qt examples with qmake in-source 2021-06-12 11:06:10 +02:00
qt_functions.prf Move build tools to libexec instead of the bin dir 2021-02-23 17:02:30 +01:00
qt_helper_lib.prf Install 3rd party headers and meta for static builds 2020-11-16 13:08:04 +01:00
qt_installs.prf Fix install targets for generated private headers 2019-02-06 07:17:46 +00:00
qt_module_headers.prf Move syncqt.pl to libexec 2021-03-04 09:56:07 +01:00
qt_module_pris.prf Don't rely on the module.pri for the entrypoint linking to the library 2020-11-09 18:08:06 +01:00
qt_module.prf Win32: Enable large address aware explicitly 2021-11-26 16:42:53 +08:00
qt_parts.prf Configure: Do not automatically enable compilation of examples for tests 2020-05-19 08:42:19 +02:00
qt_plugin.prf CMake: Remove old Qt 5 CMake build system files 2020-10-01 14:57:16 +02:00
qt_prefix_build_check.prf CMake/qmake: Fix qtIsPrefixBuild for a CMake-built qtbase 2020-04-08 15:14:09 +02:00
qt_targets.prf Update copyright year to 2022 2022-01-04 12:44:19 +01:00
qt_test_helper.prf Add cmdline feature to qmake 2019-02-18 07:12:14 +00:00
qt_tool.prf Windows: Automatically set metadata for all Qt apps 2017-07-31 06:19:06 +00:00
qt_tracepoints.prf Move build tools to libexec instead of the bin dir 2021-02-23 17:02:30 +01:00
qt.prf Enable -mno-direct-extern-access and ELF protected visibility 2022-03-10 17:10:57 -08:00
resolve_config.prf Use qtConfig throughout in qtbase 2016-08-19 04:28:05 +00:00
resolve_target.prf Use 'A' for Apple framework version instead of Qt major version 2020-09-23 16:59:06 +02:00
resources_functions.prf Fix condition that adds resources for each Android ABI 2021-04-07 17:00:17 +02:00
resources.prf Move build tools to libexec instead of the bin dir 2021-02-23 17:02:30 +01:00
rtti_off.prf qmake: enable rtti config option for g++/clang 2018-12-13 20:51:39 +00:00
rtti.prf qmake: enable rtti config option for g++/clang 2018-12-13 20:51:39 +00:00
sanitizer.prf configure: Add sanitizer "fuzzer-no-link" 2019-11-14 15:45:02 +01:00
silent.prf Fix CONFIG+=silent for MSVC non-inference rules 2017-07-14 18:49:56 +00:00
simd.prf Add new AVX512 extensions found in Intel CLX, ICL and ICX processors 2020-02-03 11:31:49 -07:00
spec_post.prf Qmake: Introduce and use QMAKE_{SYSTEM,SHELL}_NULL_DEVICE variable, take 2 2017-10-13 13:32:36 +00:00
spec_pre.prf factor out QMAKE_USE* processing to a separate prf file 2016-10-04 20:20:06 +00:00
static_runtime.prf escape literal backslashes in qmake files 2018-12-12 17:24:39 +00:00
testcase_targets.prf mkspecs: Add a benchmark "feature". 2016-03-02 21:24:54 +00:00
testcase.prf Android: Fix make check to work for single ABI Qt for Android builds 2020-08-26 01:13:27 +02:00
testcocoon.prf fix host vs. makefile directory separator mess 2012-07-28 00:09:45 +02:00
testlib_defines.prf Fixed compilation of auto tests using vc(x)proj files 2015-05-22 14:13:00 +00:00
toolchain.prf macOS: Don't hard-code x86_64 as the architecture when using qmake 2020-12-07 15:35:55 +01:00
uic.prf Move build tools to libexec instead of the bin dir 2021-02-23 17:02:30 +01:00
use_c_linker.prf
vxworks.prf
warn_off.prf Distinguish between Objective-C and Objective-C++ sources 2015-10-09 15:15:17 +00:00
warn_on.prf Distinguish between Objective-C and Objective-C++ sources 2015-10-09 15:15:17 +00:00
wayland-scanner.prf Move qtwaylandscanner to libexec 2021-05-11 16:39:07 +00:00
xctest.prf Allow using Xcode Command Line Tools to build Qt 2017-06-29 02:00:12 +00:00
yacc.prf yacc: Output the path for the move with the right directory separator 2020-01-13 11:50:02 +00:00