]> git.lizzy.rs Git - rust.git/commitdiff
Call emcc with ERROR_ON_UNDEFINED_SYMBOLS
authorBrian Anderson <banderson@mozilla.com>
Sun, 25 Sep 2016 20:47:00 +0000 (20:47 +0000)
committerBrian Anderson <banderson@mozilla.com>
Fri, 30 Sep 2016 21:02:57 +0000 (14:02 -0700)
src/libcoretest/num/flt2dec/estimator.rs
src/librustc_back/target/asmjs_unknown_emscripten.rs
src/librustc_back/target/wasm32_unknown_emscripten.rs
src/libstd/sys/unix/process.rs
src/libstd/sys/unix/thread.rs
src/test/run-pass/format-no-std.rs

index e20881fd3296b0459b7a6940d30043e6e818166e..0bca616ea9abcc99e5fc604ee4d91f2472b2985d 100644 (file)
@@ -8,11 +8,14 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// FIXME https://github.com/kripken/emscripten/issues/4563
+// NB we have to actually not compile this test to avoid
+// an undefined symbol error
+#![cfg(not(target_os = "emscripten"))]
+
 use core::num::flt2dec::estimator::*;
 
 #[test]
-// FIXME https://github.com/kripken/emscripten/issues/4563
-#[cfg_attr(target_os = "emscripten", ignore)]
 fn test_estimate_scaling_factor() {
     macro_rules! assert_almost_eq {
         ($actual:expr, $expected:expr) => ({
index 9ccfdbb129c7352bceab72900939f340660c7512..667f7cf2c214a9defc7c7b01c0d0f60addf59e91 100644 (file)
@@ -22,6 +22,7 @@ pub fn target() -> Result<Target, String> {
         allow_asm: false,
         obj_is_bitcode: true,
         max_atomic_width: 32,
+        post_link_args: vec!["-s".to_string(), "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()],
         .. Default::default()
     };
     Ok(Target {
index 412fb868086c51f92cae8b449c14633a4abe3f13..2923f2eb92e452fb520b5fd30903d86b891798c3 100644 (file)
@@ -24,7 +24,8 @@ pub fn target() -> Result<Target, String> {
         allow_asm: false,
         obj_is_bitcode: true,
         max_atomic_width: 32,
-        post_link_args: vec!["-s".to_string(), "BINARYEN=1".to_string()],
+        post_link_args: vec!["-s".to_string(), "BINARYEN=1".to_string(),
+                             "-s".to_string(), "ERROR_ON_UNDEFINED_SYMBOLS=1".to_string()],
         .. Default::default()
     };
     Ok(Target {
index 85aba4b9b156b222f49fe47d8f0b7485b0081ef5..dafc11d9cc8e9c7b01b01f1aeb0968d1254b9a3c 100644 (file)
@@ -369,7 +369,7 @@ macro_rules! t {
         }
 
         // NaCl has no signal support.
-        if cfg!(not(target_os = "nacl")) {
+        if cfg!(not(any(target_os = "nacl", target_os = "emscripten"))) {
             // Reset signal handling so the child process starts in a
             // standardized state. libstd ignores SIGPIPE, and signal-handling
             // libraries often set a mask. Child processes inherit ignored
@@ -589,7 +589,7 @@ pub fn wait(&mut self) -> io::Result<ExitStatus> {
     }
 }
 
-#[cfg(test)]
+#[cfg(all(test, not(target_os = "emscripten")))]
 mod tests {
     use super::*;
 
@@ -630,7 +630,6 @@ unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_in
     #[test]
     #[cfg_attr(target_os = "macos", ignore)]
     #[cfg_attr(target_os = "nacl", ignore)] // no signals on NaCl.
-    #[cfg_attr(target_os = "emscripten", ignore)]
     fn test_process_mask() {
         unsafe {
             // Test to make sure that a signal mask does not get inherited.
index 980ef01f549c36b9d10f0a1a49d738f8035c8a7d..1e879117f73abf2e185c0d7b57a05ad38aaed1f3 100644 (file)
@@ -29,6 +29,20 @@ pub struct Thread {
 unsafe impl Send for Thread {}
 unsafe impl Sync for Thread {}
 
+// The pthread_attr_setstacksize symbol doesn't exist in the emscripten libc,
+// so we have to not link to it to satisfy emcc's ERROR_ON_UNDEFINED_SYMBOLS.
+#[cfg(not(target_os = "emscripten"))]
+unsafe fn pthread_attr_setstacksize(attr: *mut libc::pthread_attr_t,
+                                    stack_size: libc::size_t) -> libc::c_int {
+    libc::pthread_attr_setstacksize(attr, stack_size)
+}
+
+#[cfg(target_os = "emscripten")]
+unsafe fn pthread_attr_setstacksize(_attr: *mut libc::pthread_attr_t,
+                                    _stack_size: libc::size_t) -> libc::c_int {
+    panic!()
+}
+
 impl Thread {
     pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
                           -> io::Result<Thread> {
@@ -38,8 +52,8 @@ pub unsafe fn new<'a>(stack: usize, p: Box<FnBox() + 'a>)
         assert_eq!(libc::pthread_attr_init(&mut attr), 0);
 
         let stack_size = cmp::max(stack, min_stack_size(&attr));
-        match libc::pthread_attr_setstacksize(&mut attr,
-                                              stack_size as libc::size_t) {
+        match pthread_attr_setstacksize(&mut attr,
+                                        stack_size as libc::size_t) {
             0 => {}
             n => {
                 assert_eq!(n, libc::EINVAL);
index 62d54da56b2ec95279eb421f8083b3d9222b1c93..1b9b4ab32ca40cb1cb1f767ef4cf565721470b7e 100644 (file)
@@ -8,6 +8,8 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// ignore-emscripten missing rust_begin_unwind
+
 #![feature(lang_items, start, collections)]
 #![no_std]