Skip to content

Commit

Permalink
Auto merge of #63094 - Centril:rollup-lm7peuh, r=Centril
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

Successful merges:

 - #62809 (rustc: Update wasm32 support for LLVM 9)
 - #63055 (Various cleanups to save analysis)
 - #63076 (Miri: fix determining size of an "extra function" allocation)
 - #63077 (cleanup: Remove some language features related to built-in macros)
 - #63086 (Ignore test cases that are not supported by vxWorks)
 - #63092 (Update `impl Trait` gate issues)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jul 29, 2019
2 parents c7312fe + f8321d0 commit 8b94e9e
Show file tree
Hide file tree
Showing 38 changed files with 240 additions and 485 deletions.
22 changes: 20 additions & 2 deletions src/librustc_codegen_llvm/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,9 +913,12 @@ pub fn compile_unit_metadata(
}

debug!("compile_unit_metadata: {:?}", name_in_debuginfo);
let rustc_producer = format!(
"rustc version {}",
option_env!("CFG_VERSION").expect("CFG_VERSION"),
);
// FIXME(#41252) Remove "clang LLVM" if we can get GDB and LLVM to play nice.
let producer = format!("clang LLVM (rustc version {})",
(option_env!("CFG_VERSION")).expect("CFG_VERSION"));
let producer = format!("clang LLVM ({})", rustc_producer);

let name_in_debuginfo = name_in_debuginfo.to_string_lossy();
let name_in_debuginfo = SmallCStr::new(&name_in_debuginfo);
Expand Down Expand Up @@ -980,6 +983,21 @@ pub fn compile_unit_metadata(
gcov_metadata);
}

// Insert `llvm.ident` metadata on the wasm32 targets since that will
// get hooked up to the "producer" sections `processed-by` information.
if tcx.sess.opts.target_triple.triple().starts_with("wasm32") {
let name_metadata = llvm::LLVMMDStringInContext(
debug_context.llcontext,
rustc_producer.as_ptr() as *const _,
rustc_producer.as_bytes().len() as c_uint,
);
llvm::LLVMAddNamedMetadataOperand(
debug_context.llmod,
const_cstr!("llvm.ident").as_ptr(),
llvm::LLVMMDNodeInContext(debug_context.llcontext, &name_metadata, 1),
);
}

return unit_metadata;
};

Expand Down
8 changes: 0 additions & 8 deletions src/librustc_codegen_ssa/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,6 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(sess: &'a Session,
sess.fatal(&format!("failed to run dsymutil: {}", e))
}
}

if sess.opts.target_triple.triple() == "wasm32-unknown-unknown" {
super::wasm::add_producer_section(
&out_filename,
&sess.edition().to_string(),
option_env!("CFG_VERSION").unwrap_or("unknown"),
);
}
}

/// Returns a boolean indicating whether the specified crate should be ignored
Expand Down
47 changes: 46 additions & 1 deletion src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,45 @@ pub struct WasmLd<'a> {
}

impl<'a> WasmLd<'a> {
fn new(cmd: Command, sess: &'a Session, info: &'a LinkerInfo) -> WasmLd<'a> {
fn new(mut cmd: Command, sess: &'a Session, info: &'a LinkerInfo) -> WasmLd<'a> {
// If the atomics feature is enabled for wasm then we need a whole bunch
// of flags:
//
// * `--shared-memory` - the link won't even succeed without this, flags
// the one linear memory as `shared`
//
// * `--max-memory=1G` - when specifying a shared memory this must also
// be specified. We conservatively choose 1GB but users should be able
// to override this with `-C link-arg`.
//
// * `--import-memory` - it doesn't make much sense for memory to be
// exported in a threaded module because typically you're
// sharing memory and instantiating the module multiple times. As a
// result if it were exported then we'd just have no sharing.
//
// * `--passive-segments` - all memory segments should be passive to
// prevent each module instantiation from reinitializing memory.
//
// * `--export=__wasm_init_memory` - when using `--passive-segments` the
// linker will synthesize this function, and so we need to make sure
// that our usage of `--export` below won't accidentally cause this
// function to get deleted.
//
// * `--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 {
cmd.arg("--shared-memory");
cmd.arg("--max-memory=1073741824");
cmd.arg("--import-memory");
cmd.arg("--passive-segments");
cmd.arg("--export=__wasm_init_memory");
cmd.arg("--export=__wasm_init_tls");
cmd.arg("--export=__tls_size");
cmd.arg("--export=__tls_align");
cmd.arg("--export=__tls_base");
}
WasmLd { cmd, sess, info }
}
}
Expand Down Expand Up @@ -1004,6 +1042,13 @@ impl<'a> Linker for WasmLd<'a> {
for sym in self.info.exports[&crate_type].iter() {
self.cmd.arg("--export").arg(&sym);
}

// LLD will hide these otherwise-internal symbols since our `--export`
// list above is a whitelist of what to export. Various bits and pieces
// of tooling use this, so be sure these symbols make their way out of
// the linker as well.
self.cmd.arg("--export=__heap_base");
self.cmd.arg("--export=__data_end");
}

fn subsystem(&mut self, _subsystem: &str) {
Expand Down
1 change: 0 additions & 1 deletion src/librustc_codegen_ssa/back/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ pub mod command;
pub mod symbol_export;
pub mod archive;
pub mod rpath;
pub mod wasm;
191 changes: 0 additions & 191 deletions src/librustc_codegen_ssa/back/wasm.rs

This file was deleted.

10 changes: 10 additions & 0 deletions src/librustc_mir/interpret/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ pub trait AllocMap<K: Hash + Eq, V> {
k: K,
vacant: impl FnOnce() -> Result<V, E>
) -> Result<&mut V, E>;

/// Read-only lookup.
fn get(&self, k: K) -> Option<&V> {
self.get_or(k, || Err(())).ok()
}

/// Mutable lookup.
fn get_mut(&mut self, k: K) -> Option<&mut V> {
self.get_mut_or(k, || Err(())).ok()
}
}

/// Methods of this trait signifies a point where CTFE evaluation would fail
Expand Down
Loading

0 comments on commit 8b94e9e

Please sign in to comment.