1
Fork 0

Always export static variables as SymbolExportLevel::C in wasm

This commit is contained in:
maik 2020-01-07 16:20:58 +01:00
parent eb4fc2d4fe
commit 093fb856a3

View file

@ -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;
}
}