Skip to content

🍒[Swift 6.0]: Set toolchain clang linker to gold (Linux) #73760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

etcwilde
Copy link
Member

BFD doesn't work with Swift symbols. We get nasty errors like this:

error: link command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld: ...wift/CMakeFiles/swiftDispatch.dir/Block.swift.o:
  relocation R_X86_64_PC32 against protected symbol
  `$s8Dispatch0A13WorkItemFlagsVSYAAMc' can not be used when making a
  shared object
/usr/bin/ld: final link failed: bad value

rdar://123061492

etcwilde added 2 commits May 20, 2024 14:26
BFD doesn't work with Swift symbols. We get nasty errors like this:

```
error: link command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld: ...wift/CMakeFiles/swiftDispatch.dir/Block.swift.o:
  relocation R_X86_64_PC32 against protected symbol
  `$s8Dispatch0A13WorkItemFlagsVSYAAMc' can not be used when making a
  shared object
/usr/bin/ld: final link failed: bad value
```
The just-built Swift driver was picking up the system clang, which would
try to use the bfd linker instead of gold or lld. bfd doesn't like how
Swift handles protected symbols and fails with the following error:

```
error: link command failed with exit code 1 (use -v to see invocation)
/usr/bin/ld: /home/build-user/build/buildbot_linux/libdispatch-linux-x86_64/src/swift/CMakeFiles/swiftDispatch.dir/Block.swift.o: relocation R_X86_64_PC32 against protected symbol `$s8Dispatch0A13WorkItemFlagsVSYAAMc' can not be used when making a shared object
/usr/bin/ld: final link failed: bad value
```

This patch tells the Swift-Driver where it should find its clang, and
makes it match the clang that is in use through the rest of the build.
@etcwilde etcwilde requested a review from a team as a code owner May 20, 2024 21:28
@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde etcwilde merged commit 9c46a71 into swiftlang:release/6.0 Nov 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants