-
Notifications
You must be signed in to change notification settings - Fork 833
Always use LLD to link when using clang to build #8204
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
All recent distributions of clang also include lld, and it links much faster than most other linkers.
|
This does seem to speed up the clang builds on CI (e.g. clang-fuzztest) and makes a noticeable difference on a cloudtop (mine goes from 30s to 21s for a full build). |
kripken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm % comment
| endif() | ||
| endif() | ||
|
|
||
| if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND (LINUX OR WINDOWS)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment why not MacOS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I am guessing the reason is that it is always used there..?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually the opposite; lld historically hasn't had good support for Mach-O. I'm not sure what the current status is but the version of Clang in the SDK on the bots here doesn't even support -fuse-ld=lld, so I figured it wasn't really worth investigating.
|
Have you measured with mold btw? (might not be worth the hassle, but it is said to be much faster) |
|
No, I thought about mold, but lld is fast enough (and mature) so it didn't seem worth it as a default. But given that GNU ld -> lld made a noticeable difference, maybe using mold might be worth trying for really fast debug cycles. Combined with either a high-parallelism cloudtop or reclient, turnaround could be really fast. |
|
I tried mold locally on the default build of Binaryen. I think it was maybe a little faster than lld, but hard to say, might have been in the noise. I'll have to try it on llvm sometime. |
kripken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting about mold - yeah, maybe it needs a really big project to show benefits.
All recent distributions of clang also include lld, and it links much
faster than most other linkers.