Merge pull request #20699 from vhbit/ios-archs
Better iOS support Reviewed-by: alexcrichton
This commit is contained in:
commit
87ed884a9c
25 changed files with 746 additions and 130 deletions
36
mk/cfg/aarch64-apple-ios.mk
Normal file
36
mk/cfg/aarch64-apple-ios.mk
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# aarch64-apple-ios configuration
|
||||||
|
CFG_SDK_NAME_aarch64-apple-ios := iphoneos
|
||||||
|
CFG_SDK_ARCHS_aarch64-apple-ios := arm64
|
||||||
|
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
||||||
|
CFG_IOS_SDK_aarch64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
|
||||||
|
CFG_IOS_SDK_FLAGS_aarch64-apple-ios := -target aarch64-apple-darwin -isysroot $(CFG_IOS_SDK_aarch64-apple-ios) -mios-version-min=7.0 -arch arm64
|
||||||
|
CC_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
|
||||||
|
CXX_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
||||||
|
CPP_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
||||||
|
AR_aarch64-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
|
||||||
|
endif
|
||||||
|
CFG_LIB_NAME_aarch64-apple-ios = lib$(1).a
|
||||||
|
CFG_LIB_GLOB_aarch64-apple-ios = lib$(1)-*.a
|
||||||
|
CFG_LIB_SKIP_INSTALL_aarch64-apple-ios = 1 #lib$(1)-*.a
|
||||||
|
CFG_STATIC_LIB_NAME_aarch64-apple-ios=lib$(1).a
|
||||||
|
CFG_LIB_DSYM_GLOB_aarch64-apple-ios = lib$(1)-*.a.dSYM
|
||||||
|
CFG_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
|
||||||
|
CFG_JEMALLOC_CFLAGS_aarch64-apple-ios := $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
|
||||||
|
CFG_GCCISH_CFLAGS_aarch64-apple-ios := -Wall -Werror -fPIC $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios)
|
||||||
|
CFG_GCCISH_CXXFLAGS_aarch64-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_aarch64-apple-ios) -I$(CFG_IOS_SDK_aarch64-apple-ios)/usr/include/c++/4.2.1
|
||||||
|
CFG_GCCISH_LINK_FLAGS_aarch64-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_aarch64-apple-ios) -Wl,-no_compact_unwind
|
||||||
|
CFG_GCCISH_DEF_FLAG_aarch64-apple-ios := -Wl,-exported_symbols_list,
|
||||||
|
CFG_GCCISH_PRE_LIB_FLAGS_aarch64-apple-ios :=
|
||||||
|
CFG_GCCISH_POST_LIB_FLAGS_aarch64-apple-ios :=
|
||||||
|
CFG_DEF_SUFFIX_aarch64-apple-ios := .darwin.def
|
||||||
|
CFG_LLC_FLAGS_aarch64-apple-ios := -mattr=+neon,+cyclone,+fp-armv8
|
||||||
|
CFG_INSTALL_NAME_aarch64-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||||
|
CFG_LIBUV_LINK_FLAGS_aarch64-apple-ios =
|
||||||
|
CFG_EXE_SUFFIX_aarch64-apple-ios :=
|
||||||
|
CFG_WINDOWSY_aarch64-apple-ios :=
|
||||||
|
CFG_UNIXY_aarch64-apple-ios := 1
|
||||||
|
CFG_PATH_MUNGE_aarch64-apple-ios := true
|
||||||
|
CFG_LDPATH_aarch64-apple-ios :=
|
||||||
|
CFG_RUN_aarch64-apple-ios = $(2)
|
||||||
|
CFG_RUN_TARG_aarch64-apple-ios = $(call CFG_RUN_aarch64-apple-ios,,$(2))
|
||||||
|
CFG_GNU_TRIPLE_aarch64-apple-ios := aarch64-apple-ios
|
|
@ -1,35 +0,0 @@
|
||||||
# arm-apple-ios configuration
|
|
||||||
CFG_SDK_NAME_arm-apple-ios = iphoneos
|
|
||||||
CFG_SDK_ARCHS_arm-apple-ios = armv7
|
|
||||||
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
|
||||||
CFG_IOS_SDK = $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
|
|
||||||
CFG_IOS_FLAGS = -target armv7-apple-ios -isysroot $(CFG_IOS_SDK) -mios-version-min=7.0
|
|
||||||
CC_arm-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
|
|
||||||
CXX_arm-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
|
||||||
CPP_arm-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
|
||||||
AR_arm-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
|
|
||||||
endif
|
|
||||||
CFG_LIB_NAME_arm-apple-ios = lib$(1).a
|
|
||||||
CFG_LIB_GLOB_arm-apple-ios = lib$(1)-*.a
|
|
||||||
CFG_STATIC_LIB_NAME_arm-apple-ios=lib$(1).a
|
|
||||||
CFG_LIB_DSYM_GLOB_arm-apple-ios = lib$(1)-*.a.dSYM
|
|
||||||
CFG_JEMALLOC_CFLAGS_arm-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_FLAGS)
|
|
||||||
CFG_GCCISH_CFLAGS_arm-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_FLAGS) -mfpu=vfp3 -arch armv7
|
|
||||||
CFG_GCCISH_CXXFLAGS_arm-apple-ios := -fno-rtti $(CFG_IOS_FLAGS) -I$(CFG_IOS_SDK)/usr/include/c++/4.2.1
|
|
||||||
CFG_GCCISH_LINK_FLAGS_arm-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK) -Wl,-no_compact_unwind
|
|
||||||
CFG_GCCISH_DEF_FLAG_arm-apple-ios := -Wl,-exported_symbols_list,
|
|
||||||
CFG_GCCISH_PRE_LIB_FLAGS_arm-apple-ios :=
|
|
||||||
CFG_GCCISH_POST_LIB_FLAGS_arm-apple-ios :=
|
|
||||||
CFG_DEF_SUFFIX_arm-apple-ios := .darwin.def
|
|
||||||
CFG_LLC_FLAGS_arm-apple-ios := -mattr=+vfp3,+v7,+thumb2,+neon -march=arm
|
|
||||||
CFG_INSTALL_NAME_arm-apple-ios = -Wl,-install_name,@rpath/$(1)
|
|
||||||
CFG_EXE_SUFFIX_arm-apple-ios :=
|
|
||||||
CFG_WINDOWSY_arm-apple-ios :=
|
|
||||||
CFG_UNIXY_arm-apple-ios := 1
|
|
||||||
CFG_PATH_MUNGE_arm-apple-ios := true
|
|
||||||
CFG_LDPATH_arm-apple-ios :=
|
|
||||||
CFG_RUN_arm-apple-ios = $(2)
|
|
||||||
CFG_RUN_TARG_arm-apple-ios = $(call CFG_RUN_arm-apple-ios,,$(2))
|
|
||||||
RUSTC_FLAGS_arm-apple-ios := -C relocation_model=pic
|
|
||||||
RUSTC_CROSS_FLAGS_arm-apple-ios :=-C relocation_model=pic
|
|
||||||
CFG_GNU_TRIPLE_arm-apple-ios := arm-apple-ios
|
|
34
mk/cfg/armv7-apple-ios.mk
Normal file
34
mk/cfg/armv7-apple-ios.mk
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# armv7-apple-ios configuration
|
||||||
|
CFG_SDK_NAME_armv7-apple-ios := iphoneos
|
||||||
|
CFG_SDK_ARCHS_armv7-apple-ios := armv7
|
||||||
|
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
||||||
|
CFG_IOS_SDK_armv7-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
|
||||||
|
CFG_IOS_SDK_FLAGS_armv7-apple-ios := -target armv7-apple-ios -isysroot $(CFG_IOS_SDK_armv7-apple-ios) -mios-version-min=7.0
|
||||||
|
CC_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
|
||||||
|
CXX_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
||||||
|
CPP_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
||||||
|
AR_armv7-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
|
||||||
|
endif
|
||||||
|
CFG_LIB_NAME_armv7-apple-ios = lib$(1).a
|
||||||
|
CFG_LIB_GLOB_armv7-apple-ios = lib$(1)-*.a
|
||||||
|
CFG_LIB_SKIP_INSTALL_armv7-apple-ios = 1 #lib$(1)-*.a
|
||||||
|
CFG_STATIC_LIB_NAME_armv7-apple-ios=lib$(1).a
|
||||||
|
CFG_LIB_DSYM_GLOB_armv7-apple-ios = lib$(1)-*.a.dSYM
|
||||||
|
CFG_JEMALLOC_CFLAGS_armv7-apple-ios := -arch armv7 -mfpu=vfp3 $(CFG_IOS_SDK_FLAGS_armv7-apple-ios)
|
||||||
|
CFG_GCCISH_CFLAGS_armv7-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -mfpu=vfp3 -arch armv7
|
||||||
|
CFG_GCCISH_CXXFLAGS_armv7-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7-apple-ios) -I$(CFG_IOS_SDK_armv7-apple-ios)/usr/include/c++/4.2.1
|
||||||
|
CFG_GCCISH_LINK_FLAGS_armv7-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7-apple-ios) -Wl,-no_compact_unwind
|
||||||
|
CFG_GCCISH_DEF_FLAG_armv7-apple-ios := -Wl,-exported_symbols_list,
|
||||||
|
CFG_GCCISH_PRE_LIB_FLAGS_armv7-apple-ios :=
|
||||||
|
CFG_GCCISH_POST_LIB_FLAGS_armv7-apple-ios :=
|
||||||
|
CFG_DEF_SUFFIX_armv7-apple-ios := .darwin.def
|
||||||
|
CFG_LLC_FLAGS_armv7-apple-ios := -mattr=+vfp3,+v7,+neon -march=arm
|
||||||
|
CFG_INSTALL_NAME_armv7-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||||
|
CFG_EXE_SUFFIX_armv7-apple-ios :=
|
||||||
|
CFG_WINDOWSY_armv7-apple-ios :=
|
||||||
|
CFG_UNIXY_armv7-apple-ios := 1
|
||||||
|
CFG_PATH_MUNGE_armv7-apple-ios := true
|
||||||
|
CFG_LDPATH_armv7-apple-ios :=
|
||||||
|
CFG_RUN_armv7-apple-ios = $(2)
|
||||||
|
CFG_RUN_TARG_armv7-apple-ios = $(call CFG_RUN_armv7-apple-ios,,$(2))
|
||||||
|
CFG_GNU_TRIPLE_armv7-apple-ios := armv7-apple-ios
|
34
mk/cfg/armv7s-apple-ios.mk
Normal file
34
mk/cfg/armv7s-apple-ios.mk
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# armv7s-apple-ios configuration
|
||||||
|
CFG_SDK_NAME_armv7s-apple-ios := iphoneos
|
||||||
|
CFG_SDK_ARCHS_armv7s-apple-ios := armv7s
|
||||||
|
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
||||||
|
CFG_IOS_SDK_armv7s-apple-ios := $(shell xcrun --show-sdk-path -sdk iphoneos 2>/dev/null)
|
||||||
|
CFG_IOS_SDK_FLAGS_armv7s-apple-ios := -target armv7s-apple-ios -isysroot $(CFG_IOS_SDK_armv7s-apple-ios) -mios-version-min=7.0
|
||||||
|
CC_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang)
|
||||||
|
CXX_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
||||||
|
CPP_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos clang++)
|
||||||
|
AR_armv7s-apple-ios = $(shell xcrun -find -sdk iphoneos ar)
|
||||||
|
endif
|
||||||
|
CFG_LIB_NAME_armv7s-apple-ios = lib$(1).a
|
||||||
|
CFG_LIB_GLOB_armv7s-apple-ios = lib$(1)-*.a
|
||||||
|
CFG_LIB_SKIP_INSTALL_armv7s-apple-ios = 1 #lib$(1)-*.a
|
||||||
|
CFG_STATIC_LIB_NAME_armv7s-apple-ios=lib$(1).a
|
||||||
|
CFG_LIB_DSYM_GLOB_armv7s-apple-ios = lib$(1)-*.a.dSYM
|
||||||
|
CFG_JEMALLOC_CFLAGS_armv7s-apple-ios := -arch armv7s -mfpu=vfp4 $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios)
|
||||||
|
CFG_GCCISH_CFLAGS_armv7s-apple-ios := -Wall -Werror -g -fPIC $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -mfpu=vfp4 -arch armv7s
|
||||||
|
CFG_GCCISH_CXXFLAGS_armv7s-apple-ios := -fno-rtti $(CFG_IOS_SDK_FLAGS_armv7s-apple-ios) -I$(CFG_IOS_SDK_armv7s-apple-ios)/usr/include/c++/4.2.1
|
||||||
|
CFG_GCCISH_LINK_FLAGS_armv7s-apple-ios := -lpthread -syslibroot $(CFG_IOS_SDK_armv7s-apple-ios) -Wl,-no_compact_unwind
|
||||||
|
CFG_GCCISH_DEF_FLAG_armv7s-apple-ios := -Wl,-exported_symbols_list,
|
||||||
|
CFG_GCCISH_PRE_LIB_FLAGS_armv7s-apple-ios :=
|
||||||
|
CFG_GCCISH_POST_LIB_FLAGS_armv7s-apple-ios :=
|
||||||
|
CFG_DEF_SUFFIX_armv7s-apple-ios := .darwin.def
|
||||||
|
CFG_LLC_FLAGS_armv7s-apple-ios := -mattr=+vfp4,+v7,+neon
|
||||||
|
CFG_INSTALL_NAME_armv7s-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||||
|
CFG_EXE_SUFFIX_armv7s-apple-ios :=
|
||||||
|
CFG_WINDOWSY_armv7s-apple-ios :=
|
||||||
|
CFG_UNIXY_armv7s-apple-ios := 1
|
||||||
|
CFG_PATH_MUNGE_armv7s-apple-ios := true
|
||||||
|
CFG_LDPATH_armv7s-apple-ios :=
|
||||||
|
CFG_RUN_armv7s-apple-ios = $(2)
|
||||||
|
CFG_RUN_TARG_armv7s-apple-ios = $(call CFG_RUN_armv7s-apple-ios,,$(2))
|
||||||
|
CFG_GNU_TRIPLE_armv7s-apple-ios := armv7s-apple-ios
|
|
@ -1,9 +1,9 @@
|
||||||
# i386-apple-ios configuration
|
# i386-apple-ios configuration
|
||||||
CFG_SDK_NAME_i386-apple-ios = iphonesimulator
|
CFG_SDK_NAME_i386-apple-ios := iphonesimulator
|
||||||
CFG_SDK_ARCHS_i386-apple-ios = i386
|
CFG_SDK_ARCHS_i386-apple-ios := i386
|
||||||
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
||||||
CFG_IOSSIM_SDK = $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null)
|
CFG_IOSSIM_SDK_i386-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null)
|
||||||
CFG_IOSSIM_FLAGS = -target i386-apple-ios -isysroot $(CFG_IOSSIM_SDK) -mios-simulator-version-min=7.0
|
CFG_IOSSIM_FLAGS_i386-apple-ios := -m32 -target i386-apple-ios -isysroot $(CFG_IOSSIM_SDK_i386-apple-ios) -mios-simulator-version-min=7.0
|
||||||
CC_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang)
|
CC_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang)
|
||||||
CXX_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
|
CXX_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
|
||||||
CPP_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
|
CPP_i386-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
|
||||||
|
@ -13,21 +13,21 @@ CFG_LIB_NAME_i386-apple-ios = lib$(1).a
|
||||||
CFG_LIB_GLOB_i386-apple-ios = lib$(1)-*.dylib
|
CFG_LIB_GLOB_i386-apple-ios = lib$(1)-*.dylib
|
||||||
CFG_STATIC_LIB_NAME_i386-apple-ios=lib$(1).a
|
CFG_STATIC_LIB_NAME_i386-apple-ios=lib$(1).a
|
||||||
CFG_LIB_DSYM_GLOB_i386-apple-ios = lib$(1)-*.dylib.dSYM
|
CFG_LIB_DSYM_GLOB_i386-apple-ios = lib$(1)-*.dylib.dSYM
|
||||||
CFG_GCCISH_CFLAGS_i386-apple-ios = -Wall -Werror -g -fPIC -m32 $(CFG_IOSSIM_FLAGS)
|
CFG_GCCISH_CFLAGS_i386-apple-ios := -Wall -Werror -g -fPIC -m32 $(CFG_IOSSIM_FLAGS_i386-apple-ios)
|
||||||
CFG_GCCISH_CXXFLAGS_i386-apple-ios = -fno-rtti $(CFG_IOSSIM_FLAGS) -I$(CFG_IOSSIM_SDK)/usr/include/c++/4.2.1
|
CFG_GCCISH_CXXFLAGS_i386-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_i386-apple-ios) -I$(CFG_IOSSIM_SDK_i386-apple-ios)/usr/include/c++/4.2.1
|
||||||
CFG_GCCISH_LINK_FLAGS_i386-apple-ios = -lpthread -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK)
|
CFG_GCCISH_LINK_FLAGS_i386-apple-ios := -lpthread -m32 -Wl,-no_compact_unwind -m32 -Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios)
|
||||||
CFG_GCCISH_DEF_FLAG_i386-apple-ios = -Wl,-exported_symbols_list,
|
CFG_GCCISH_DEF_FLAG_i386-apple-ios := -Wl,-exported_symbols_list,
|
||||||
CFG_GCCISH_PRE_LIB_FLAGS_i386-apple-ios =
|
CFG_GCCISH_PRE_LIB_FLAGS_i386-apple-ios :=
|
||||||
CFG_GCCISH_POST_LIB_FLAGS_i386-apple-ios =
|
CFG_GCCISH_POST_LIB_FLAGS_i386-apple-ios :=
|
||||||
CFG_DEF_SUFFIX_i386-apple-ios = .darwin.def
|
CFG_DEF_SUFFIX_i386-apple-ios := .darwin.def
|
||||||
CFG_LLC_FLAGS_i386-apple-ios =
|
CFG_LLC_FLAGS_i386-apple-ios =
|
||||||
CFG_INSTALL_NAME_i386-apple-ios = -Wl,-install_name,@rpath/$(1)
|
CFG_INSTALL_NAME_i386-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||||
CFG_EXE_SUFFIX_i386-apple-ios =
|
CFG_EXE_SUFFIX_i386-apple-ios :=
|
||||||
CFG_WINDOWSY_i386-apple-ios =
|
CFG_WINDOWSY_i386-apple-ios :=
|
||||||
CFG_UNIXY_i386-apple-ios = 1
|
CFG_UNIXY_i386-apple-ios := 1
|
||||||
CFG_PATH_MUNGE_i386-apple-ios = true
|
CFG_PATH_MUNGE_i386-apple-ios = :true
|
||||||
CFG_LDPATH_i386-apple-ios =
|
CFG_LDPATH_i386-apple-ios =
|
||||||
CFG_RUN_i386-apple-ios = $(2)
|
CFG_RUN_i386-apple-ios = $(2)
|
||||||
CFG_RUN_TARG_i386-apple-ios = $(call CFG_RUN_i386-apple-ios,,$(2))
|
CFG_RUN_TARG_i386-apple-ios = $(call CFG_RUN_i386-apple-ios,,$(2))
|
||||||
CFG_JEMALLOC_CFLAGS_i386-apple-ios = $(CFG_IOSSIM_FLAGS) -target i386-apple-ios -Wl,-syslibroot $(CFG_IOSSIM_SDK) -Wl,-no_compact_unwind
|
CFG_JEMALLOC_CFLAGS_i386-apple-ios = $(CFG_IOSSIM_FLAGS_i386-apple-ios) -target i386-apple-ios #-Wl,-syslibroot $(CFG_IOSSIM_SDK_i386-apple-ios) -Wl,-no_compact_unwind
|
||||||
CFG_GNU_TRIPLE_i386-apple-ios := i386-apple-ios
|
CFG_GNU_TRIPLE_i386-apple-ios := i386-apple-ios
|
||||||
|
|
36
mk/cfg/x86_64-apple-ios.mk
Normal file
36
mk/cfg/x86_64-apple-ios.mk
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# x86_64-apple-ios configuration
|
||||||
|
CFG_SDK_NAME_x86_64-apple-ios := iphonesimulator
|
||||||
|
CFG_SDK_ARCHS_x86_64-apple-ios := x86_64
|
||||||
|
ifneq ($(findstring darwin,$(CFG_OSTYPE)),)
|
||||||
|
CFG_IOSSIM_SDK_x86_64-apple-ios := $(shell xcrun --show-sdk-path -sdk iphonesimulator 2>/dev/null)
|
||||||
|
CFG_IOSSIM_FLAGS_x86_64-apple-ios := -m64 -target x86_64-apple-ios -isysroot $(CFG_IOSSIM_SDK_x86_64-apple-ios) -mios-simulator-version-min=7.0
|
||||||
|
CC_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang)
|
||||||
|
CXX_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
|
||||||
|
CPP_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator clang++)
|
||||||
|
AR_x86_64-apple-ios = $(shell xcrun -find -sdk iphonesimulator ar)
|
||||||
|
endif
|
||||||
|
CFG_LIB_NAME_x86_64-apple-ios = lib$(1).a
|
||||||
|
CFG_LIB_GLOB_x86_64-apple-ios = lib$(1)-*.a
|
||||||
|
CFG_LIB_SKIP_INSTALL_x86_64-apple-ios = 1 #lib$(1)-*.a
|
||||||
|
CFG_STATIC_LIB_NAME_x86_64-apple-ios=lib$(1).a
|
||||||
|
CFG_LIB_DSYM_GLOB_x86_64-apple-ios = lib$(1)-*.a.dSYM
|
||||||
|
CFG_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
|
||||||
|
CFG_JEMALLOC_CFLAGS_x86_64-apple-ios := $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
|
||||||
|
CFG_GCCISH_CFLAGS_x86_64-apple-ios := -Wall -Werror -fPIC $(CFG_IOSSIM_FLAGS_x86_64-apple-ios)
|
||||||
|
CFG_GCCISH_CXXFLAGS_x86_64-apple-ios := -fno-rtti $(CFG_IOSSIM_FLAGS_x86_64-apple-ios) -I$(CFG_IOSSIM_SDK_x86_64-apple-ios)/usr/include/c++/4.2.1
|
||||||
|
CFG_GCCISH_LINK_FLAGS_x86_64-apple-ios := -lpthread -Wl,-no_compact_unwind -m64 -Wl,-syslibroot $(CFG_IOSSIM_SDK_x86_64-apple-ios)
|
||||||
|
CFG_GCCISH_DEF_FLAG_x86_64-apple-ios := -Wl,-exported_symbols_list,
|
||||||
|
CFG_GCCISH_PRE_LIB_FLAGS_x86_64-apple-ios :=
|
||||||
|
CFG_GCCISH_POST_LIB_FLAGS_x86_64-apple-ios :=
|
||||||
|
CFG_DEF_SUFFIX_x86_64-apple-ios := .darwin.def
|
||||||
|
CFG_LLC_FLAGS_x86_64-apple-ios :=
|
||||||
|
CFG_INSTALL_NAME_x86_64-apple-ios = -Wl,-install_name,@rpath/$(1)
|
||||||
|
CFG_LIBUV_LINK_FLAGS_x86_64-apple-ios :=
|
||||||
|
CFG_EXE_SUFFIX_x86_64-apple-ios :=
|
||||||
|
CFG_WINDOWSY_x86_64-apple-ios :=
|
||||||
|
CFG_UNIXY_x86_64-apple-ios := 1
|
||||||
|
CFG_PATH_MUNGE_x86_64-apple-ios := true
|
||||||
|
CFG_LDPATH_x86_64-apple-ios :=
|
||||||
|
CFG_RUN_x86_64-apple-ios = $(2)
|
||||||
|
CFG_RUN_TARG_x86_64-apple-ios = $(call CFG_RUN_x86_64-apple-ios,,$(2))
|
||||||
|
CFG_GNU_TRIPLE_i386-apple-ios := x86_64-apple-ios
|
|
@ -1 +1 @@
|
||||||
Subproject commit 62a4ca6055ad6fda8faf767b93b5736dcdfb7013
|
Subproject commit 58ab642c30d9f97735d5745b5d01781ee199c6ae
|
|
@ -1969,7 +1969,7 @@ pub mod types {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
|
||||||
pub mod arch {
|
pub mod arch {
|
||||||
pub mod c95 {
|
pub mod c95 {
|
||||||
pub type c_char = i8;
|
pub type c_char = i8;
|
||||||
|
|
31
src/librustc_back/target/aarch64_apple_ios.rs
Normal file
31
src/librustc_back/target/aarch64_apple_ios.rs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// Copyright 2014 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 target::{Target, TargetOptions};
|
||||||
|
use super::apple_ios_base::{opts, Arch};
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
Target {
|
||||||
|
// reference layout: e-m:o-i64:64-i128:128-n32:64-S128
|
||||||
|
data_layout: "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\
|
||||||
|
i128:128-f32:32:32-f64:64:64-v64:64:64-v128:128:128-\
|
||||||
|
a:0:64-n32:64-S128".to_string(),
|
||||||
|
llvm_target: "arm64-apple-ios".to_string(),
|
||||||
|
target_endian: "little".to_string(),
|
||||||
|
target_pointer_width: "64".to_string(),
|
||||||
|
arch: "aarch64".to_string(),
|
||||||
|
target_os: "ios".to_string(),
|
||||||
|
options: TargetOptions {
|
||||||
|
features: "+neon,+fp-armv8,+cyclone".to_string(),
|
||||||
|
eliminate_frame_pointer: false,
|
||||||
|
.. opts(Arch::Arm64)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
88
src/librustc_back/target/apple_ios_base.rs
Normal file
88
src/librustc_back/target/apple_ios_base.rs
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
// Copyright 2014 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 std::io::{Command, IoError, OtherIoError};
|
||||||
|
use target::TargetOptions;
|
||||||
|
|
||||||
|
use self::Arch::*;
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
pub enum Arch {
|
||||||
|
Armv7,
|
||||||
|
Armv7s,
|
||||||
|
Arm64,
|
||||||
|
I386,
|
||||||
|
X86_64
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Arch {
|
||||||
|
pub fn to_string(&self) -> &'static str {
|
||||||
|
match self {
|
||||||
|
&Armv7 => "armv7",
|
||||||
|
&Armv7s => "armv7s",
|
||||||
|
&Arm64 => "arm64",
|
||||||
|
&I386 => "i386",
|
||||||
|
&X86_64 => "x86_64"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_sdk_root(sdk_name: &str) -> String {
|
||||||
|
let res = Command::new("xcrun")
|
||||||
|
.arg("--show-sdk-path")
|
||||||
|
.arg("-sdk")
|
||||||
|
.arg(sdk_name)
|
||||||
|
.spawn()
|
||||||
|
.and_then(|c| c.wait_with_output())
|
||||||
|
.and_then(|output| {
|
||||||
|
if output.status.success() {
|
||||||
|
Ok(String::from_utf8(output.output).unwrap())
|
||||||
|
} else {
|
||||||
|
Err(IoError {
|
||||||
|
kind: OtherIoError,
|
||||||
|
desc: "process exit with error",
|
||||||
|
detail: String::from_utf8(output.error).ok()})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
match res {
|
||||||
|
Ok(output) => output.trim().to_string(),
|
||||||
|
Err(e) => panic!("failed to get {} SDK path: {}", sdk_name, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pre_link_args(arch: Arch) -> Vec<String> {
|
||||||
|
let sdk_name = match arch {
|
||||||
|
Armv7 | Armv7s | Arm64 => "iphoneos",
|
||||||
|
I386 | X86_64 => "iphonesimulator"
|
||||||
|
};
|
||||||
|
|
||||||
|
let arch_name = arch.to_string();
|
||||||
|
|
||||||
|
vec!["-arch".to_string(), arch_name.to_string(),
|
||||||
|
"-Wl,-syslibroot".to_string(), get_sdk_root(sdk_name)]
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn opts(arch: Arch) -> TargetOptions {
|
||||||
|
TargetOptions {
|
||||||
|
dynamic_linking: false,
|
||||||
|
executables: true,
|
||||||
|
// Although there is an experimental implementation of LLVM which
|
||||||
|
// supports SS on armv7 it wasn't approved by Apple, see:
|
||||||
|
// http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140505/216350.html
|
||||||
|
// It looks like it might be never accepted to upstream LLVM.
|
||||||
|
//
|
||||||
|
// SS might be also enabled on Arm64 as it has builtin support in LLVM
|
||||||
|
// but I haven't tested it through yet
|
||||||
|
morestack: false,
|
||||||
|
pre_link_args: pre_link_args(arch),
|
||||||
|
.. super::apple_base::opts()
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,37 +0,0 @@
|
||||||
// Copyright 2014 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 target::{Target, TargetOptions};
|
|
||||||
|
|
||||||
pub fn target() -> Target {
|
|
||||||
Target {
|
|
||||||
data_layout: "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\
|
|
||||||
-a:0:64-n32".to_string(),
|
|
||||||
llvm_target: "arm-apple-ios".to_string(),
|
|
||||||
target_endian: "little".to_string(),
|
|
||||||
target_pointer_width: "32".to_string(),
|
|
||||||
arch: "arm".to_string(),
|
|
||||||
target_os: "ios".to_string(),
|
|
||||||
options: TargetOptions {
|
|
||||||
features: "+v7,+thumb2,+vfp3,+neon".to_string(),
|
|
||||||
executables: false,
|
|
||||||
dynamic_linking: false,
|
|
||||||
// Although there is an experimental implementation of LLVM which
|
|
||||||
// supports SS on armv7 it wasn't approved by Apple, see:
|
|
||||||
// http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140505/216350.html
|
|
||||||
// It looks like it might be never accepted to upstream LLVM.
|
|
||||||
morestack: false,
|
|
||||||
.. super::apple_base::opts()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
27
src/librustc_back/target/armv7_apple_ios.rs
Normal file
27
src/librustc_back/target/armv7_apple_ios.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright 2014 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 target::{Target, TargetOptions};
|
||||||
|
use super::apple_ios_base::{opts, Arch};
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
Target {
|
||||||
|
data_layout: "e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
|
||||||
|
llvm_target: "armv7-apple-ios".to_string(),
|
||||||
|
target_endian: "little".to_string(),
|
||||||
|
target_pointer_width: "32".to_string(),
|
||||||
|
arch: "arm".to_string(),
|
||||||
|
target_os: "ios".to_string(),
|
||||||
|
options: TargetOptions {
|
||||||
|
features: "+v7,+vfp3,+neon".to_string(),
|
||||||
|
.. opts(Arch::Armv7)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
src/librustc_back/target/armv7s_apple_ios.rs
Normal file
27
src/librustc_back/target/armv7s_apple_ios.rs
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// Copyright 2014 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 target::{Target, TargetOptions};
|
||||||
|
use super::apple_ios_base::{opts, Arch};
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
Target {
|
||||||
|
data_layout: "e-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
|
||||||
|
llvm_target: "armv7s-apple-ios".to_string(),
|
||||||
|
target_endian: "little".to_string(),
|
||||||
|
target_pointer_width: "32".to_string(),
|
||||||
|
arch: "arm".to_string(),
|
||||||
|
target_os: "ios".to_string(),
|
||||||
|
options: TargetOptions {
|
||||||
|
features: "+v7,+vfp4,+neon".to_string(),
|
||||||
|
.. opts(Arch::Armv7s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use target::Target;
|
use target::Target;
|
||||||
|
use super::apple_ios_base::{opts, Arch};
|
||||||
|
|
||||||
pub fn target() -> Target {
|
pub fn target() -> Target {
|
||||||
Target {
|
Target {
|
||||||
|
@ -22,7 +23,6 @@ pub fn target() -> Target {
|
||||||
target_pointer_width: "32".to_string(),
|
target_pointer_width: "32".to_string(),
|
||||||
arch: "x86".to_string(),
|
arch: "x86".to_string(),
|
||||||
target_os: "ios".to_string(),
|
target_os: "ios".to_string(),
|
||||||
|
options: opts(Arch::I386)
|
||||||
options: super::apple_base::opts()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,22 +53,27 @@ use std::io::fs::PathExtensions;
|
||||||
mod windows_base;
|
mod windows_base;
|
||||||
mod linux_base;
|
mod linux_base;
|
||||||
mod apple_base;
|
mod apple_base;
|
||||||
|
mod apple_ios_base;
|
||||||
mod freebsd_base;
|
mod freebsd_base;
|
||||||
mod dragonfly_base;
|
mod dragonfly_base;
|
||||||
|
|
||||||
mod arm_apple_ios;
|
mod armv7_apple_ios;
|
||||||
|
mod armv7s_apple_ios;
|
||||||
|
mod i386_apple_ios;
|
||||||
|
|
||||||
mod arm_linux_androideabi;
|
mod arm_linux_androideabi;
|
||||||
mod arm_unknown_linux_gnueabi;
|
mod arm_unknown_linux_gnueabi;
|
||||||
mod arm_unknown_linux_gnueabihf;
|
mod arm_unknown_linux_gnueabihf;
|
||||||
|
mod aarch64_apple_ios;
|
||||||
mod aarch64_unknown_linux_gnu;
|
mod aarch64_unknown_linux_gnu;
|
||||||
mod i686_apple_darwin;
|
mod i686_apple_darwin;
|
||||||
mod i386_apple_ios;
|
|
||||||
mod i686_pc_windows_gnu;
|
mod i686_pc_windows_gnu;
|
||||||
mod i686_unknown_dragonfly;
|
mod i686_unknown_dragonfly;
|
||||||
mod i686_unknown_linux_gnu;
|
mod i686_unknown_linux_gnu;
|
||||||
mod mips_unknown_linux_gnu;
|
mod mips_unknown_linux_gnu;
|
||||||
mod mipsel_unknown_linux_gnu;
|
mod mipsel_unknown_linux_gnu;
|
||||||
mod x86_64_apple_darwin;
|
mod x86_64_apple_darwin;
|
||||||
|
mod x86_64_apple_ios;
|
||||||
mod x86_64_pc_windows_gnu;
|
mod x86_64_pc_windows_gnu;
|
||||||
mod x86_64_unknown_freebsd;
|
mod x86_64_unknown_freebsd;
|
||||||
mod x86_64_unknown_dragonfly;
|
mod x86_64_unknown_dragonfly;
|
||||||
|
@ -346,8 +351,12 @@ impl Target {
|
||||||
|
|
||||||
x86_64_apple_darwin,
|
x86_64_apple_darwin,
|
||||||
i686_apple_darwin,
|
i686_apple_darwin,
|
||||||
|
|
||||||
i386_apple_ios,
|
i386_apple_ios,
|
||||||
arm_apple_ios,
|
x86_64_apple_ios,
|
||||||
|
aarch64_apple_ios,
|
||||||
|
armv7_apple_ios,
|
||||||
|
armv7s_apple_ios,
|
||||||
|
|
||||||
x86_64_pc_windows_gnu,
|
x86_64_pc_windows_gnu,
|
||||||
i686_pc_windows_gnu
|
i686_pc_windows_gnu
|
||||||
|
|
26
src/librustc_back/target/x86_64_apple_ios.rs
Normal file
26
src/librustc_back/target/x86_64_apple_ios.rs
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2014 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 target::Target;
|
||||||
|
use super::apple_ios_base::{opts, Arch};
|
||||||
|
|
||||||
|
pub fn target() -> Target {
|
||||||
|
Target {
|
||||||
|
data_layout: "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".to_string(),
|
||||||
|
llvm_target: "x86_64-apple-ios".to_string(),
|
||||||
|
target_endian: "little".to_string(),
|
||||||
|
target_pointer_width: "64".to_string(),
|
||||||
|
arch: "x86_64".to_string(),
|
||||||
|
target_os: "ios".to_string(),
|
||||||
|
options: opts(Arch::X86_64)
|
||||||
|
}
|
||||||
|
}
|
|
@ -115,8 +115,15 @@ pub fn compute_abi_info(ccx: &CrateContext,
|
||||||
} else {
|
} else {
|
||||||
cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def)
|
cabi_x86_64::compute_abi_info(ccx, atys, rty, ret_def)
|
||||||
},
|
},
|
||||||
"arm" => cabi_arm::compute_abi_info(ccx, atys, rty, ret_def),
|
|
||||||
"aarch64" => cabi_aarch64::compute_abi_info(ccx, atys, rty, ret_def),
|
"aarch64" => cabi_aarch64::compute_abi_info(ccx, atys, rty, ret_def),
|
||||||
|
"arm" => {
|
||||||
|
let flavor = if ccx.sess().target.target.target_os == "ios" {
|
||||||
|
cabi_arm::Flavor::Ios
|
||||||
|
} else {
|
||||||
|
cabi_arm::Flavor::General
|
||||||
|
};
|
||||||
|
cabi_arm::compute_abi_info(ccx, atys, rty, ret_def, flavor)
|
||||||
|
},
|
||||||
"mips" => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
|
"mips" => cabi_mips::compute_abi_info(ccx, atys, rty, ret_def),
|
||||||
a => ccx.sess().fatal(&format!("unrecognized arch \"{}\" in target specification", a)
|
a => ccx.sess().fatal(&format!("unrecognized arch \"{}\" in target specification", a)
|
||||||
[]),
|
[]),
|
||||||
|
|
|
@ -19,16 +19,23 @@ use trans::type_::Type;
|
||||||
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
|
pub enum Flavor {
|
||||||
|
General,
|
||||||
|
Ios
|
||||||
|
}
|
||||||
|
|
||||||
|
type TyAlignFn = fn(ty: Type) -> uint;
|
||||||
|
|
||||||
fn align_up_to(off: uint, a: uint) -> uint {
|
fn align_up_to(off: uint, a: uint) -> uint {
|
||||||
return (off + a - 1u) / a * a;
|
return (off + a - 1u) / a * a;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn align(off: uint, ty: Type) -> uint {
|
fn align(off: uint, ty: Type, align_fn: TyAlignFn) -> uint {
|
||||||
let a = ty_align(ty);
|
let a = align_fn(ty);
|
||||||
return align_up_to(off, a);
|
return align_up_to(off, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ty_align(ty: Type) -> uint {
|
fn general_ty_align(ty: Type) -> uint {
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
Integer => {
|
Integer => {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -43,18 +50,51 @@ fn ty_align(ty: Type) -> uint {
|
||||||
1
|
1
|
||||||
} else {
|
} else {
|
||||||
let str_tys = ty.field_types();
|
let str_tys = ty.field_types();
|
||||||
str_tys.iter().fold(1, |a, t| cmp::max(a, ty_align(*t)))
|
str_tys.iter().fold(1, |a, t| cmp::max(a, general_ty_align(*t)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Array => {
|
Array => {
|
||||||
let elt = ty.element_type();
|
let elt = ty.element_type();
|
||||||
ty_align(elt)
|
general_ty_align(elt)
|
||||||
}
|
}
|
||||||
_ => panic!("ty_align: unhandled type")
|
_ => panic!("ty_align: unhandled type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ty_size(ty: Type) -> uint {
|
// For more information see:
|
||||||
|
// ARMv7
|
||||||
|
// https://developer.apple.com/library/ios/documentation/Xcode/Conceptual
|
||||||
|
// /iPhoneOSABIReference/Articles/ARMv7FunctionCallingConventions.html
|
||||||
|
// ARMv6
|
||||||
|
// https://developer.apple.com/library/ios/documentation/Xcode/Conceptual
|
||||||
|
// /iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html
|
||||||
|
fn ios_ty_align(ty: Type) -> uint {
|
||||||
|
match ty.kind() {
|
||||||
|
Integer => {
|
||||||
|
unsafe {
|
||||||
|
cmp::min(4, ((llvm::LLVMGetIntTypeWidth(ty.to_ref()) as uint) + 7) / 8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Pointer => 4,
|
||||||
|
Float => 4,
|
||||||
|
Double => 4,
|
||||||
|
Struct => {
|
||||||
|
if ty.is_packed() {
|
||||||
|
1
|
||||||
|
} else {
|
||||||
|
let str_tys = ty.field_types();
|
||||||
|
str_tys.iter().fold(1, |a, t| cmp::max(a, ios_ty_align(*t)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Array => {
|
||||||
|
let elt = ty.element_type();
|
||||||
|
ios_ty_align(elt)
|
||||||
|
}
|
||||||
|
_ => panic!("ty_align: unhandled type")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ty_size(ty: Type, align_fn: TyAlignFn) -> uint {
|
||||||
match ty.kind() {
|
match ty.kind() {
|
||||||
Integer => {
|
Integer => {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -67,29 +107,32 @@ fn ty_size(ty: Type) -> uint {
|
||||||
Struct => {
|
Struct => {
|
||||||
if ty.is_packed() {
|
if ty.is_packed() {
|
||||||
let str_tys = ty.field_types();
|
let str_tys = ty.field_types();
|
||||||
str_tys.iter().fold(0, |s, t| s + ty_size(*t))
|
str_tys.iter().fold(0, |s, t| s + ty_size(*t, align_fn))
|
||||||
} else {
|
} else {
|
||||||
let str_tys = ty.field_types();
|
let str_tys = ty.field_types();
|
||||||
let size = str_tys.iter().fold(0, |s, t| align(s, *t) + ty_size(*t));
|
let size = str_tys.iter()
|
||||||
align(size, ty)
|
.fold(0, |s, t| {
|
||||||
|
align(s, *t, align_fn) + ty_size(*t, align_fn)
|
||||||
|
});
|
||||||
|
align(size, ty, align_fn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Array => {
|
Array => {
|
||||||
let len = ty.array_length();
|
let len = ty.array_length();
|
||||||
let elt = ty.element_type();
|
let elt = ty.element_type();
|
||||||
let eltsz = ty_size(elt);
|
let eltsz = ty_size(elt, align_fn);
|
||||||
len * eltsz
|
len * eltsz
|
||||||
}
|
}
|
||||||
_ => panic!("ty_size: unhandled type")
|
_ => panic!("ty_size: unhandled type")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
fn classify_ret_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType {
|
||||||
if is_reg_ty(ty) {
|
if is_reg_ty(ty) {
|
||||||
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
|
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
|
||||||
return ArgType::direct(ty, None, None, attr);
|
return ArgType::direct(ty, None, None, attr);
|
||||||
}
|
}
|
||||||
let size = ty_size(ty);
|
let size = ty_size(ty, align_fn);
|
||||||
if size <= 4 {
|
if size <= 4 {
|
||||||
let llty = if size <= 1 {
|
let llty = if size <= 1 {
|
||||||
Type::i8(ccx)
|
Type::i8(ccx)
|
||||||
|
@ -103,13 +146,13 @@ fn classify_ret_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
||||||
ArgType::indirect(ty, Some(StructRetAttribute))
|
ArgType::indirect(ty, Some(StructRetAttribute))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn classify_arg_ty(ccx: &CrateContext, ty: Type) -> ArgType {
|
fn classify_arg_ty(ccx: &CrateContext, ty: Type, align_fn: TyAlignFn) -> ArgType {
|
||||||
if is_reg_ty(ty) {
|
if is_reg_ty(ty) {
|
||||||
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
|
let attr = if ty == Type::i1(ccx) { Some(ZExtAttribute) } else { None };
|
||||||
return ArgType::direct(ty, None, None, attr);
|
return ArgType::direct(ty, None, None, attr);
|
||||||
}
|
}
|
||||||
let align = ty_align(ty);
|
let align = align_fn(ty);
|
||||||
let size = ty_size(ty);
|
let size = ty_size(ty, align_fn);
|
||||||
let llty = if align <= 4 {
|
let llty = if align <= 4 {
|
||||||
Type::array(&Type::i32(ccx), ((size + 3) / 4) as u64)
|
Type::array(&Type::i32(ccx), ((size + 3) / 4) as u64)
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,15 +174,21 @@ fn is_reg_ty(ty: Type) -> bool {
|
||||||
pub fn compute_abi_info(ccx: &CrateContext,
|
pub fn compute_abi_info(ccx: &CrateContext,
|
||||||
atys: &[Type],
|
atys: &[Type],
|
||||||
rty: Type,
|
rty: Type,
|
||||||
ret_def: bool) -> FnType {
|
ret_def: bool,
|
||||||
|
flavor: Flavor) -> FnType {
|
||||||
|
let align_fn = match flavor {
|
||||||
|
Flavor::General => general_ty_align as TyAlignFn,
|
||||||
|
Flavor::Ios => ios_ty_align as TyAlignFn,
|
||||||
|
};
|
||||||
|
|
||||||
let mut arg_tys = Vec::new();
|
let mut arg_tys = Vec::new();
|
||||||
for &aty in atys.iter() {
|
for &aty in atys.iter() {
|
||||||
let ty = classify_arg_ty(ccx, aty);
|
let ty = classify_arg_ty(ccx, aty, align_fn);
|
||||||
arg_tys.push(ty);
|
arg_tys.push(ty);
|
||||||
}
|
}
|
||||||
|
|
||||||
let ret_ty = if ret_def {
|
let ret_ty = if ret_def {
|
||||||
classify_ret_ty(ccx, rty)
|
classify_ret_ty(ccx, rty, align_fn)
|
||||||
} else {
|
} else {
|
||||||
ArgType::direct(Type::void(ccx), None, None, None)
|
ArgType::direct(Type::void(ccx), None, None, None)
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,16 +23,23 @@ pub fn next_test_port() -> u16 {
|
||||||
base_port() + NEXT_OFFSET.fetch_add(1, Ordering::Relaxed) as u16
|
base_port() + NEXT_OFFSET.fetch_add(1, Ordering::Relaxed) as u16
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a temporary path which could be the location of a unix socket
|
// iOS has a pretty long tmpdir path which causes pipe creation
|
||||||
pub fn next_test_unix() -> Path {
|
// to like: invalid argument: path must be smaller than SUN_LEN
|
||||||
|
fn next_test_unix_socket() -> String {
|
||||||
static COUNT: AtomicUint = ATOMIC_UINT_INIT;
|
static COUNT: AtomicUint = ATOMIC_UINT_INIT;
|
||||||
// base port and pid are an attempt to be unique between multiple
|
// base port and pid are an attempt to be unique between multiple
|
||||||
// test-runners of different configurations running on one
|
// test-runners of different configurations running on one
|
||||||
// buildbot, the count is to be unique within this executable.
|
// buildbot, the count is to be unique within this executable.
|
||||||
let string = format!("rust-test-unix-path-{}-{}-{}",
|
format!("rust-test-unix-path-{}-{}-{}",
|
||||||
base_port(),
|
base_port(),
|
||||||
unsafe {libc::getpid()},
|
unsafe {libc::getpid()},
|
||||||
COUNT.fetch_add(1, Ordering::Relaxed));
|
COUNT.fetch_add(1, Ordering::Relaxed))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Get a temporary path which could be the location of a unix socket
|
||||||
|
#[cfg(not(target_os = "ios"))]
|
||||||
|
pub fn next_test_unix() -> Path {
|
||||||
|
let string = next_test_unix_socket();
|
||||||
if cfg!(unix) {
|
if cfg!(unix) {
|
||||||
os::tmpdir().join(string)
|
os::tmpdir().join(string)
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,6 +47,12 @@ pub fn next_test_unix() -> Path {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get a temporary path which could be the location of a unix socket
|
||||||
|
#[cfg(target_os = "ios")]
|
||||||
|
pub fn next_test_unix() -> Path {
|
||||||
|
Path::new(format!("/var/tmp/{}", next_test_unix_socket()))
|
||||||
|
}
|
||||||
|
|
||||||
/// Get a unique IPv4 localhost:port pair starting at 9600
|
/// Get a unique IPv4 localhost:port pair starting at 9600
|
||||||
pub fn next_test_ip4() -> SocketAddr {
|
pub fn next_test_ip4() -> SocketAddr {
|
||||||
SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: next_test_port() }
|
SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: next_test_port() }
|
||||||
|
@ -99,7 +112,7 @@ pub fn raise_fd_limit() {
|
||||||
/// multithreaded scheduler testing, depending on the number of cores available.
|
/// multithreaded scheduler testing, depending on the number of cores available.
|
||||||
///
|
///
|
||||||
/// This fixes issue #7772.
|
/// This fixes issue #7772.
|
||||||
#[cfg(target_os="macos")]
|
#[cfg(any(target_os = "macos", target_os = "ios"))]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
mod darwin_fd_limit {
|
mod darwin_fd_limit {
|
||||||
use libc;
|
use libc;
|
||||||
|
@ -156,7 +169,7 @@ mod darwin_fd_limit {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os="macos"))]
|
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
||||||
mod darwin_fd_limit {
|
mod darwin_fd_limit {
|
||||||
pub unsafe fn raise_fd_limit() {}
|
pub unsafe fn raise_fd_limit() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,19 +61,22 @@ mod os {
|
||||||
mod os {
|
mod os {
|
||||||
use libc;
|
use libc;
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(any(target_arch = "x86_64",
|
||||||
|
target_arch = "aarch64"))]
|
||||||
const __PTHREAD_MUTEX_SIZE__: uint = 56;
|
const __PTHREAD_MUTEX_SIZE__: uint = 56;
|
||||||
#[cfg(any(target_arch = "x86",
|
#[cfg(any(target_arch = "x86",
|
||||||
target_arch = "arm"))]
|
target_arch = "arm"))]
|
||||||
const __PTHREAD_MUTEX_SIZE__: uint = 40;
|
const __PTHREAD_MUTEX_SIZE__: uint = 40;
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(any(target_arch = "x86_64",
|
||||||
|
target_arch = "aarch64"))]
|
||||||
const __PTHREAD_COND_SIZE__: uint = 40;
|
const __PTHREAD_COND_SIZE__: uint = 40;
|
||||||
#[cfg(any(target_arch = "x86",
|
#[cfg(any(target_arch = "x86",
|
||||||
target_arch = "arm"))]
|
target_arch = "arm"))]
|
||||||
const __PTHREAD_COND_SIZE__: uint = 24;
|
const __PTHREAD_COND_SIZE__: uint = 24;
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(any(target_arch = "x86_64",
|
||||||
|
target_arch = "aarch64"))]
|
||||||
const __PTHREAD_RWLOCK_SIZE__: uint = 192;
|
const __PTHREAD_RWLOCK_SIZE__: uint = 192;
|
||||||
#[cfg(any(target_arch = "x86",
|
#[cfg(any(target_arch = "x86",
|
||||||
target_arch = "arm"))]
|
target_arch = "arm"))]
|
||||||
|
|
|
@ -7,13 +7,29 @@
|
||||||
|
|
||||||
/* See i386/morestack.S for the lengthy, general explanation. */
|
/* See i386/morestack.S for the lengthy, general explanation. */
|
||||||
|
|
||||||
.global rust_stack_exhausted
|
#if defined(__APPLE__)
|
||||||
|
#define MORESTACK ___morestack
|
||||||
|
#define STACK_EXHAUSTED _rust_stack_exhausted
|
||||||
|
#else
|
||||||
|
#define MORESTACK __morestack
|
||||||
|
#define STACK_EXHAUSTED rust_stack_exhausted
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.global STACK_EXHAUSTED
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
.private_extern MORESTACK
|
||||||
|
#else
|
||||||
|
.hidden MORESTACK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
.type MORESTACK,%function
|
||||||
|
#endif
|
||||||
|
|
||||||
// FIXME(AARCH64): this might not be perfectly right but works for now
|
// FIXME(AARCH64): this might not be perfectly right but works for now
|
||||||
func __morestack
|
MORESTACK:
|
||||||
.cfi_startproc
|
.cfi_startproc
|
||||||
bl rust_stack_exhausted
|
bl STACK_EXHAUSTED@plt
|
||||||
// the above function ensures that it never returns
|
// the above function ensures that it never returns
|
||||||
.cfi_endproc
|
.cfi_endproc
|
||||||
endfunc __morestack
|
|
||||||
.hidden __morestack
|
|
||||||
|
|
70
src/rt/arch/armv7/morestack.S
Normal file
70
src/rt/arch/armv7/morestack.S
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
// Mark stack as non-executable
|
||||||
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
.section .note.GNU-stack, "", %progbits
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* See i386/morestack.S for the lengthy, general explanation. */
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code 32
|
||||||
|
.arm
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
.align 2
|
||||||
|
#else
|
||||||
|
.align
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#define MORESTACK ___morestack
|
||||||
|
#define STACK_EXHAUSTED _rust_stack_exhausted
|
||||||
|
#else
|
||||||
|
#define MORESTACK __morestack
|
||||||
|
#define STACK_EXHAUSTED rust_stack_exhausted
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.global STACK_EXHAUSTED
|
||||||
|
.global MORESTACK
|
||||||
|
|
||||||
|
// Unfortunately LLVM yet doesn't support emitting correct debug
|
||||||
|
// DWARF information for non-ELF targets so to make it compile
|
||||||
|
// on iOS all that directives are simply commented out
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#define UNWIND @
|
||||||
|
#else
|
||||||
|
#define UNWIND
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
.private_extern MORESTACK
|
||||||
|
#else
|
||||||
|
.hidden MORESTACK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
.type MORESTACK,%function
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// r4 and r5 are scratch registers for __morestack due to llvm
|
||||||
|
// ARMFrameLowering::adjustForSegmentedStacks() implementation.
|
||||||
|
MORESTACK:
|
||||||
|
UNWIND .fnstart
|
||||||
|
|
||||||
|
// Save frame pointer and return address
|
||||||
|
UNWIND .save {r4, r5}
|
||||||
|
UNWIND .save {lr}
|
||||||
|
UNWIND .save {r6, fp, lr}
|
||||||
|
push {r6, fp, lr}
|
||||||
|
|
||||||
|
UNWIND .movsp r6
|
||||||
|
mov r6, sp
|
||||||
|
UNWIND .setfp fp, sp, #4
|
||||||
|
add fp, sp, #4
|
||||||
|
|
||||||
|
// Save argument registers of the original function
|
||||||
|
push {r0, r1, r2, r3, lr}
|
||||||
|
|
||||||
|
// Create new stack
|
||||||
|
bl STACK_EXHAUSTED@plt
|
||||||
|
|
||||||
|
// the above function ensures that it never returns
|
||||||
|
UNWIND .fnend
|
56
src/rt/arch/armv7/record_sp.S
Normal file
56
src/rt/arch/armv7/record_sp.S
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
// Do not compile anything here for iOS because split stacks
|
||||||
|
// are disabled at all and do not need any runtime support.
|
||||||
|
//
|
||||||
|
// See also comments in librustrt/stack.rs about why it was
|
||||||
|
// disabled and how it could be implemented in case of need.
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
// Mark stack as non-executable
|
||||||
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
.section .note.GNU-stack, "", %progbits
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code 32
|
||||||
|
.arm
|
||||||
|
.align
|
||||||
|
|
||||||
|
#define RECORD_SP_LIMIT record_sp_limit
|
||||||
|
#define GET_SP_LIMIT get_sp_limit
|
||||||
|
|
||||||
|
.globl RECORD_SP_LIMIT
|
||||||
|
.globl GET_SP_LIMIT
|
||||||
|
|
||||||
|
RECORD_SP_LIMIT:
|
||||||
|
// First, try to read TLS address from coprocessor
|
||||||
|
mrc p15, #0, r3, c13, c0, #3
|
||||||
|
cmp r3, #0
|
||||||
|
// Otherwise, try to read from magic address 0xFFFF0FF0
|
||||||
|
mvneq r3, #0xF000
|
||||||
|
ldreq r3, [r3, #-15]
|
||||||
|
|
||||||
|
#if __ANDROID__
|
||||||
|
add r3, r3, #252
|
||||||
|
#elif __linux__
|
||||||
|
add r3, r3, #4
|
||||||
|
#endif // ANDROID
|
||||||
|
|
||||||
|
str r0, [r3]
|
||||||
|
mov pc, lr
|
||||||
|
|
||||||
|
GET_SP_LIMIT:
|
||||||
|
// First, try to read TLS address from coprocessor
|
||||||
|
mrc p15, #0, r3, c13, c0, #3
|
||||||
|
cmp r3, #0
|
||||||
|
// Otherwise, try to read from magic address 0xFFFF0FF0
|
||||||
|
mvneq r3, #0xF000
|
||||||
|
ldreq r3, [r3, #-15]
|
||||||
|
|
||||||
|
#if __ANDROID__
|
||||||
|
add r3, r3, #252
|
||||||
|
#elif __linux__
|
||||||
|
add r3, r3, #4
|
||||||
|
#endif // __ANDROID__
|
||||||
|
|
||||||
|
ldr r0, [r3]
|
||||||
|
mov pc, lr
|
||||||
|
#endif
|
70
src/rt/arch/armv7s/morestack.S
Normal file
70
src/rt/arch/armv7s/morestack.S
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
// Mark stack as non-executable
|
||||||
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
.section .note.GNU-stack, "", %progbits
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* See i386/morestack.S for the lengthy, general explanation. */
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code 32
|
||||||
|
.arm
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
.align 2
|
||||||
|
#else
|
||||||
|
.align
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#define MORESTACK ___morestack
|
||||||
|
#define STACK_EXHAUSTED _rust_stack_exhausted
|
||||||
|
#else
|
||||||
|
#define MORESTACK __morestack
|
||||||
|
#define STACK_EXHAUSTED rust_stack_exhausted
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.global STACK_EXHAUSTED
|
||||||
|
.global MORESTACK
|
||||||
|
|
||||||
|
// Unfortunately LLVM yet doesn't support emitting correct debug
|
||||||
|
// DWARF information for non-ELF targets so to make it compile
|
||||||
|
// on iOS all that directives are simply commented out
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
#define UNWIND @
|
||||||
|
#else
|
||||||
|
#define UNWIND
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
.private_extern MORESTACK
|
||||||
|
#else
|
||||||
|
.hidden MORESTACK
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
.type MORESTACK,%function
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// r4 and r5 are scratch registers for __morestack due to llvm
|
||||||
|
// ARMFrameLowering::adjustForSegmentedStacks() implementation.
|
||||||
|
MORESTACK:
|
||||||
|
UNWIND .fnstart
|
||||||
|
|
||||||
|
// Save frame pointer and return address
|
||||||
|
UNWIND .save {r4, r5}
|
||||||
|
UNWIND .save {lr}
|
||||||
|
UNWIND .save {r6, fp, lr}
|
||||||
|
push {r6, fp, lr}
|
||||||
|
|
||||||
|
UNWIND .movsp r6
|
||||||
|
mov r6, sp
|
||||||
|
UNWIND .setfp fp, sp, #4
|
||||||
|
add fp, sp, #4
|
||||||
|
|
||||||
|
// Save argument registers of the original function
|
||||||
|
push {r0, r1, r2, r3, lr}
|
||||||
|
|
||||||
|
// Create new stack
|
||||||
|
bl STACK_EXHAUSTED@plt
|
||||||
|
|
||||||
|
// the above function ensures that it never returns
|
||||||
|
UNWIND .fnend
|
56
src/rt/arch/armv7s/record_sp.S
Normal file
56
src/rt/arch/armv7s/record_sp.S
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
// Do not compile anything here for iOS because split stacks
|
||||||
|
// are disabled at all and do not need any runtime support.
|
||||||
|
//
|
||||||
|
// See also comments in librustrt/stack.rs about why it was
|
||||||
|
// disabled and how it could be implemented in case of need.
|
||||||
|
#if !defined(__APPLE__)
|
||||||
|
// Mark stack as non-executable
|
||||||
|
#if defined(__linux__) && defined(__ELF__)
|
||||||
|
.section .note.GNU-stack, "", %progbits
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.text
|
||||||
|
.code 32
|
||||||
|
.arm
|
||||||
|
.align
|
||||||
|
|
||||||
|
#define RECORD_SP_LIMIT record_sp_limit
|
||||||
|
#define GET_SP_LIMIT get_sp_limit
|
||||||
|
|
||||||
|
.globl RECORD_SP_LIMIT
|
||||||
|
.globl GET_SP_LIMIT
|
||||||
|
|
||||||
|
RECORD_SP_LIMIT:
|
||||||
|
// First, try to read TLS address from coprocessor
|
||||||
|
mrc p15, #0, r3, c13, c0, #3
|
||||||
|
cmp r3, #0
|
||||||
|
// Otherwise, try to read from magic address 0xFFFF0FF0
|
||||||
|
mvneq r3, #0xF000
|
||||||
|
ldreq r3, [r3, #-15]
|
||||||
|
|
||||||
|
#if __ANDROID__
|
||||||
|
add r3, r3, #252
|
||||||
|
#elif __linux__
|
||||||
|
add r3, r3, #4
|
||||||
|
#endif // ANDROID
|
||||||
|
|
||||||
|
str r0, [r3]
|
||||||
|
mov pc, lr
|
||||||
|
|
||||||
|
GET_SP_LIMIT:
|
||||||
|
// First, try to read TLS address from coprocessor
|
||||||
|
mrc p15, #0, r3, c13, c0, #3
|
||||||
|
cmp r3, #0
|
||||||
|
// Otherwise, try to read from magic address 0xFFFF0FF0
|
||||||
|
mvneq r3, #0xF000
|
||||||
|
ldreq r3, [r3, #-15]
|
||||||
|
|
||||||
|
#if __ANDROID__
|
||||||
|
add r3, r3, #252
|
||||||
|
#elif __linux__
|
||||||
|
add r3, r3, #4
|
||||||
|
#endif // __ANDROID__
|
||||||
|
|
||||||
|
ldr r0, [r3]
|
||||||
|
mov pc, lr
|
||||||
|
#endif
|
Loading…
Add table
Reference in a new issue