This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Add detection for the mold linker in AddLLVM.cmake.
ClosedPublic

Authored by fcambus on Sep 19 2021, 6:32 AM.

Details

Summary

mold says it is compatible with GNU ld and gold linkers:

$ mold -v
mold 0.9.5 (compatible with GNU ld and GNU gold)

And thus it currently gets detected as Gold.

With the following diff, CMake now correctly reports the linker name, and mold keeps being identified as Gold internally for now.

Diff Detail

Event Timeline

fcambus created this revision.Sep 19 2021, 6:32 AM
fcambus requested review of this revision.Sep 19 2021, 6:32 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2021, 6:32 AM
ldionne accepted this revision.Sep 23 2021, 9:22 AM

and mold keeps being identified as Gold internally for now.

Why do we want to keep identifying it as Gold? I guess it's because additional work needs to happen if we don't just treat it as Gold?

LGTM.

This revision is now accepted and ready to land.Sep 23 2021, 9:22 AM
MaskRay accepted this revision.Sep 23 2021, 1:41 PM
MaskRay added inline comments.
llvm/cmake/modules/AddLLVM.cmake
198

LLVM_LINKER_IS_GOLD should be dropped

Why do we want to keep identifying it as Gold? I guess it's because additional work needs to happen if we don't just treat it as Gold?

Wrong assumption on my part, there is in fact no need to keep identifying as Gold. Will send an updated revision.

fcambus updated this revision to Diff 374808.Sep 24 2021, 5:09 AM

This revision drops the unneeded line setting LLVM_LINKER_IS_GOLD.

fcambus marked an inline comment as done.Sep 24 2021, 5:11 AM
MaskRay accepted this revision.Sep 24 2021, 9:01 AM

@MaskRay I don't have commit access, could you commit this for me? Thanks!

This revision was landed with ongoing or failed builds.Sep 28 2021, 5:19 AM
This revision was automatically updated to reflect the committed changes.