about summary refs log tree commit diff
path: root/src/librustc_codegen_utils
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-10 01:16:02 +0000
committerbors <bors@rust-lang.org>2018-11-10 01:16:02 +0000
commit06118eac4c602a22d2004c98756a95f2c5ec95d5 (patch)
tree4039e739f4710fbe8a4aab96b21bfd1cc46a0daa /src/librustc_codegen_utils
parent36a50c29f6c5c386fba6ab685818755ac55152e5 (diff)
parent82574e9ec804b6efbf6dfcf523d32618528ee32b (diff)
downloadrust-06118eac4c602a22d2004c98756a95f2c5ec95d5.tar.gz
rust-06118eac4c602a22d2004c98756a95f2c5ec95d5.zip
Auto merge of #55626 - nikic:update-emscripten, r=alexcrichton
Update emscripten

This updates emscripten to 1.38.15, which is based on LLVM 6.0.1 and would allow us to drop code for handling LLVM 4.

The main issue I ran into is that exporting statics through `EXPORTED_FUNCTIONS` no longer works. As far as I understand exporting non-functions doesn't really make sense under emscripten anyway, so I've modified the symbol export code to not even try.

Closes #52323.
Diffstat (limited to 'src/librustc_codegen_utils')
-rw-r--r--src/librustc_codegen_utils/symbol_export.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc_codegen_utils/symbol_export.rs b/src/librustc_codegen_utils/symbol_export.rs
index 2d650f7f18d..6c40296b2ef 100644
--- a/src/librustc_codegen_utils/symbol_export.rs
+++ b/src/librustc_codegen_utils/symbol_export.rs
@@ -388,6 +388,16 @@ fn symbol_export_level(tcx: TyCtxt, sym_def_id: DefId) -> SymbolExportLevel {
         codegen_fn_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL);
 
     if is_extern && !std_internal {
+        // Emscripten cannot export statics, so reduce their export level here
+        if tcx.sess.target.target.options.is_like_emscripten {
+            if let Some(Node::Item(&hir::Item {
+                node: hir::ItemKind::Static(..),
+                ..
+            })) = tcx.hir.get_if_local(sym_def_id) {
+                return SymbolExportLevel::Rust;
+            }
+        }
+
         SymbolExportLevel::C
     } else {
         SymbolExportLevel::Rust