Skip to content
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

rustc: Modernize wasm checks for atomics #73665

Merged
merged 1 commit into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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: 2 additions & 1 deletion src/librustc_codegen_llvm/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use rustc_middle::bug;
use rustc_middle::ty::TyCtxt;
use rustc_session::config::{self, Lto, OutputType, Passes, SanitizerSet, SwitchWithOptPath};
use rustc_session::Session;
use rustc_span::symbol::sym;
use rustc_span::InnerSpan;
use rustc_target::spec::{CodeModel, RelocModel};

Expand Down Expand Up @@ -140,7 +141,7 @@ pub fn target_machine_factory(
// lower atomic operations to single-threaded operations.
if singlethread
&& sess.target.target.llvm_target.contains("wasm32")
&& features.iter().any(|s| *s == "+atomics")
&& sess.target_features.contains(&sym::atomics)
{
singlethread = false;
}
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::archive;
use super::command::Command;
use super::symbol_export;
use rustc_span::symbol::sym;

use std::ffi::{OsStr, OsString};
use std::fs::{self, File};
Expand Down Expand Up @@ -1036,9 +1037,7 @@ impl<'a> WasmLd<'a> {
//
// * `--export=*tls*` - when `#[thread_local]` symbols are used these
// symbols are how the TLS segments are initialized and configured.
let atomics = sess.opts.cg.target_feature.contains("+atomics")
|| sess.target.target.options.features.contains("+atomics");
if atomics {
if sess.target_features.contains(&sym::atomics) {
cmd.arg("--shared-memory");
cmd.arg("--max-memory=1073741824");
cmd.arg("--import-memory");
Expand Down
1 change: 1 addition & 0 deletions src/librustc_span/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ symbols! {
assume_init,
async_await,
async_closure,
atomics,
attr,
attributes,
attr_literals,
Expand Down