Skip to content

Commit

Permalink
preliminary Linux ARM support
Browse files Browse the repository at this point in the history
  • Loading branch information
crabtw committed May 7, 2013
1 parent 063851f commit 48b6262
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
26 changes: 26 additions & 0 deletions mk/platform.mk
Expand Up @@ -239,6 +239,32 @@ CFG_RUN_arm-linux-androideabi=
CFG_RUN_TARG_arm-linux-androideabi=
RUSTC_FLAGS_arm-linux-androideabi :=--android-cross-path=$(CFG_ANDROID_CROSS_PATH)

# arm-unknown-linux-gnueabihf configuration
CC_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-gcc
CXX_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-g++
CPP_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-gcc -E
AR_arm-unknown-linux-gnueabihf=arm-linux-gnueabihf-ar
CFG_LIB_NAME_arm-unknown-linux-gnueabihf=lib$(1).so
CFG_LIB_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_arm-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
CFG_GCCISH_CFLAGS_arm-unknown-linux-gnueabihf := -Wall -g -fPIC
CFG_GCCISH_CXXFLAGS_arm-unknown-linux-gnueabihf := -fno-rtti
CFG_GCCISH_LINK_FLAGS_arm-unknown-linux-gnueabihf := -shared -fPIC -g
CFG_GCCISH_DEF_FLAG_arm-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
CFG_GCCISH_PRE_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-whole-archive
CFG_GCCISH_POST_LIB_FLAGS_arm-unknown-linux-gnueabihf := -Wl,-no-whole-archive
CFG_DEF_SUFFIX_arm-unknown-linux-gnueabihf := .linux.def
CFG_INSTALL_NAME_ar,-unknown-linux-gnueabihf =
CFG_LIBUV_LINK_FLAGS_arm-unknown-linux-gnueabihf =
CFG_EXE_SUFFIX_arm-unknown-linux-gnueabihf :=
CFG_WINDOWSY_arm-unknown-linux-gnueabihf :=
CFG_UNIXY_arm-unknown-linux-gnueabihf := 1
CFG_PATH_MUNGE_arm-unknown-linux-gnueabihf := true
CFG_LDPATH_arm-unknown-linux-gnueabihf :=
CFG_RUN_arm-unknown-linux-gnueabihf=
CFG_RUN_TARG_arm-unknown-linux-gnueabihf=
RUSTC_FLAGS_arm-unknown-linux-gnueabihf := --linker=$(CC_arm-unknown-linux-gnueabihf)

# mips-unknown-linux-gnu configuration
CC_mips-unknown-linux-gnu=mips-linux-gnu-gcc
CXX_mips-unknown-linux-gnu=mips-linux-gnu-g++
Expand Down
4 changes: 4 additions & 0 deletions mk/rt.mk
Expand Up @@ -26,7 +26,11 @@
# Hack for passing flags into LIBUV, see below.
LIBUV_FLAGS_i386 = -m32 -fPIC
LIBUV_FLAGS_x86_64 = -m64 -fPIC
ifeq ($(OSTYPE_$(1)), linux-androideabi)
LIBUV_FLAGS_arm = -fPIC -DANDROID -std=gnu99
else
LIBUV_FLAGS_arm = -fPIC -std=gnu99
endif
LIBUV_FLAGS_mips = -fPIC -mips32r2 -msoft-float -mabi=32

# when we're doing a snapshot build, we intentionally degrade as many
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/back/arm.rs
Expand Up @@ -64,7 +64,7 @@ pub fn get_target_strs(target_os: session::os) -> target_strs::t {
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_linux => ~"arm-unknown-linux-gnueabihf",
session::os_android => ~"arm-linux-androideabi",
session::os_freebsd => ~"arm-unknown-freebsd"
},
Expand Down
8 changes: 8 additions & 0 deletions src/rt/arch/arm/record_sp.S
Expand Up @@ -15,13 +15,21 @@

record_sp_limit:
mrc p15, #0, r3, c13, c0, #3
#if __ANDROID__
add r3, r3, #252
#elif __linux__
add r3, r3, #4
#endif
str r0, [r3]
mov pc, lr

get_sp_limit:
mrc p15, #0, r3, c13, c0, #3
#if __ANDROID__
add r3, r3, #252
#elif __linux__
add r3, r3, #4
#endif
ldr r0, [r3]
mov pc, lr

Expand Down
3 changes: 3 additions & 0 deletions src/rt/rust_task.h
Expand Up @@ -146,6 +146,9 @@
#ifdef __mips__
#define RED_ZONE_SIZE RZ_LINUX_32
#endif
#ifdef __arm__
#define RED_ZONE_SIZE RZ_LINUX_32
#endif
#endif
#ifdef __APPLE__
#ifdef __i386__
Expand Down

5 comments on commit 48b6262

@bors
Copy link
Contributor

@bors bors commented on 48b6262 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from brson
at crabtw@48b6262

@bors
Copy link
Contributor

@bors bors commented on 48b6262 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging crabtw/rust/arm = 48b6262 into auto

@bors
Copy link
Contributor

@bors bors commented on 48b6262 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crabtw/rust/arm = 48b6262 merged ok, testing candidate = d68c027

@bors
Copy link
Contributor

@bors bors commented on 48b6262 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 48b6262 May 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding incoming to auto = d68c027

Please sign in to comment.