Page MenuHomePhabricator

The clang linker may resolve weak symbols from dependent libraries instead of the local symbol.
Closed, ResolvedPublic

Description

TLDR; Mark the mitk::CoreServices class template with MITK_LOCAL

When using Clang, we do not use hidden visibility for symbols in shared objects (see the comment in mitkFunctionCreateModule.cmake - there are problems with merging RTTI symbols from templates declared in external libraries and not explicitly marked with "default" visibility).

Hence, all symbols have default visibility "by default" and may be resolved by the dynamic linker. In the case of the mitk::CoreServices class template in combination with default method arguments depending on local method definitions (context = us::GetModuleContext()) the linker may resolve template definitions from other shared objects and hence use the "wrong" GetModuleContext() definition. Explicitly marking the template with MITK_LOCAL avoids the wrong resolution path.

Event Timeline

FIX: Replace mitk::CoreServices in the above comment with mitk::CoreSerivcePointer

[536179]: Merge branch 'bug-18731-hide-template-definitions-with-special-default

Merged commits:

2015-02-10 11:42:46 Sascha Zelzer [ba8bde]
Hide template definitions which use special default arguments.

User zelzer has pushed new remote branch:

bug-18731-hide-template-definitions-with-special-default-arguments