Call emcc with ERROR_ON_UNDEFINED_SYMBOLS

This commit is contained in:
Brian Anderson 2016-09-25 20:47:00 +00:00
parent 834bbab11b
commit d997a6291f
6 changed files with 28 additions and 8 deletions

View 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) => ({

View 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 {

View 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 {

View file

@ -369,7 +369,7 @@ impl Command {
}
// 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 @@ impl Process {
}
}
#[cfg(test)]
#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use super::*;
@ -630,7 +630,6 @@ mod tests {
#[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.

View 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 @@ impl Thread {
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);

View 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]