This is an archive of the discontinued LLVM Phabricator instance.

[CMake] Fix runtimes cross-compilation when using LLVM_USE_LINKER
ClosedPublic

Authored by thevinster on Aug 3 2022, 12:00 AM.

Details

Summary

This is motivated by https://reviews.llvm.org/D115852#3226050 where passing
LLVM_USE_LINKER in PASSTHROUGH_PREFIXES breaks cross-compilation
(e.g. targeting Windows on a Linux host). As suggested on that diff, implement
an override for it by allowing users to pass RUNTIMES_${target}_LLVM_USE_LINKER
to specify the linker for runtimes. Defaults to host linker if not specified.

Diff Detail

Event Timeline

thevinster created this revision.Aug 3 2022, 12:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 12:00 AM
Herald added a subscriber: mgorny. · View Herald Transcript
thevinster edited the summary of this revision. (Show Details)Aug 3 2022, 12:05 AM
thevinster added reviewers: phosek, smeenai.
thevinster published this revision for review.Aug 3 2022, 12:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2022, 12:07 AM
phosek accepted this revision.Aug 3 2022, 12:13 AM

LGTM

This revision is now accepted and ready to land.Aug 3 2022, 12:13 AM
smeenai accepted this revision.Aug 3 2022, 10:39 AM

LGTM

This revision was landed with ongoing or failed builds.Aug 3 2022, 11:24 AM
This revision was automatically updated to reflect the committed changes.

This still does not look right to me.
Shouldn't PASSTHROUGH_PREFIXES have just been removed in this invocation?

I want to cross build runtimes leaving the linker choice to the compiler driver, and not to set it on the command line to override the default [strange] choice of host linker.
Why would we ever want to use the linker that targets host to build runtimes for a target?
If someone wants to use host linker to build runtimes, they should specify it manually, not the opposite.

Do my words make sense or I'm talking nonsense? I'm quite new to runtimes build.

This might've been an oversight on my end. I think the choice to use the host linker to build for a target was to retain the previous behavior as close as possible while allowing the ability to override. Your situation seems to contradict this scenario unless you override specifically on the command line, which I can agree might not be desirable. Feel free to remove the default as long as existing builds all pass.

@thevinster
Thanks for the confirmation.

... as long as existing builds all pass.

That's what I'm afraid of. Let's see if I'm not the only one facing this issue. For now, I'll remove the check locally.