Skip to content

Commit

Permalink
Always export static variables as SymbolExportLevel::C in wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
MaikKlein committed Jan 7, 2020
1 parent eb4fc2d commit 093fb85
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/librustc_codegen_ssa/back/symbol_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,16 +345,11 @@ fn symbol_export_level(tcx: TyCtxt<'_>, sym_def_id: DefId) -> SymbolExportLevel
if is_extern && !std_internal {
let target = &tcx.sess.target.target.llvm_target;
// WebAssembly cannot export data symbols, so reduce their export level
if target.contains("wasm32") || target.contains("emscripten") {
if target.contains("emscripten") {
if let Some(Node::Item(&hir::Item { kind: hir::ItemKind::Static(..), .. })) =
tcx.hir().get_if_local(sym_def_id)
{
let export_level = if tcx.type_of(sym_def_id).is_scalar() {
SymbolExportLevel::C
} else {
SymbolExportLevel::Rust
};
return export_level;
return SymbolExportLevel::Rust;
}
}

Expand Down

0 comments on commit 093fb85

Please sign in to comment.