Always export static variables as SymbolExportLevel::C in wasm
This commit is contained in:
parent
eb4fc2d4fe
commit
093fb856a3
1 changed files with 2 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue