summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2016-01-19 07:45:13 -0800
committerThiago Macieira <thiago.macieira@intel.com>2016-01-21 05:19:16 +0000
commit143c68436449203e83a3b2f49d9176d0e89d85a0 (patch)
tree1a50054434652ac27bdff475dd493d76cda6a118 /src/corelib/global
parentdcc36d7aa37b9b92befdf0921e2cc84506baac80 (diff)
Fix the use of R_X86_64_GOTPCREL on a 64-bit field: it should be 32-bit
The ABI says that PC-relative displacements should be on 32-bit fields, even on 64-bit builds. For -mcmodel=large, it should use R_X86_64_GOT64 relocations, like 32-bit. Task-number: QTBUG-50537 Change-Id: I1041122c530b4f5bbaabffff142ade5b3cbfc4c5 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qversiontagging.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/global/qversiontagging.h b/src/corelib/global/qversiontagging.h
index 4a1c01c89d..d6b4a65600 100644
--- a/src/corelib/global/qversiontagging.h
+++ b/src/corelib/global/qversiontagging.h
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
* qt_version_tag symbol that is present in QtCore. Such symbol is versioned,
* so the linker will automatically pull the current Qt version and add it to
* the ELF header of the library/application. The assembly produces one section
- * called ".qtversion" containing two pointer-sized values. The first is a
+ * called ".qtversion" containing two 32-bit values. The first is a
* relocation to the qt_version_tag symbol (which is what causes the ELF
* version to get used). The second value is the current Qt version at the time
* of compilation.
@@ -58,10 +58,12 @@ QT_BEGIN_NAMESPACE
// don't make tags in QtCore, bootstrapped systems or if the user asked not to
#elif defined(Q_CC_GNU) && !defined(Q_OS_ANDROID)
# if defined(Q_PROCESSOR_X86) && (defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD_KERNEL))
-# ifdef __LP64__
-# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
-# elif defined(Q_PROCESSOR_X86_64) // x32
-# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
+# if defined(Q_PROCESSOR_X86_64) // x86-64 or x32
+# if defined(__code_model_large__)
+# define QT_VERSION_TAG_RELOC(sym) ".quad " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
+# else
+# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOTPCREL\n"
+# endif
# else // x86
# define QT_VERSION_TAG_RELOC(sym) ".long " QT_STRINGIFY(QT_MANGLE_NAMESPACE(sym)) "@GOT\n"
# endif