I'm hitting a similar issue to Undefined symbol metadata accessor for __C.CallMeClass in swift::TypeMetadataTrait<CallMeClass>::getTypeMetadata() in CallMeClass.o but in a slightly different way.
In my case instead of simply passing the C++ object back to C++, I'm trying to construct one and return it back to C++.
I'm testing this with a manually created swiftc 6.0 build as close to trunk as I could get it:
Swift version 6.0-dev (LLVM 3427f33b53c666b, Swift 225809e3f8e9c7b)
Target: x86_64-unknown-linux-gnu
Here's a repo with a minimal project that shows the issue: GitHub - ADKaster/swift-shlib-cxx-exe
In essence, it seems like when swift needs to pass along an instance of a type back to c++, the C++ compiler (or the swift compiler?) doesn't emit the swift type info into a library target properly(?)