First time here and possibly the wrong topic. My apologies in advance.
I recently attempted to update my Linux CI to clang-13 and found that my Swift <--> C protobuf interop is broken. I'm unsure if this is the right forum to ask but the error message is mysterious enough it might be of interest here.
The error occurs when trying to link Apple's Swift Protobuf:
ld.lld: error: undefined hidden symbol: __start_swift5_protocols
>>> referenced by SwiftRT-ELF.cpp
>>> /usr/lib/swift/linux/x86_64/swiftrt.o:(swift_image_constructor())
>>> the encapsulation symbol needs to be retained under --gc-sections properly; consider -z nostart-stop-gc (see https://lld.llvm.org/ELF/start-stop-gc)
ld.lld: error: undefined hidden symbol: __stop_swift5_protocols
>>> referenced by SwiftRT-ELF.cpp
>>> /usr/lib/swift/linux/x86_64/swiftrt.o:(swift_image_constructor())
ld.lld: error: undefined hidden symbol: __start_swift5_protocol_conformances
...
I put the full error log on the repro section of this repo.
This only happens when I use clang-13 on Linux. clang-13 (bundled with the latest XCode) on MacOS and clang-12 on Linux works fine. I tested it with Swift 5.4.1, 5.4.2, and 5.5.2.
To my untrained eyes, it looks like something changed with clang between 12 and 13 so that some kind of hidden symbols are no longer being linked in by default.
Any ideas?