Skip to content

Upstream support for --print=target-cpus to LLVM #104785

Open
@he32

Description

@he32

The target-cpus feature is only exposed when building llvm through x.py because it depends on a patch in our fork of llvm. As a result, linking to an upstream llvm build with llvm.llvm-config = "..." won't work with --print=target-cpus. The relevant patch on the current branch is rust-lang/llvm-project@a8f170c; it would be nice if someone lobbied for that in upstream LLVM.

The last attempt to do that was https://reviews.llvm.org/D93789; the feedback there was to use fillValidCPUArchList() instead.

See below for the original issue description.


Hi,

is there a good reason release versions of rust do not support these options?

% rustc --print target-cpus
Target CPU help is not supported by this LLVM version.

% rustc --print target-spec-json
error: the `-Z unstable-options` flag must also be passed to enable the target-spec-json print option

OK, so let's try adding that option, then:

% rustc -Z unstable-options --print target-spec-json
error: the option `Z` is only accepted on the nightly compiler

Gah!
Googling a little gave a sliver of hope:

% rustc +nightly -Z unstable-options --print target-spec-json
error: the option `Z` is only accepted on the nightly compiler

% 

Nope!

% rustc --version
rustc 1.65.0
% uname
NetBSD
% uname -m
amd64
% uname -p
x86_64
% uname -r
9.99.104
% 

It does, though support rustc --print target-list, so this looks a little ... inconsistent?

The rustc(1) man page does mention both the above unsupported options without
any qualification.

I suspect this can relatively easily (and cheaply?) be improved?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-target-specsArea: Compile-target specificationsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions