Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uprustc: Add target_vendor for target triples #28612
Conversation
rust-highfive
assigned
alexcrichton
Sep 24, 2015
This comment has been minimized.
This comment has been minimized.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
gandro
reviewed
Sep 24, 2015
| @@ -18,6 +18,7 @@ pub fn target() -> Target { | |||
| arch: "aarch64".to_string(), | |||
| target_os: "android".to_string(), | |||
| target_env: "".to_string(), | |||
| target_vendor: "linux".to_string(), | |||
This comment has been minimized.
This comment has been minimized.
gandro
Sep 24, 2015
Author
Contributor
I'm sure what the correct value is. "linux" is part of the triple, however it is not an official vendor name in this list: http://llvm.org/docs/doxygen/html/classllvm_1_1Triple.html#a96fe35195867c94aef1adf2ad0e20eec
This comment has been minimized.
This comment has been minimized.
alexcrichton
Sep 24, 2015
Member
It looks like LLVM normalize arm-linux-androideabi to arm--linux-androideabi which in theory means that target_os should be "linux" and target_env should be "androideabi", but we can't really change that now! Regardless though it looks like "unknown" is the right vendor for the android triples.
gandro commentedSep 24, 2015
This adds a new target property,
target_vendor. It is to be be used as a matcher for conditional compilation. The vendor is part of the autoconf target triple:<arch><sub>-<vendor>-<os>-<env>.arch,target_osandtarget_envare already supported by Rust.This change was suggested in PR #28593. It enables conditional compilation based on the vendor. This is needed for the rumprun target, which needs to match against both, target_os and target_vendor.
The default value for
target_vendoris "unknown", "apple" and "pc" are other common values.Matching against the
target_vendoris introduced behind the feature gate#![feature(cfg_target_vendor)].This is the first time I messed around with rustc internals. I just added the my code where I found the existing
target_*variables, hopefully I haven't missed anything. Please review with care. :)r? @alexcrichton