Remove --no-undefined for VxWorks Qt shared libs

Build system adds this flag to any module that it uses when built as a
shared library and not WASM.

VxWorks is specific in regards to type of applications:
 - static application, which do not use any dynamic libraries
 - dynamic application, which uses shared libraries, and as such needs
   to link against libdl.a

The latter is the only source of symbols related to dynamic loading and
thread local storage. This is an architectural decision, as application
is required to embed loading tools in itself (as opposed to Unix/Linux,
which contains dynamic loader which provides these symbols separately).
libdl.a is standard static library on VxWorks, compiled without PIC, and
as such can't be linked into shared library.

This results in compilation errors when building dynamic libraries which
use `thread_local`-related symbols, since these symbols will be
fulfilled at runtime (contained in executable which requires shared lib)
and are not available during linking.

Don't add `-Wl,--no-undefined` flag on VxWorks for Qt shared lib builds.

Task-number: QTBUG-115777
Change-Id: I47e5d68afcba2c3b4203e4c0beded2e18ea2563b
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
This commit is contained in:
Michał Łoś 2023-09-13 19:14:57 +02:00
parent 94a3914d3d
commit 9e93781b9c

View File

@ -138,6 +138,12 @@ function(qt_internal_add_link_flags_no_undefined target)
if (NOT QT_BUILD_SHARED_LIBS OR WASM)
return()
endif()
if (VXWORKS)
# VxWorks requires thread_local-related symbols to be found at
# runtime, resulting in linker error when no-undefined flag is
# set and thread_local is used
return()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# ld64 defaults to -undefined,error, and in Xcode 15
# passing this option is deprecated, causing a warning.