This is an archive of the discontinued LLVM Phabricator instance.

gn build: Rename llvm_host_triple to llvm_current_triple and have it use current_{cpu,os}.
ClosedPublic

Authored by pcc on Jan 14 2019, 7:42 PM.

Details

Summary

This makes e.g. ToolChain::isCrossCompiling() in
clang/lib/Driver/ToolChain.cpp return the correct result
if the compiler was cross-compiled. This change also affects
llvm_default_target_triple, so cross-compiled compilers default to
targeting the cross-compilation target, which makes more sense than
the host that the compiler was compiled on.

This change will also be necessary in order for the correct triples
to appear in generated lit files for non-native targets.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Jan 14 2019, 7:42 PM
phosek added inline comments.Jan 14 2019, 11:04 PM
llvm/utils/gn/secondary/llvm/triples.gni
21 ↗(On Diff #181704)

Rather than replacing llvm_host_triple with llvm_current_triple, I think we should have both. This is going to be needed in some places, e.g. libc++, libc++abi, and libunwind lit configuration uses the host as well as the target triple, see https://github.com/llvm/llvm-project/blob/master/libcxx/test/lit.site.cfg.in#L18.

pcc marked an inline comment as done.Jan 14 2019, 11:35 PM
pcc added inline comments.
llvm/utils/gn/secondary/llvm/triples.gni
21 ↗(On Diff #181704)

All of the current users want llvm_current_triple; let's add llvm_host_triple later if we need it. Taking a quick look at libc++ for example, it's not clear that host_triple is actually being used for anything, so we might end up removing it from the template instead of adding it for the sake of those projects.

phosek accepted this revision.Jan 15 2019, 12:10 AM

LGTM

This revision is now accepted and ready to land.Jan 15 2019, 12:10 AM
This revision was automatically updated to reflect the committed changes.