auto merge of #6249 : crabtw/rust/arm, r=brson

It uses the private field of TCB head to store stack limit. I tested on my Raspberry PI. A simple hello world program ran without any problem. However, for a more complex program, it segfaulted as #6231.
This commit is contained in:
bors 2013-05-17 18:19:27 -07:00
commit d68c0279ea
5 changed files with 42 additions and 1 deletions

View File

@ -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++

View File

@ -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

View File

@ -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"
},

View File

@ -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

View File

@ -146,6 +146,9 @@
#ifdef __mips__
#define RED_ZONE_SIZE RZ_MAC_32
#endif
#ifdef __arm__
#define RED_ZONE_SIZE RZ_LINUX_32
#endif
#endif
#ifdef __APPLE__
#ifdef __i386__