Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ struct TomlTarget {
musl_root: Option<String>,
wasi_root: Option<String>,
qemu_rootfs: Option<String>,
no_std: Option<bool>,
}

impl Config {
Expand Down Expand Up @@ -615,6 +616,8 @@ impl Config {
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
target.wasi_root = cfg.wasi_root.clone().map(PathBuf::from);
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
target.no_std =
cfg.no_std.unwrap_or(triple.contains("-none-") || triple.contains("nvptx"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, is -none- perhaps a bit too broad? I guess we presumably don't ship any platforms with that triple today that do have std compiled?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic is taken from if target.contains("-none-") || target.contains("nvptx") {. Some later refactor should just ensure there are Targets for all platforms specified by name, rather than config, so we can deduplicate this.


config.target_config.insert(INTERNER.intern_string(triple.clone()), target);
}
Expand Down
4 changes: 1 addition & 3 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,7 @@ pub fn check(build: &mut Build) {

if target.contains("-none-") || target.contains("nvptx") {
if build.no_std(*target).is_none() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function looks potentially relevant; is there a reason it's not receiving updates or so?

Copy link
Contributor Author

@Ericson2314 Ericson2314 Feb 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I should replace the calls to Default::default with a new method that defaults based on the triple. Then this will work as I intended: the defaulting logic happens in one place. and we simply ensure that the target exists here so that the triple-specific defaults rather than triple-agnostic defaults are used.

let target = build.config.target_config.entry(target.clone()).or_default();

target.no_std = true;
build.config.target_config.entry(target.clone()).or_default();
}

if build.no_std(*target) == Some(false) {
Expand Down