-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compiler_builtins: base conditional compilation on the specification #36512
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -930,6 +930,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig { | |
let os = &sess.target.target.target_os; | ||
let env = &sess.target.target.target_env; | ||
let vendor = &sess.target.target.target_vendor; | ||
let llvm_target = &sess.target.target.llvm_target; | ||
let max_atomic_width = sess.target.target.options.max_atomic_width; | ||
|
||
let fam = if let Some(ref fam) = sess.target.target.options.target_family { | ||
|
@@ -949,6 +950,7 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig { | |
mk(InternedString::new("target_pointer_width"), intern(wordsz)), | ||
mk(InternedString::new("target_env"), intern(env)), | ||
mk(InternedString::new("target_vendor"), intern(vendor)), | ||
mk(InternedString::new("llvm_target"), intern(llvm_target)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a pretty weighty There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that this is not necessary. We can do conditional compilation for Cortex-M targets just fine without this change iff the Cortex-M are named There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this direction actually. I think our target names should just be mere aliases (i.e. just the contents of the target definition matters). As @brson actually has mentioned elsewhere, or current policy of associating fine-grained attributes with triple (via the default targets) unnecessarily clashes with LLVM and other tool.s |
||
]; | ||
match &fam[..] { | ||
"windows" | "unix" => ret.push(attr::mk_word_item(fam)), | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had some comments on the other PR, but I'm not 100% sure that this is buying us enough to pull in a dependency. Many of the
.contains
are now justrelevant_piece == "foo"
, which is good to work over parsed forms but hasn't cause ambiguity problems in the past?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rationale is to make this crate more robust at handling custom targets whose triple may be
foo
or any other arbitrary name. My main motivation was to handle Cortex-M targets which are currently customs target and may be named whatever by downstream users. But if those Cortex-M targets land in tree then I'm OK with not landing this PR.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was talking to @japaric about this the other day. This basically does what the extra env vars from rust-lang/rfcs#1721 would do, so it can be considered a stop-gap perhaps.