Skip to content
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

Set toolchain clang linker to gold (Linux) #73463

Merged
merged 2 commits into from
May 20, 2024

Conversation

etcwilde
Copy link
Member

@etcwilde etcwilde commented May 6, 2024

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 etcwilde requested review from compnerd and al45tair May 6, 2024 21:36
@etcwilde
Copy link
Member Author

etcwilde commented May 6, 2024

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented May 6, 2024

@swift-ci please test Linux toolchain

@etcwilde etcwilde changed the title Set toolchain clang linker to gold (Linux) DNM: Set toolchain clang linker to gold (Linux) May 6, 2024
@etcwilde
Copy link
Member Author

etcwilde commented May 6, 2024

apple/swift-driver#1596
@swift-ci please test Linux

Copy link
Collaborator

@compnerd compnerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is a long standing issue with BFD and our usage of protected symbols.

@al45tair
Copy link
Contributor

al45tair commented May 7, 2024

#73474
@swift-ci Please test macOS platform

@etcwilde etcwilde force-pushed the ewilde/set-gold-clang-linker branch from 75f657d to ec74b91 Compare May 13, 2024 18:56
@etcwilde
Copy link
Member Author

apple/swift-driver#1608
@swift-ci please test

@etcwilde etcwilde changed the title DNM: Set toolchain clang linker to gold (Linux) Set toolchain clang linker to gold (Linux) May 13, 2024
@etcwilde
Copy link
Member Author

@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Linux platform

1 similar comment
@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Linux platform

@etcwilde etcwilde force-pushed the ewilde/set-gold-clang-linker branch from ec74b91 to 6098d98 Compare May 14, 2024 02:23
@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Linux platform

@etcwilde
Copy link
Member Author

IT'S FINALLY GREEN ON LINUX! 😆

@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test macOS Platform

@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Windows platform

@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Linux platform

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.
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
```
@etcwilde etcwilde force-pushed the ewilde/set-gold-clang-linker branch from 6098d98 to d63152f Compare May 15, 2024 20:11
@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Linux platform

2 similar comments
@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Linux platform

@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Linux platform

@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test Windows Platform

@etcwilde
Copy link
Member Author

apple/llvm-project#8748
apple/swift-driver#1608
@swift-ci please test macOS Platform

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.

None yet

3 participants