Skip to content

Conversation

@dschuff
Copy link
Member

@dschuff dschuff commented Jan 14, 2026

All recent distributions of clang also include lld, and it links much
faster than most other linkers.

All recent distributions of clang also include lld, and it links much
faster than most other linkers.
@dschuff dschuff marked this pull request as ready for review January 14, 2026 19:57
@dschuff
Copy link
Member Author

dschuff commented Jan 14, 2026

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).

@dschuff dschuff requested review from kripken and tlively January 14, 2026 19:59
@dschuff dschuff enabled auto-merge (squash) January 14, 2026 20:00
Copy link
Member

@kripken kripken left a 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))
Copy link
Member

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?

Copy link
Member

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..?)

Copy link
Member Author

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.

@kripken
Copy link
Member

kripken commented Jan 14, 2026

Have you measured with mold btw? (might not be worth the hassle, but it is said to be much faster)

@dschuff
Copy link
Member Author

dschuff commented Jan 14, 2026

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.

@dschuff
Copy link
Member Author

dschuff commented Jan 14, 2026

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.

Copy link
Member

@kripken kripken left a 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.

@dschuff dschuff disabled auto-merge January 14, 2026 22:43
@dschuff dschuff merged commit 1a51861 into WebAssembly:main Jan 14, 2026
17 checks passed
@dschuff dschuff deleted the always_lld branch January 15, 2026 23:22
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