Page MenuHomePhabricator

[cmake] Pass LLVM_USE_LINKER flag to CrossCompile toolchain if set
ClosedPublic

Authored by hintonda on Nov 7 2017, 7:49 AM.

Details

Summary

Pass LLVM_USE_LINKER flag to CrossCompile toolchain if set.

This change only affects linking the NATIVE toolchain.

Noticed this when passing:

-DLLVM_OPTIMIZED_TABLEGEN=ON
-DLLVM_USE_LINKER=gold

Diff Detail

Repository
rL LLVM

Event Timeline

hintonda created this revision.Nov 7 2017, 7:49 AM
hintonda retitled this revision from [cmake] Pass LLVM_USE_LINKER flag down to the CrossCompiler if set. to [cmake] Pass LLVM_USE_LINKER flag to CrossCompile toolchain if set.Nov 9 2017, 7:27 AM
hintonda edited the summary of this revision. (Show Details)
beanz edited edge metadata.Nov 14 2017, 1:50 PM

I don't think we can do this unconditionally like this. It seems to me like you could have a situation where you want to use different linkers for the host tools and target binaries.

I don't think we can do this unconditionally like this. It seems to me like you could have a situation where you want to use different linkers for the host tools and target binaries.

I can make it conditional, e.g., iff LLVM_OPTIMIZED_TABLEGEN=ON, but honestly can't think of a case where you would want to use different linkers.

beanz added a comment.Nov 15 2017, 1:50 PM

The code path you're modifying isn't just for building optimized tools, it also gets triggered when building the host tools in cross compilations. It is totally reasonable that I might want to use a different linker for host binaries from the linker used for target binaries. One example would be if I'm cross compiling to say PPC and wanting to use gold, but want to use lld as the linker for the host tools.

hintonda updated this revision to Diff 123524.Nov 19 2017, 5:35 PM
hintonda edited the summary of this revision. (Show Details)
  • Only pass linker flags when not CMAKE_CROSSCOMPLING.
beanz accepted this revision.Nov 27 2017, 9:51 AM

LGTM.

This revision is now accepted and ready to land.Nov 27 2017, 9:51 AM
This revision was automatically updated to reflect the committed changes.