]> git.lizzy.rs Git - rust.git/commitdiff
Support ARM and Android
authorkyeongwoon <kyeongwoon.lee@samsung.com>
Fri, 30 Nov 2012 00:21:49 +0000 (09:21 +0900)
committerBrian Anderson <banderson@mozilla.com>
Mon, 14 Jan 2013 00:43:39 +0000 (16:43 -0800)
Conflicts:
src/libcore/os.rs
src/librustc/back/link.rs
src/librustc/driver/driver.rs
src/librustc/metadata/loader.rs
src/librustc/middle/trans/base.rs

35 files changed:
Makefile.in
configure
src/libcore/cleanup.rs
src/libcore/libc.rs
src/libcore/os.rs
src/libcore/path.rs
src/libcore/run.rs
src/librustc/back/arm.rs [new file with mode: 0644]
src/librustc/back/link.rs
src/librustc/back/rpath.rs
src/librustc/back/x86.rs
src/librustc/back/x86_64.rs
src/librustc/driver/driver.rs
src/librustc/driver/session.rs
src/librustc/metadata/loader.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/foreign.rs
src/librustc/rustc.rc
src/libstd/net_tcp.rs
src/libstd/uv_ll.rs
src/rt/arch/arm/_context.S [new file with mode: 0644]
src/rt/arch/arm/ccall.S [new file with mode: 0644]
src/rt/arch/arm/context.cpp [new file with mode: 0644]
src/rt/arch/arm/context.h [new file with mode: 0644]
src/rt/arch/arm/gpr.cpp [new file with mode: 0644]
src/rt/arch/arm/gpr.h [new file with mode: 0644]
src/rt/arch/arm/record_sp.S [new file with mode: 0644]
src/rt/arch/arm/regs.h [new file with mode: 0644]
src/rt/rust_android_dummy.cpp [new file with mode: 0644]
src/rt/rust_android_dummy.h [new file with mode: 0644]
src/rt/rust_builtin.cpp
src/rt/rust_sched_loop.cpp
src/rt/rust_task.h
src/rustllvm/RustWrapper.cpp
src/rustllvm/rustllvm.def.in

index 963f455fe8ab2c8cb8b90ee3417ea722433e92f8..e476ac1dba2d1cf47eda06710cb7f828ca839557 100644 (file)
@@ -241,7 +241,7 @@ DRIVER_CRATE := $(S)src/driver/driver.rs
 ######################################################################
 
 # FIXME: x86-ism
-LLVM_COMPONENTS=x86 ipo bitreader bitwriter linker asmparser jit mcjit \
+LLVM_COMPONENTS=x86 arm ipo bitreader bitwriter linker asmparser jit mcjit \
                 interpreter
 
 define DEF_LLVM_VARS
index acf27a218a631921e15d8a7738e63c20215f8ea5..f466f0fa3d7bc34de864473979083387918cdc77 100755 (executable)
--- a/configure
+++ b/configure
@@ -717,7 +717,7 @@ do
     then
         msg "configuring LLVM for $t"
 
-        LLVM_TARGETS="--enable-targets=x86,x86_64"
+        LLVM_TARGETS="--enable-targets=x86,x86_64,arm"
         LLVM_BUILD="--build=$t"
         LLVM_HOST="--host=$t"
         LLVM_TARGET="--target=$t"
