diff --git a/Makefile.in b/Makefile.in index bf2b9ee73..2f7112820 100644 --- a/Makefile.in +++ b/Makefile.in @@ -33,4 +33,4 @@ check: js-test .PHONY: clean clean: - rm -f js-test *.o *.a *.so *.dylib *.dll *.dummy + rm -f js-test *.o *.a *.so *.dylib *.rlib *.dll *.dummy diff --git a/glue.rs b/glue.rs index 127e87a1c..f8d9119ae 100644 --- a/glue.rs +++ b/glue.rs @@ -51,7 +51,15 @@ pub struct ProxyTraps { trace: Option } +#[cfg(not(target_os = "android"))] #[link(name = "jsglue")] +extern { } + + +#[cfg(target_os = "android")] +#[link_args = "-ljsglue -lstdc++ -lgcc"] +extern { } + extern { // FIXME: Couldn't run on rust_stack until rust issue #6470 fixed. diff --git a/js.rc b/js.rc index 9e71b117f..94403b900 100644 --- a/js.rc +++ b/js.rc @@ -4,8 +4,10 @@ #[crate_id = "github.com/mozilla-servo/rust-mozjs#js:0.1"]; #[crate_type = "lib"]; +#[crate_type = "dylib"]; +#[crate_type = "rlib"]; -#[feature(globs, managed_boxes)]; +#[feature(globs, link_args, managed_boxes)]; #[allow(non_uppercase_statics, non_camel_case_types)]; diff --git a/linkhack.rs b/linkhack.rs index 18934988b..17e7c3692 100644 --- a/linkhack.rs +++ b/linkhack.rs @@ -17,11 +17,13 @@ extern { } #[link(name = "z")] extern { } -//Avoid hard linking with stdc++ in android ndk cross toolchain +// Avoid hard linking with stdc++ in android ndk cross toolchain so that +// the ELF header will have an entry for libstdc++ and we will know to +// open it explicitly. //It is hard to find location of android system libs in this rust source file //and also we need to size down for mobile app packaging #[cfg(target_os = "android")] -#[link(name = "js_static")] -#[link(name = "stdc++")] +#[link(name = "mozjs")] +#[link_args="-lstdc++"] #[link(name = "z")] extern { }