https://bugs.kde.org/show_bug.cgi?id=479679

Fabian Vogt <fab...@ritter-vogt.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fab...@ritter-vogt.de
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |UPSTREAM

--- Comment #23 from Fabian Vogt <fab...@ritter-vogt.de> ---
(In reply to David Redondo from comment #22)
> The issue seems related to a mismatch in type_info across objects making the
> any_cast in layershell-qt fail

libc++ uses pointer equivalence for typeinfo comparison by default.

(1.) struct xdg_popup is an incomplete type in layer-shell-qt. This triggers an
LLVM bug: https://github.com/llvm/llvm-project/issues/36746. The result of that
bug is that the typeinfo symbols (typeinfo + name) are local to the .so file
and won't bind to other objects. Thus pointer equivalence checks fail.

If this gets fixed it'd probably work already. I don't see that being worked on
though, so I suggest to build libc++ with
-DLIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION=2, which mirrors libstdc++
behavior.

(More details for interested readers below)

There are also other ways this can fail, but don't happen here (yet):

2. layer-shell-qt is loaded with RTLD_LOCAL. That means typeinfo can't be
shared between separately loaded plugins, just within (not runtime) linked
libaries (i.e. what ldd shows). (ref.
https://lists.llvm.org/pipermail/llvm-dev/2014-June/073469.html)
3. struct xdg_popup is also used by the executable itself. Unless the typeinfo
is global by either building it with -rdynamic or linking it against a library
which also exports the typeinfo, this can't be shared either. (ref.
https://lists.llvm.org/pipermail/llvm-dev/2014-June/073487.html)

For those reasons, libstdc++ switched to using string comparison for typeinfo
equality checks:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/libsupc%2B%2B/typeinfo;h=fcc3077d06091339175c7af5d3acd92fd5416acd;hb=HEAD#l51

1 is clearly a bug in clang.
https://refspecs.linuxbase.org/cxxabi-1.83.html#rtti explains how typeinfo for
pointers to incomplete types are supposed to work.

2 is technically intended behavior, just totally non obvious. 3 is similar,
technically every executable which might call dlopen has to be built with
-rdynamic.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to