index c8b96b9b23baa43808d959212ab392b37956d628..656f672479e9998a4d26c95103f336b77678c88c 100644 (file)
@@ -40,11 +40,13 @@ struct AllocHeader { priv opaque: () }
 struct MemoryRegion { priv opaque: () }
 
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 struct Registers {
     data: [u32 * 16]
 }
 
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 struct Context {
     regs: Registers,
     next: *Context,
@@ -70,6 +72,7 @@ struct BoxedRegion {
 }
 
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 struct Task {
     // Public fields
     refcount: intptr_t,                 // 0
index cc9e4d1c5a9affe089c9f10b9807ecfa999cb53f..ecd48fe16bc35c7a0047af944eda8c6dbb53df6c 100644 (file)
@@ -198,12 +198,14 @@ pub mod bsd44 {}
     // Standard types that are scalar but vary by OS and arch.
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     pub mod os {
         pub mod common {
             pub mod posix01 {}
         }
 
         #[cfg(target_arch = "x86")]
+        #[cfg(target_arch = "arm")]
         pub mod arch {
             pub mod c95 {
                 pub type c_char = i8;
@@ -797,6 +799,7 @@ pub mod extra {
 
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     pub mod os {
         pub mod c95 {
             pub const EXIT_FAILURE : int = 1;
@@ -1264,6 +1267,7 @@ unsafe fn read(fd: c_int, buf: *mut c_void, count: c_uint)
 
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "freebsd")]
     pub mod posix88 {
@@ -1283,7 +1287,8 @@ pub mod posix88 {
 
             #[cfg(target_os = "linux")]
             #[cfg(target_os = "freebsd")]
-            unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
+            #[cfg(target_os = "android")]
+           unsafe fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
 
             #[cfg(target_os = "macos")]
             #[link_name = "fstat64"]
@@ -1294,6 +1299,7 @@ pub mod posix88 {
 
             #[cfg(target_os = "linux")]
             #[cfg(target_os = "freebsd")]
+            #[cfg(target_os = "android")]
             unsafe fn stat(path: *c_char, buf: *mut stat) -> c_int;
 
             #[cfg(target_os = "macos")]
@@ -1382,6 +1388,7 @@ unsafe fn write(fd: c_int, buf: *c_void, count: size_t)
     }
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "freebsd")]
     pub mod posix01 {
@@ -1394,6 +1401,7 @@ pub mod posix01 {
         pub extern mod stat_ {
             #[cfg(target_os = "linux")]
             #[cfg(target_os = "freebsd")]
+            #[cfg(target_os = "android")]
             unsafe fn lstat(path: *c_char, buf: *mut stat) -> c_int;
 
             #[cfg(target_os = "macos")]
@@ -1410,6 +1418,7 @@ unsafe fn readlink(path: *c_char, buf: *mut c_char,
             unsafe fn fsync(fd: c_int) -> c_int;
 
             #[cfg(target_os = "linux")]
+            #[cfg(target_os = "android")]
             unsafe fn fdatasync(fd: c_int) -> c_int;
 
             unsafe fn setenv(name: *c_char, val: *c_char,
@@ -1442,6 +1451,7 @@ pub mod posix01 {
 
     #[cfg(target_os = "win32")]
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "freebsd")]
     pub mod posix08 {
@@ -1473,6 +1483,7 @@ unsafe fn sysctlnametomib(name: *c_char, mibp: *mut c_int,
 
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     #[cfg(target_os = "win32")]
     pub mod bsd44 {
     }
@@ -1492,6 +1503,7 @@ pub mod extra {
     }
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     pub mod extra {
     }
 
index f602b230f45e5c6fbf4582ead792cd4a86c30541..ff3253a8223ffd30ed7ba6cc48b7fb0caf6edc95 100644 (file)
@@ -325,6 +325,7 @@ pub fn fsync_fd(fd: c_int, _level: io::fsync::Level) -> c_int {
 }
 
 #[cfg(target_os = "linux")]
+#[cfg(target_os = "android")]
 pub fn fsync_fd(fd: c_int, level: io::fsync::Level) -> c_int {
     unsafe {
         use libc::funcs::posix01::unistd::*;
@@ -449,6 +450,7 @@ fn load_self() -> Option<~str> {
     }
 
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "android")]
     fn load_self() -> Option<~str> {
         unsafe {
             use libc::funcs::posix01::unistd::readlink;
@@ -876,6 +878,7 @@ pub fn real_args() -> ~[~str] {
 }
 
 #[cfg(target_os = "linux")]
+#[cfg(target_os = "android")]
 #[cfg(target_os = "freebsd")]
 pub fn real_args() -> ~[~str] {
     unsafe {
@@ -976,7 +979,6 @@ pub mod windows {
         pub const FAMILY: &str = "windows";
     }
 
-
     #[cfg(target_os = "macos")]
     use os::consts::macos::*;
 
@@ -986,6 +988,9 @@ pub mod windows {
     #[cfg(target_os = "linux")]
     use os::consts::linux::*;
 
+    #[cfg(target_os = "android")]
+    use os::consts::android::*;
+
     #[cfg(target_os = "win32")]
     use os::consts::win32::*;
 
@@ -1010,6 +1015,13 @@ pub mod linux {
         pub const EXE_SUFFIX: &str = "";
     }
 
+    pub mod android {
+        pub const SYSNAME: &str = "android";
+        pub const DLL_PREFIX: &str = "lib";
+        pub const DLL_SUFFIX: &str = ".so";
+        pub const EXE_SUFFIX: &str = "";
+    }
+
     pub mod win32 {
         pub const SYSNAME: &str = "win32";
         pub const DLL_PREFIX: &str = "";
index cf1188b1f350986dc5374043e538d259578b88fb..7f5f334ac1f9a42876f1b1392336aed1b92083ab 100644 (file)
@@ -89,8 +89,10 @@ pub trait GenericPath {
 }
 
 #[cfg(target_os = "linux")]
+#[cfg(target_os = "android")]
 mod stat {
     #[cfg(target_arch = "x86")]
+    #[cfg(target_arch = "arm")]
     pub mod arch {
         use libc;
 
index 435feb160235192f24cad1a39f6ab36685b3aa74..54bce77d30885406f1466355ca360c7bf4806ab3 100644 (file)
@@ -405,6 +405,7 @@ fn waitpid_os(pid: pid_t) -> int {
     #[cfg(unix)]
     fn waitpid_os(pid: pid_t) -> int {
         #[cfg(target_os = "linux")]
+        #[cfg(target_os = "android")]
         fn WIFEXITED(status: i32) -> bool {
             (status & 0xffi32) == 0i32
         }
@@ -416,6 +417,7 @@ fn WIFEXITED(status: i32) -> bool {
         }
 
         #[cfg(target_os = "linux")]
+        #[cfg(target_os = "android")]
         fn WEXITSTATUS(status: i32) -> i32 {
             (status >> 8i32) & 0xffi32
         }
diff --git a/src/librustc/back/arm.rs b/src/librustc/back/arm.rs
new file mode 100644 (file)
index 0000000..2c4e0af
--- /dev/null
@@ -0,0 +1,85 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use back::target_strs;
+use driver::session;
+use session::sess_os_to_meta_os;
+use metadata::loader::meta_section_name;
+
+fn get_target_strs(target_os: session::os) -> target_strs::t {
+    return {
+        module_asm: ~"",
+
+        meta_sect_name: meta_section_name(sess_os_to_meta_os(target_os)),
+
+        data_layout: match target_os {
+          session::os_macos => {
+            ~"e-p:32:32:32" +
+                ~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
+                ~"-f32:32:32-f64:64:64" +
+                ~"-v64:64:64-v128:64:128" +
+                ~"-a0:0:64-n32"
+          }
+
+          session::os_win32 => {
+            ~"e-p:32:32:32" +
+                ~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
+                ~"-f32:32:32-f64:64:64" +
+                ~"-v64:64:64-v128:64:128" +
+                ~"-a0:0:64-n32"
+          }
+
+          session::os_linux => {
+            ~"e-p:32:32:32" +
+                ~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
+                ~"-f32:32:32-f64:64:64" +
+                ~"-v64:64:64-v128:64:128" +
+                ~"-a0:0:64-n32"
+          }
+
+          session::os_android => {
+            ~"e-p:32:32:32" +
+                ~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
+                ~"-f32:32:32-f64:64:64" +
+                ~"-v64:64:64-v128:64:128" +
+                ~"-a0:0:64-n32"
+          }
+
+          session::os_freebsd => {
+            ~"e-p:32:32:32" +
+                ~"-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64" +
+                ~"-f32:32:32-f64:64:64" +
+                ~"-v64:64:64-v128:64:128" +
+                ~"-a0:0:64-n32"
+          }
+        },
+
+        target_triple: match target_os {
+          session::os_macos => ~"arm-apple-darwin",
+          session::os_win32 => ~"arm-pc-mingw32",
+          session::os_linux => ~"arm-unknown-linux",
+          session::os_android => ~"arm-unknown-android",
+          session::os_freebsd => ~"arm-unknown-freebsd"
+        },
+
+        cc_args: ~[~"-marm"]
+    };
+}
+
+
+//
+// Local Variables:
+// mode: rust
+// fill-column: 78;
+// indent-tabs-mode: nil
+// c-basic-offset: 4
+// buffer-file-coding-system: utf-8-unix
+// End:
+//
index 0512994f99404dd0a6b4a7e6d9fcedcc2ef79bb3..e49d9da335569de39198341687d38b050ee6b145 100644 (file)
@@ -30,7 +30,7 @@
 use core::hash;
 use core::io::{Writer, WriterUtil};
 use core::libc::{c_int, c_uint, c_char};
-use core::os::consts::{macos, freebsd, linux, win32};
+use core::os::consts::{macos, freebsd, linux, android, win32};
 use core::os;
 use core::ptr;
 use core::run;
@@ -43,7 +43,7 @@
 use syntax::attr;
 use syntax::print::pprust;
 
-pub enum output_type {
+enum output_type {
     output_type_none,
     output_type_bitcode,
     output_type_assembly,
@@ -712,6 +712,7 @@ fn output_dll_filename(os: session::os, lm: &link_meta) -> ~str {
         session::os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
         session::os_macos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
         session::os_linux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
+        session::os_android => (android::DLL_PREFIX, android::DLL_SUFFIX),
         session::os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
     };
     return str::from_slice(dll_prefix) + libname +
@@ -758,7 +759,10 @@ fn unlib(config: @session::config, +stem: ~str) -> ~str {
     // For win32, there is no cc command,
     // so we add a condition to make it use gcc.
     let cc_prog: ~str =
-        if sess.targ_cfg.os == session::os_win32 { ~"gcc" } else { ~"cc" };
+        if sess.targ_cfg.os == session::os_android {
+            ~"arm-linux-androideabi-g++"
+        } else if sess.targ_cfg.os == session::os_win32 { ~"gcc" }
+        else { ~"cc" };
     // The invocations of cc share some flags across platforms
 
     let mut cc_args =
@@ -831,6 +835,11 @@ fn unlib(config: @session::config, +stem: ~str) -> ~str {
         // have to be explicit about linking to it. See #2510
         cc_args.push(~"-lm");
     }
+    else if sess.targ_cfg.os == session::os_android {
+        cc_args.push_all(~[~"-ldl", ~"-llog",  ~"-lsupc++",
+                           ~"-lgnustl_shared"]);
+        cc_args.push(~"-lm");
+    }
 
     if sess.targ_cfg.os == session::os_freebsd {
         cc_args.push_all(~[~"-pthread", ~"-lrt",
@@ -851,7 +860,9 @@ fn unlib(config: @session::config, +stem: ~str) -> ~str {
     }
 
     // Stack growth requires statically linking a __morestack function
+    if sess.targ_cfg.os != session::os_android {
     cc_args.push(~"-lmorestack");
+    }
 
     // FIXME (#2397): At some point we want to rpath our guesses as to where
     // extern libraries might live, based on the addl_lib_search_paths
index 8378270bee4a1ba6acb77a5914ff094976083023..005a5404b37e6a9eb6dfbc6ee71b1f5dd4d453b2 100644 (file)
@@ -130,7 +130,8 @@ fn get_rpath_relative_to_output(os: session::os,
 
     // Mac doesn't appear to support $ORIGIN
     let prefix = match os {
-        session::os_linux | session::os_freebsd => "$ORIGIN",
+        session::os_android |session::os_linux | session::os_freebsd
+                          => "$ORIGIN",
         session::os_macos => "@executable_path",
         session::os_win32 => util::unreachable()
     };
@@ -331,6 +332,7 @@ fn test_relative_to8() {
 
     #[test]
     #[cfg(target_os = "linux")]
+    #[cfg(target_os = "andorid")]
     fn test_rpath_relative() {
       let o = session::os_linux;
       let res = get_rpath_relative_to_output(o,
index 205867feb3d4b8f4fd7475b69d6ed8504f9df050..7ac2bb73ebb854bee8c2bb7b44e9195855254e50 100644 (file)
@@ -35,6 +35,9 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
           session::os_linux => {
             ~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
           }
+          session::os_android => {
+            ~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
+          }
 
           session::os_freebsd => {
             ~"e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
@@ -45,6 +48,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
           session::os_macos => ~"i686-apple-darwin",
           session::os_win32 => ~"i686-pc-mingw32",
           session::os_linux => ~"i686-unknown-linux-gnu",
+          session::os_android => ~"i686-unknown-android-gnu",
           session::os_freebsd => ~"i686-unknown-freebsd"
         },
 
index 929634e5bd32155bae6797f320e472b50e833fba..aaf9758781301b255169a729433edc9775f6a6b6 100644 (file)
@@ -39,6 +39,11 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
                 ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
                 ~"s0:64:64-f80:128:128-n8:16:32:64-S128"
           }
+          session::os_android => {
+            ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
+                ~"f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-"+
+                ~"s0:64:64-f80:128:128-n8:16:32:64-S128"
+          }
 
           session::os_freebsd => {
             ~"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-"+
@@ -51,6 +56,7 @@ fn get_target_strs(target_os: session::os) -> target_strs::t {
           session::os_macos => ~"x86_64-apple-darwin",
           session::os_win32 => ~"x86_64-pc-mingw32",
           session::os_linux => ~"x86_64-unknown-linux-gnu",
+          session::os_android => ~"x86_64-unknown-android-gnu",
           session::os_freebsd => ~"x86_64-unknown-freebsd",
         },
 
index 1e1e1d2b32582e09572ac8610717c5fa2435f053..030856539a5e86cf29fbffae304a0972c482573d 100644 (file)
@@ -12,7 +12,7 @@
 use core::prelude::*;
 
 use back::link;
-use back::{x86, x86_64};
+use back::{arm, x86, x86_64};
 use front;
 use lib::llvm::llvm;
 use metadata::{creader, cstore, filesearch};
@@ -74,9 +74,18 @@ fn default_configuration(sess: Session, +argv0: ~str, input: input) ->
       session::os_win32 => ~"msvcrt.dll",
       session::os_macos => ~"libc.dylib",
       session::os_linux => ~"libc.so.6",
+      session::os_android => ~"libc.so",
       session::os_freebsd => ~"libc.so.7"
       // _ { "libc.so" }
     };
+    let tos = match sess.targ_cfg.os {
+      session::os_win32 => ~"win32",
+      session::os_macos => ~"macos",
+      session::os_linux => ~"linux",
+      session::os_android => ~"android",
+      session::os_freebsd => ~"freebsd"
+      // _ { "libc.so" }
+    };
 
     let mk = attr::mk_name_value_item_str;
 
@@ -88,7 +97,7 @@ fn default_configuration(sess: Session, +argv0: ~str, input: input) ->
 
     return ~[ // Target bindings.
          attr::mk_word_item(str::from_slice(os::FAMILY)),
-         mk(~"target_os", str::from_slice(os::SYSNAME)),
+         mk(~"target_os", tos),
          mk(~"target_family", str::from_slice(os::FAMILY)),
          mk(~"target_arch", arch),
          mk(~"target_word_size", wordsz),
@@ -424,6 +433,8 @@ fn get_os(triple: ~str) -> Option<session::os> {
             Some(session::os_macos)
         } else if str::contains(triple, ~"linux") {
             Some(session::os_linux)
+        } else if str::contains(triple, ~"android") {
+            Some(session::os_android)
         } else if str::contains(triple, ~"freebsd") {
             Some(session::os_freebsd)
         } else { None }
@@ -463,7 +474,7 @@ fn build_target_config(sopts: @session::options,
     let target_strs = match arch {
       session::arch_x86 => x86::get_target_strs(os),
       session::arch_x86_64 => x86_64::get_target_strs(os),
-      session::arch_arm => x86::get_target_strs(os)
+      session::arch_arm => arm::get_target_strs(os)
     };
     let target_cfg: @session::config =
         @{os: os, arch: arch, target_strs: target_strs, int_type: int_type,
index ee34570203bc5d9e3ddb9f65038f3dd9439c6248..b2b6cb25dbb7b46c4136e9749e5986872007b1b7 100644 (file)
@@ -29,7 +29,7 @@
 use syntax::{ast, codemap};
 use syntax;
 
-enum os { os_win32, os_macos, os_linux, os_freebsd, }
+enum os { os_win32, os_macos, os_linux, os_android, os_freebsd, }
 
 impl os : cmp::Eq {
     pure fn eq(&self, other: &os) -> bool {
@@ -326,6 +326,7 @@ fn sess_os_to_meta_os(os: os) -> metadata::loader::os {
     match os {
       os_win32 => loader::os_win32,
       os_linux => loader::os_linux,
+      os_android => loader::os_android,
       os_macos => loader::os_macos,
       os_freebsd => loader::os_freebsd
     }
index 535f45ae8395419ee89a8cc8bdd3abbdab062d86..58c9a1b90f247729725b16fb862b73d4d957ccfd 100644 (file)
@@ -28,7 +28,7 @@
 use core::flate;
 use core::io::WriterUtil;
 use core::io;
-use core::os::consts::{macos, freebsd, linux, win32};
+use core::os::consts::{macos, freebsd, linux, android, win32};
 use core::option;
 use core::ptr;
 use core::str;
@@ -36,7 +36,7 @@
 use core::vec;
 
 export os;
-export os_macos, os_win32, os_linux, os_freebsd;
+export os_macos, os_win32, os_linux, os_freebsd, os_android;
 export ctxt;
 export load_library_crate;
 export list_file_metadata;
@@ -49,6 +49,7 @@ enum os {
     os_macos,
     os_win32,
     os_linux,
+    os_android,
     os_freebsd
 }
 
@@ -86,6 +87,7 @@ fn libname(cx: ctxt) -> {prefix: ~str, suffix: ~str} {
         os_win32 => (win32::DLL_PREFIX, win32::DLL_SUFFIX),
         os_macos => (macos::DLL_PREFIX, macos::DLL_SUFFIX),
         os_linux => (linux::DLL_PREFIX, linux::DLL_SUFFIX),
+        os_android => (android::DLL_PREFIX, android::DLL_SUFFIX),
         os_freebsd => (freebsd::DLL_PREFIX, freebsd::DLL_SUFFIX),
     };
     return {
@@ -251,6 +253,7 @@ fn meta_section_name(os: os) -> ~str {
       os_macos => ~"__DATA,__note.rustc",
       os_win32 => ~".note.rustc",
       os_linux => ~".note.rustc",
+      os_android => ~".note.rustc",
       os_freebsd => ~".note.rustc"
     }
 }
index a8b0da47e9ac2344c48571ab47a99fe0b56fdf71..165d9b60a61d9f61058d808ee01d4801cc652476 100644 (file)
@@ -2152,7 +2152,9 @@ fn register_fn_fuller(ccx: @crate_ctxt,
     let llfn: ValueRef = decl_fn(ccx.llmod, copy ps, cc, llfty);
     ccx.item_symbols.insert(node_id, ps);
 
-    let is_main = is_main_name(path) && !ccx.sess.building_library;
+    let is_main = is_main_name(path) && (!ccx.sess.building_library ||
+                      (ccx.sess.building_library &&
+                       ccx.sess.targ_cfg.os == session::os_android));
     if is_main { create_main_wrapper(ccx, sp, llfn); }
     llfn
 }
@@ -2202,7 +2204,12 @@ fn create_entry_fn(ccx: @crate_ctxt, rust_main: ValueRef) {
         #[cfg(unix)]
         fn main_name() -> ~str { return ~"main"; }
         let llfty = T_fn(~[ccx.int_type, ccx.int_type], ccx.int_type);
-        let llfn = decl_cdecl_fn(ccx.llmod, main_name(), llfty);
+
+        let llfn = if ccx.sess.building_library {
+            decl_cdecl_fn(ccx.llmod, ~"amain", llfty)
+        } else {
+            decl_cdecl_fn(ccx.llmod, main_name(), llfty)
+        };
         let llbb = str::as_c_str(~"top", |buf| {
             unsafe {
                 llvm::LLVMAppendBasicBlock(llfn, buf)
@@ -2217,14 +2224,16 @@ fn create_entry_fn(ccx: @crate_ctxt, rust_main: ValueRef) {
                              val_ty(crate_map)], ccx.int_type);
         let start = decl_cdecl_fn(ccx.llmod, ~"rust_start", start_ty);
 
-        let args = unsafe {
-            ~[
-                rust_main,
-                llvm::LLVMGetParam(llfn, 0 as c_uint),
-                llvm::LLVMGetParam(llfn, 1 as c_uint),
-                crate_map
-            ]
+        let args = if ccx.sess.building_library unsafe {
+            ~[rust_main,
+              llvm::LLVMConstInt(T_i32(), 0u as c_ulonglong, False),
+              llvm::LLVMConstInt(T_i32(), 0u as c_ulonglong, False),
+              crate_map]
+        } else unsafe {
+            ~[rust_main, llvm::LLVMGetParam(llfn, 0 as c_uint),
+              llvm::LLVMGetParam(llfn, 1 as c_uint), crate_map]
         };
+
         let result = unsafe {
             llvm::LLVMBuildCall(bld, start, vec::raw::to_ptr(args),
                                 args.len() as c_uint, noname())
index 06383cfa228f9a5133bb36169f3780c96a9b6736..4c373e0d2170a808c7800d0e80978b4e1e9c470d 100644 (file)
@@ -15,6 +15,7 @@
 
 use back::{link, abi};
 use driver::session::arch_x86_64;
+use driver::session::arch_arm;
 use lib::llvm::{SequentiallyConsistent, Acquire, Release, Xchg};
 use lib::llvm::{Struct, Array, ModuleRef, CallConv, Attribute};
 use lib::llvm::{StructRetAttribute, ByValAttribute};
@@ -494,6 +495,8 @@ fn c_stack_tys(ccx: @crate_ctxt,
     let ret_def = !ty::type_is_bot(ret_ty) && !ty::type_is_nil(ret_ty);
     let x86_64 = if ccx.sess.targ_cfg.arch == arch_x86_64 {
         option::Some(x86_64_tys(llargtys, llretty, ret_def))
+    } else if ccx.sess.targ_cfg.arch == arch_arm {
+        option::Some(x86_64_tys(llargtys, llretty, ret_def))
     } else {
         option::None
     };
@@ -1491,6 +1494,14 @@ fn register_foreign_fn(ccx: @crate_ctxt,
             register_fn_fuller(ccx, sp, /*bad*/copy path, node_id, attrs,
                                t, lib::llvm::CCallConv, fnty)
         }
+    } else if ccx.sess.targ_cfg.arch == arch_arm {
+        let ret_def = !ty::type_is_bot(ret_ty) && !ty::type_is_nil(ret_ty);
+        let x86_64 = x86_64_tys(llargtys, llretty, ret_def);
+        do decl_x86_64_fn(x86_64) |fnty| {
+            register_fn_fuller(ccx, sp, /*bad*/copy path, node_id, attrs,
+                               t, lib::llvm::CCallConv, fnty)
+        }
+
     } else {
         let llfty = T_fn(llargtys, llretty);
         register_fn_fuller(ccx, sp, path, node_id, attrs,
index 60780df52873d2954280c1628ee10c853c8b1250..56a228991939b60fdcb9599d4af038eb590350be 100644 (file)
@@ -162,6 +162,8 @@ mod back {
     #[legacy_exports]
     mod upcall;
     #[legacy_exports]
+    mod arm;
+    #[legacy_exports]
     mod x86;
     #[legacy_exports]
     mod x86_64;
index 9e0dc0ff12e0b832aebd070ec1793e4ee1d0ad46..847962c1773a9a72457b0196eb26a93bd91b1a01 100644 (file)
@@ -1291,6 +1291,7 @@ pub mod test {
     #[cfg(target_os="win32")]
     #[cfg(target_os="darwin")]
     #[cfg(target_os="linux")]
+    #[cfg(target_os="android")]
     pub mod tcp_ipv4_server_and_client_test {
         #[cfg(target_arch="x86_64")]
         pub mod impl64 {
@@ -1329,6 +1330,7 @@ fn test_tcp_socket_impl_reader_handles_eof() {
             }
         }
         #[cfg(target_arch="x86")]
+        #[cfg(target_arch="arm")]
         pub mod impl32 {
             use net::tcp::test::*;
 
index 778daf131c4b0e78f6a14c9df19adbc0419ae285..eee3d60a66d6cf6664f30071bdc20d97d36fde07 100644 (file)
@@ -109,6 +109,7 @@ pub enum uv_handle_type {
     a29: *u8
 };
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 pub type uv_tcp_t_32bit_unix_riders = {
     a29: *u8, a30: *u8, a31: *u8,
     a32: *u8, a33: *u8, a34: *u8,
@@ -165,6 +166,7 @@ pub enum uv_handle_type {
     a13: *u8
 };
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 pub type uv_write_t_32bit_unix_riders = {
     a13: *u8, a14: *u8
 };
@@ -192,6 +194,7 @@ pub enum uv_handle_type {
     a10: *u8
 };
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 pub type uv_async_t_32bit_unix_riders = {
     a10: *u8, a11: *u8, a12: *u8, a13: *u8
 };
@@ -220,6 +223,7 @@ pub enum uv_handle_type {
     a10: *u8, a11: *u8
 };
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 pub type uv_timer_t_32bit_unix_riders = {
     a10: *u8, a11: *u8, a12: *u8, a13: *u8,
     a14: *u8, a15: *u8, a16: *u8
@@ -249,6 +253,7 @@ pub enum uv_handle_type {
     a2: *u8, a3: *u8
 };
 #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
 pub type sockaddr_in6 = {
     a0: *u8, a1: *u8,
     a2: *u8, a3: *u8,
@@ -267,6 +272,7 @@ pub mod addr_in_impl {
         a2: *u8, a3: *u8
     };
     #[cfg(target_arch="x86")]
+#[cfg(target_arch="arm")]
     pub type addr_in = {
         a0: *u8, a1: *u8,
         a2: *u8, a3: *u8,
@@ -285,6 +291,7 @@ pub mod addr_in_impl {
 // unix size: 48, 32bit: 32
 pub type addrinfo = addrinfo_impl::addrinfo;
 #[cfg(target_os="linux")]
+#[cfg(target_os="android")]
 pub mod addrinfo_impl {
     #[cfg(target_arch="x86_64")]
     pub type addrinfo = {
@@ -292,6 +299,7 @@ pub mod addrinfo_impl {
         a04: *u8, a05: *u8
     };
     #[cfg(target_arch="x86")]
+    #[cfg(target_arch="arm")]
     pub type addrinfo = {
         a00: *u8, a01: *u8, a02: *u8, a03: *u8,
         a04: *u8, a05: *u8, a06: *u8, a07: *u8
@@ -328,6 +336,7 @@ pub mod uv_ll_struct_stubgen {
     pub fn gen_stub_uv_tcp_t() -> uv_tcp_t {
         return gen_stub_os();
         #[cfg(target_os = "linux")]
+        #[cfg(target_os = "android")]
         #[cfg(target_os = "macos")]
         #[cfg(target_os = "freebsd")]
         pub fn gen_stub_os() -> uv_tcp_t {
@@ -358,6 +367,7 @@ pub fn gen_stub_arch() -> uv_tcp_t {
                 };
             }
             #[cfg(target_arch="x86")]
+            #[cfg(target_arch="arm")]
             pub fn gen_stub_arch() -> uv_tcp_t {
                 return { fields: { loop_handle: ptr::null(), type_: 0u32,
                                 close_cb: ptr::null(),
@@ -443,6 +453,7 @@ pub fn gen_stub_arch() -> uv_async_t {
             };
         }
         #[cfg(target_arch = "x86")]
+        #[cfg(target_arch="arm")]
         pub fn gen_stub_arch() -> uv_async_t {
             return { fields: { loop_handle: ptr::null(), type_: 0u32,
                             close_cb: ptr::null(),
@@ -492,6 +503,7 @@ pub fn gen_stub_arch() -> uv_timer_t {
             };
         }
         #[cfg(target_arch = "x86")]
+        #[cfg(target_arch="arm")]
         pub fn gen_stub_arch() -> uv_timer_t {
             return { fields: { loop_handle: ptr::null(), type_: 0u32,
                             close_cb: ptr::null(),
@@ -541,6 +553,7 @@ pub fn gen_stub_arch() -> uv_write_t {
             };
         }
         #[cfg(target_arch="x86")]
+        #[cfg(target_arch="arm")]
         pub fn gen_stub_arch() -> uv_write_t {
             return { fields: { loop_handle: ptr::null(), type_: 0u32,
                             close_cb: ptr::null(),
@@ -1571,6 +1584,7 @@ fn impl_uv_tcp_server_and_request() unsafe {
     #[cfg(target_os="win32")]
     #[cfg(target_os="darwin")]
     #[cfg(target_os="linux")]
+    #[cfg(target_os="android")]
     pub mod tcp_and_server_client_test {
         #[cfg(target_arch="x86_64")]
         pub mod impl64 {
@@ -1581,6 +1595,7 @@ pub fn test_uv_ll_tcp_server_and_request() unsafe {
             }
         }
         #[cfg(target_arch="x86")]
+        #[cfg(target_arch="arm")]
         pub mod impl32 {
             use uv_ll::test::*;
             #[test]
diff --git a/src/rt/arch/arm/_context.S b/src/rt/arch/arm/_context.S
new file mode 100644 (file)
index 0000000..8d370c2
--- /dev/null
@@ -0,0 +1,47 @@
+.text
+.code 32
+.arm
+.align
+
+
+.globl swap_registers
+swap_registers:
+       str r0, [r0, #0]
+       str r3, [r0, #12]
+       str r4, [r0, #16]
+       str r5, [r0, #20]
+       str r6, [r0, #24]
+       str r7, [r0, #28]
+       str r8, [r0, #32]
+       str r9, [r0, #36]
+       str r10, [r0, #40]
+       str r11, [r0, #44]
+       str r12, [r0, #48]
+       str sp, [r0, #52] 
+       str lr, [r0, #56]
+
+       mrs r2, cpsr
+       str r2, [r0, #64]
+       
+
+       ldr r0, [r1, #0]
+       ldr r3, [r1, #12]
+       ldr r4, [r1, #16]
+       ldr r5, [r1, #20]
+       ldr r6, [r1, #24]
+       ldr r7, [r1, #28]
+       ldr r8, [r1, #32]
+       ldr r9, [r1, #36]
+       ldr r10, [r1, #40]
+       ldr r11, [r1, #44]
+       ldr r12, [r1, #48]
+       
+       ldr sp, [r1, #52]
+       ldr lr, [r1, #56]
+        
+       ldr r2, [r1, #64]
+       msr cpsr_cxsf, r2
+
+       mov pc, lr
+
+
diff --git a/src/rt/arch/arm/ccall.S b/src/rt/arch/arm/ccall.S
new file mode 100644 (file)
index 0000000..4b89cc9
--- /dev/null
@@ -0,0 +1,27 @@
+.text
+.code 32
+.arm
+.align
+
+.globl __morestack
+.hidden __morestack
+__morestack:
+       mov r3, sp
+       mov sp, r2
+       
+       str r3, [sp]
+       str lr, [sp, #-4]
+       
+       sub sp, #8
+       
+       blx r1
+
+       add sp, #8
+       
+       ldr lr, [sp, #-4]
+       ldr r3, [sp] 
+       
+       mov sp, r3
+       mov pc, lr
+       
+
diff --git a/src/rt/arch/arm/context.cpp b/src/rt/arch/arm/context.cpp
new file mode 100644 (file)
index 0000000..dbf06a5
--- /dev/null
@@ -0,0 +1,36 @@
+
+#include "context.h"
+#include "../../rust_globals.h"
+
+extern "C" void CDECL swap_registers(registers_t *oregs,
+                                     registers_t *regs)
+asm ("swap_registers");
+
+context::context()
+{
+    assert((void*)&regs == (void*)this);
+    memset(&regs, 0, sizeof(regs));
+}
+
+void context::swap(context &out)
+{
+    swap_registers(&out.regs, &regs);
+}
+
+void context::call(void *f, void *arg, void *stack)
+{
+  // Get the current context, which we will then modify to call the
+  // given function.
+  swap(*this);
+
+  // set up the stack
+  uint32_t *sp = ( uint32_t *)stack;
+  //sp = align_down(sp);
+  // The final return address. 0 indicates the bottom of the stack
+  *--sp = 0;
+
+  regs.data[0] = ( uint32_t )arg; // r0
+  regs.data[13] = ( uint32_t )sp; //#52 sp, r13
+  regs.data[14] = ( uint32_t )f;  //#60 pc, r15 --> lr,
+  // Last base pointer on the stack should be 0
+}
diff --git a/src/rt/arch/arm/context.h b/src/rt/arch/arm/context.h
new file mode 100644 (file)
index 0000000..6c7db76
--- /dev/null
@@ -0,0 +1,43 @@
+// -*- mode: c++ -*-
+
+#ifndef CONTEXT_H
+#define CONTEXT_H
+
+#include <cstdlib>
+#include <inttypes.h>
+#include <stdint.h>
+//#include <xmmintrin.h>
+
+#include "vg/memcheck.h"
+
+template<typename T>
+T align_down(T sp)
+{
+    // There is no platform we care about that needs more than a
+    // 16-byte alignment.
+    return (T)((uint32_t)sp & ~(16 - 1));
+}
+
+// The struct in which we store the saved data.  This is mostly the
+// volatile registers and instruction pointer, but it also includes
+// RCX/RDI which are used to pass arguments.  The indices for each
+// register are found in "regs.h".  Note that the alignment must be
+// 16 bytes so that SSE instructions can be used.
+#include "regs.h"
+struct registers_t {
+    uint32_t data[RUSTRT_MAX];
+} __attribute__((aligned(16)));
+
+class context {
+public:
+    registers_t regs;
+
+    context();
+
+    context *next;
+
+    void swap(context &out);
+    void call(void *f, void *arg, void *sp);
+};
+
+#endif
diff --git a/src/rt/arch/arm/gpr.cpp b/src/rt/arch/arm/gpr.cpp
new file mode 100644 (file)
index 0000000..32a68d0
--- /dev/null
@@ -0,0 +1,15 @@
+#include "gpr.h"
+
+#define LOAD(rn) do { \
+    uintptr_t tmp; \
+    asm("mov %%" #rn ",%0" : "=r" (tmp) :); \
+    this->rn = tmp; \
+} while (0)
+
+void rust_gpr::load() {
+    LOAD(r0); LOAD(r1); LOAD(r2); LOAD(r3);
+    LOAD(r4); LOAD(r5); LOAD(r6); LOAD(r7);
+    LOAD(r8);  LOAD(r9);  LOAD(r10); LOAD(r11);
+    LOAD(r12); LOAD(r13); LOAD(r14); LOAD(r15);
+}
+
diff --git a/src/rt/arch/arm/gpr.h b/src/rt/arch/arm/gpr.h
new file mode 100644 (file)
index 0000000..472c8a0
--- /dev/null
@@ -0,0 +1,23 @@
+// General-purpose registers. This structure is used during stack crawling.
+
+#ifndef GPR_H
+#define GPR_H
+
+#include "rust_gpr_base.h"
+
+class rust_gpr : public rust_gpr_base {
+public:
+    uintptr_t r0, r1, r2, r3, r4, r5, r6, r7;
+    uintptr_t  r8,  r9, r10, r11, r12, r13, r14, r15;
+
+    inline uintptr_t get_fp() { return r11; }
+    inline uintptr_t get_ip() { return r12; }
+
+    inline void set_fp(uintptr_t new_fp) { r11 = new_fp; }
+    inline void set_ip(uintptr_t new_ip) { r12 = new_ip; }
+
+    void load();
+};
+
+#endif
+
diff --git a/src/rt/arch/arm/record_sp.S b/src/rt/arch/arm/record_sp.S
new file mode 100644 (file)
index 0000000..193104d
--- /dev/null
@@ -0,0 +1,61 @@
+.text
+.code 32
+.arm
+.align
+
+
+.globl record_sp_limit
+.globl get_sp_limit
+.globl get_sp
+
+record_sp_limit:
+       mov r3, r0
+       ldr r0, =my_cpu
+       mov r1, #0
+       mov r2, #0
+    stmfd   sp!, {r3, r7}
+    ldr     r7, =345
+    swi     #0
+    ldmfd   sp!, {r3, r7}
+    movs    r0, r0
+       movmi   r0, #0
+
+       ldr r1, =my_array
+       str r3, [r1, r0]
+       mov pc, lr
+
+
+get_sp_limit:
+    ldr r0, =my_cpu
+       mov r1, #0
+       mov r2, #0
+    stmfd   sp!, {r4, r7}
+    ldr     r7, =345
+    swi     #0
+    ldmfd   sp!, {r4, r7}
+    movs    r0, r0
+       movmi   r0, #0
+       mov r3, r0
+
+       ldr r1, =my_array
+       ldr r0, [r1, r3]
+       mov pc, lr
+
+
+get_sp:
+       mov r0, sp
+       mov pc, lr
+       
+.data
+my_cpu:        .long   0
+.global my_array
+my_array:      
+       .long   0
+       .long   0
+       .long   0
+       .long   0
+       .long   0
+       .long   0
+       .long   0
+       .long   0       
+.end
diff --git a/src/rt/arch/arm/regs.h b/src/rt/arch/arm/regs.h
new file mode 100644 (file)
index 0000000..a49fcab
--- /dev/null
@@ -0,0 +1,21 @@
+#define RUSTRT_RBX   0
+#define RUSTRT_RSP   1
+#define RUSTRT_RBP   2
+// RCX on Windows, RDI elsewhere
+#define RUSTRT_ARG0  3
+#define RUSTRT_R12   4
+#define RUSTRT_R13   5
+#define RUSTRT_R14   6
+#define RUSTRT_R15   7
+#define RUSTRT_IP    8
+
+#define RUSTRT_MAX  32
+
+// ARG0 is the register in which the first argument goes.
+// Naturally this depends on your operating system.
+#   define RUSTRT_ARG0_S r0
+#   define RUSTRT_ARG1_S r1
+#   define RUSTRT_ARG2_S r2
+#   define RUSTRT_ARG3_S r3
+
+
diff --git a/src/rt/rust_android_dummy.cpp b/src/rt/rust_android_dummy.cpp
new file mode 100644 (file)
index 0000000..76aa517
--- /dev/null
@@ -0,0 +1,61 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "rust_android_dummy.h"
+#include <math.h>
+
+#ifdef __ANDROID__
+
+int backtrace(void **array, int size) { return 0; }
+
+char **backtrace_symbols(void *const *array, int size) { return 0; }
+
+void backtrace_symbols_fd (void *const *array, int size, int fd) {}
+
+
+extern "C" float log2f(float f)
+{
+    return logf( f ) / logf( 2 );
+}
+
+extern "C" double log2( double n )
+{
+    return log( n ) / log( 2 );
+}
+
+extern "C" void telldir()
+{
+}
+
+extern "C" void seekdir()
+{
+}
+
+extern "C" void mkfifo()
+{
+}
+
+extern "C" void abs()
+{
+}
+
+extern "C" void labs()
+{
+}
+
+extern "C" void rand()
+{
+}
+
+extern "C" void srand()
+{
+}
+
+extern "C" void atof()
+{
+}
+extern "C" void tgammaf()
+{
+}
+#endif
diff --git a/src/rt/rust_android_dummy.h b/src/rt/rust_android_dummy.h
new file mode 100644 (file)
index 0000000..2e8b6f2
--- /dev/null
@@ -0,0 +1,5 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "execinfo.h"
index b16006e1f91a163d4c11fe9e822cb5d9f5a84064..0919ccf7f0e53829c2aa1e329ca71f455bdad28e 100644 (file)
 extern char **environ;
 #endif
 
+#ifdef __ANDROID__
+time_t
+timegm(struct tm *tm)
+{
+    time_t ret;
+    char *tz;
+
+    tz = getenv("TZ");
+    setenv("TZ", "", 1);
+    tzset();
+    ret = mktime(tm);
+    if (tz)
+        setenv("TZ", tz, 1);
+    else
+        unsetenv("TZ");
+    tzset();
+    return ret;
+}
+#endif
+
+
 extern "C" CDECL rust_str*
 last_os_error() {
     rust_task *task = rust_get_current_task();
index e56ce6dd2637f6e8505acd3b15b8bc95267b7c37..5ddfd88d4b4a7896796fc67ed6f045719ef1e55d 100644 (file)
@@ -28,6 +28,7 @@ rust_sched_loop::rust_sched_loop(rust_scheduler *sched, int id, bool killed) :
     id(id),
     should_exit(false),
     cached_c_stack(NULL),
+    extra_c_stack(NULL),
     dead_task(NULL),
     killed(killed),
     pump_signal(NULL),
index 27694becdfbcfc9f97c6c63a41270ce06da535a3..20c9a48f1ddeff18b7e5fd742fcaab5351ffa2ed 100644 (file)
 #define RED_ZONE_SIZE RZ_BSD_64
 #endif
 #endif
+#ifdef __ANDROID__
+#define RED_ZONE_SIZE RZ_MAC_32
+#endif
 
 struct rust_box;
 
index b01294062a627dedc52c10d32dad8facf52d57e2..3c38f3c6215d494c1480e9619b19f1a474fd4b32 100644 (file)
@@ -91,6 +91,12 @@ void LLVMInitializeX86TargetMC();
 void LLVMInitializeX86AsmPrinter();
 void LLVMInitializeX86AsmParser();
 
+
+void LLVMInitializeARMTargetInfo();
+void LLVMInitializeARMTarget();
+void LLVMInitializeARMTargetMC();
+void LLVMInitializeARMAsmPrinter();
+void LLVMInitializeARMAsmParser();
 // Only initialize the platforms supported by Rust here,
 // because using --llvm-root will have multiple platforms
 // that rustllvm doesn't actually link to and it's pointless to put target info
@@ -102,6 +108,12 @@ void LLVMRustInitializeTargets() {
   LLVMInitializeX86TargetMC();
   LLVMInitializeX86AsmPrinter();
   LLVMInitializeX86AsmParser();
+       
+  LLVMInitializeARMTargetInfo();
+  LLVMInitializeARMTarget();
+  LLVMInitializeARMTargetMC();
+  LLVMInitializeARMAsmPrinter();
+  LLVMInitializeARMAsmParser();        
 }
 
 // Custom memory manager for MCJITting. It needs special features
index 44636f4f36b16c1c2d7e63cda5db796d8f2142ac..d3cbc490ada453491980364661010a10e2cd7b8f 100644 (file)
@@ -383,19 +383,19 @@ LLVMInitializeInstCombine
 LLVMInitializeScalarOpts
 LLVMInitializeTarget
 LLVMInitializeTransformUtils
+LLVMInitializeARMAsmLexer
 LLVMInitializeX86AsmLexer
-LLVMInitializeX86AsmLexer
-LLVMInitializeX86AsmParser
+LLVMInitializeARMAsmParser
 LLVMInitializeX86AsmParser
+LLVMInitializeARMAsmPrinter
 LLVMInitializeX86AsmPrinter
-LLVMInitializeX86AsmPrinter
-LLVMInitializeX86Disassembler
+LLVMInitializeARMDisassembler
 LLVMInitializeX86Disassembler
+LLVMInitializeARMTarget
 LLVMInitializeX86Target
-LLVMInitializeX86Target
-LLVMInitializeX86TargetMC
+LLVMInitializeARMTargetMC
 LLVMInitializeX86TargetMC
-LLVMInitializeX86TargetInfo
+LLVMInitializeARMTargetInfo
 LLVMInitializeX86TargetInfo
 LLVMInsertBasicBlock
 LLVMInsertBasicBlockInContext