From 80144b89ca1adede0db9d6e485037f5e431216c3 Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Sat, 21 Sep 2019 14:55:08 +0200 Subject: CAN: Avoid symbol clashes on static builds Having the same function name in a global namespace can lead the linker to pick an arbitrary one instead the right one. [ChangeLog] Fixed problems on static builds where an arbitrary version of resolveSymbol() was used instead the correct one. Fixes: QTBUG-78546 Change-Id: I0ff9bc3e5905b3b9694dfe9d446b2a52700f213f Reviewed-by: Karsten Heimrich --- src/plugins/canbus/tinycan/tinycan_symbols_p.h | 2 +- src/plugins/canbus/tinycan/tinycanbackend.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/canbus/tinycan') diff --git a/src/plugins/canbus/tinycan/tinycan_symbols_p.h b/src/plugins/canbus/tinycan/tinycan_symbols_p.h index 44dffd6..625edd3 100644 --- a/src/plugins/canbus/tinycan/tinycan_symbols_p.h +++ b/src/plugins/canbus/tinycan/tinycan_symbols_p.h @@ -317,7 +317,7 @@ GENERATE_SYMBOL_VARIABLE(void, CanSetRxEventCallback, CanRxEventCallback) GENERATE_SYMBOL_VARIABLE(void, CanSetEvents, quint16) GENERATE_SYMBOL_VARIABLE(quint32, CanEventStatus, void) -inline bool resolveSymbols(QLibrary *mhstcanLibrary) +inline bool resolveTinyCanSymbols(QLibrary *mhstcanLibrary) { if (!mhstcanLibrary->isLoaded()) { mhstcanLibrary->setFileName(QStringLiteral("mhstcan")); diff --git a/src/plugins/canbus/tinycan/tinycanbackend.cpp b/src/plugins/canbus/tinycan/tinycanbackend.cpp index 3891186..496770a 100644 --- a/src/plugins/canbus/tinycan/tinycanbackend.cpp +++ b/src/plugins/canbus/tinycan/tinycanbackend.cpp @@ -62,7 +62,7 @@ bool TinyCanBackend::canCreate(QString *errorReason) #ifdef LINK_LIBMHSTCAN return true; #else - static bool symbolsResolved = resolveSymbols(mhstcanLibrary()); + static bool symbolsResolved = resolveTinyCanSymbols(mhstcanLibrary()); if (Q_UNLIKELY(!symbolsResolved)) { *errorReason = mhstcanLibrary()->errorString(); return false; -- cgit v1.2.3