Description
Description
After dead-stripping was enabled in #4135, various people reported problems with using lld, though it wouldn't always show up. It appears to be some change with lld 13, as lld 12 works fine, perhaps the commit @drodriguez linked (I'll try reverting that commit and report back later).
Obviously, this is really a regression in how Swift interacts with lld 13 and 14, but I'm reporting it here first as we'll probably want to amend SPM 5.7 quickly before the underlying lld issue is figured out. @keith, maybe we should disable stripping on ELF if the linker is lld for now?
@3405691582, can you reproduce on OpenBSD?
Expected behavior
Linking to work fine with lld, as it does with gold.
Actual behavior
Several linker errors like this show up instead:
ld.lld: error: undefined hidden symbol: __start_swift5_protocols
>>> referenced by SwiftRT-ELF.cpp
>>> /home/butta/swift-DEVELOPMENT-SNAPSHOT-2022-07-25-a-ubuntu20.04/usr/lib/swift/linux/x86_64/swiftrt.o (swift_image_constructor())
Steps to reproduce
- Clone swift-argument-parser
- Remove a file because of some unrelated bug:
rm Sources/ArgumentParserTestHelpers/TestHelpers.swift
- Build the package in release mode with lld:
../swift-DEVELOPMENT-SNAPSHOT-2022-07-25-a-ubuntu20.04/usr/bin/swift build -v -c release -Xswiftc -use-ld=lld
Swift Package Manager version/commit hash
latest Jul. 25 trunk snapshot and 5.7 Jul. 23 snapshot
Swift & OS version (output of swift --version && uname -a
)
Swift 5.8 and 5.7 on Ubuntu 20.04 x86_64