summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rwxr-xr-xbuild.sh6
-rw-r--r--cross/arm-softfp/sources.list3
-rw-r--r--cross/arm-softfp/toolchain.cmake28
-rw-r--r--cross/arm-softfp/tryrun.cmake116
-rwxr-xr-xcross/build-rootfs.sh17
-rw-r--r--src/jit/CMakeLists.txt4
-rw-r--r--src/jit/codegencommon.cpp4
-rw-r--r--src/jit/codegenlegacy.cpp2
-rw-r--r--src/jit/compiler.h6
-rw-r--r--src/jit/compiler.hpp2
-rw-r--r--src/jit/lclvars.cpp10
-rw-r--r--src/jit/morph.cpp6
-rw-r--r--src/jit/regalloc.cpp4
-rw-r--r--src/jit/registerfp.cpp2
-rwxr-xr-xsrc/pal/tools/gen-buildsys-clang.sh3
16 files changed, 200 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 57951e642b..472ad3c20a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,9 +35,14 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM 1)
# Because we don't use CMAKE_C_COMPILER/CMAKE_CXX_COMPILER to use clang
# we have to set the triple by adding a compiler argument
- add_compile_options(-target armv7-linux-gnueabihf)
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
+ if(ARM_SOFTFP)
+ add_compile_options(-mfloat-abi=softfp)
+ add_compile_options(-target armv7-linux-gnueabi)
+ else()
+ add_compile_options(-target armv7-linux-gnueabihf)
+ endif(ARM_SOFTFP)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(CLR_CMAKE_PLATFORM_UNIX_TARGET_ARM64 1)
else()
diff --git a/build.sh b/build.sh
index 6aca3ed772..8f78ac09ac 100755
--- a/build.sh
+++ b/build.sh
@@ -5,7 +5,7 @@ PYTHON=${PYTHON:-python}
usage()
{
echo "Usage: $0 [BuildArch] [BuildType] [clean] [verbose] [coverage] [cross] [clangx.y] [ninja] [configureonly] [skipconfigure] [skipnative] [skipmscorlib] [skiptests] [cmakeargs]"
- echo "BuildArch can be: x64, x86, arm, arm64"
+ echo "BuildArch can be: x64, x86, arm, arm-softfp, arm64"
echo "BuildType can be: debug, checked, release"
echo "clean - optional argument to force a clean build."
echo "verbose - optional argument to enable verbose build output."
@@ -444,6 +444,10 @@ while :; do
__BuildArch=arm
;;
+ arm-softfp)
+ __BuildArch=arm-softfp
+ ;;
+
arm64)
__BuildArch=arm64
;;
diff --git a/cross/arm-softfp/sources.list b/cross/arm-softfp/sources.list
new file mode 100644
index 0000000000..4d142ac9b1
--- /dev/null
+++ b/cross/arm-softfp/sources.list
@@ -0,0 +1,3 @@
+# Debian (sid) # UNSTABLE
+deb http://ftp.debian.org/debian/ sid main contrib non-free
+deb-src http://ftp.debian.org/debian/ sid main contrib non-free
diff --git a/cross/arm-softfp/toolchain.cmake b/cross/arm-softfp/toolchain.cmake
new file mode 100644
index 0000000000..9c8ca3e914
--- /dev/null
+++ b/cross/arm-softfp/toolchain.cmake
@@ -0,0 +1,28 @@
+set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
+
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_VERSION 1)
+set(CMAKE_SYSTEM_PROCESSOR armv7l)
+
+add_compile_options(-target armv7-linux-gnueabi)
+add_compile_options(-mthumb)
+add_compile_options(-mfpu=vfpv3)
+add_compile_options(--sysroot=${CROSS_ROOTFS})
+
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -target arm-linux-gnueabi")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B${CROSS_ROOTFS}/usr/lib/arm-linux-gnueabi")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/arm-linux-gnueabi -L${CROSS_ROOTFS}/usr/lib/arm-linux-gnueabi")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}")
+
+set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
+set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
+set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
+
+set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
+set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
+set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
+
+set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/arm-linux-gnueabi" CACHE STRING "")
+set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "")
diff --git a/cross/arm-softfp/tryrun.cmake b/cross/arm-softfp/tryrun.cmake
new file mode 100644
index 0000000000..5994e08394
--- /dev/null
+++ b/cross/arm-softfp/tryrun.cmake
@@ -0,0 +1,116 @@
+SET( REALPATH_SUPPORTS_NONEXISTENT_FILES_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( SSCANF_SUPPORT_ll_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( SSCANF_CANNOT_HANDLE_MISSING_EXPONENT_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_LARGE_SNPRINTF_SUPPORT_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_SCHED_GET_PRIORITY_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_WORKING_GETTIMEOFDAY_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_WORKING_CLOCK_GETTIME_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_CLOCK_MONOTONIC_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_MMAP_DEV_ZERO_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( MMAP_IGNORES_HINT_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( MMAP_DOESNOT_ALLOW_REMAP_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( ONE_SHARED_MAPPING_PER_FILEREGION_PER_PROCESS_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( PTHREAD_CREATE_MODIFIES_ERRNO_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( SEM_INIT_MODIFIES_ERRNO_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_ACOS_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_ASIN_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_POW_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_VALID_NEGATIVE_INF_POW_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_VALID_POSITIVE_INF_POW_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_ATAN2_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_LOG_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_COMPATIBLE_LOG10_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( UNGETC_NOT_RETURN_EOF_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAS_POSIX_SEMAPHORES_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( GETPWUID_R_SETS_ERRNO_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_CLOCK_THREAD_CPUTIME_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_SCHED_GETCPU_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_CLOCK_MONOTONIC_COARSE_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
diff --git a/cross/build-rootfs.sh b/cross/build-rootfs.sh
index 78309f766a..6e563d27ca 100755
--- a/cross/build-rootfs.sh
+++ b/cross/build-rootfs.sh
@@ -3,11 +3,13 @@
usage()
{
echo "Usage: $0 [BuildArch]"
- echo "BuildArch can be: arm, arm64"
+ echo "BuildArch can be: arm, arm-softfp, arm64"
exit 1
}
+__UbuntuCodeName=trusty
+
__CrossDir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
__InitialDir=$PWD
__BuildArch=arm
@@ -38,6 +40,14 @@ for i in "$@"
__UbuntuPackages="build-essential libunwind8-dev gettext symlinks liblttng-ust-dev libicu-dev"
__MachineTriple=aarch64-linux-gnu
;;
+ arm-softfp)
+ __BuildArch=arm-softfp
+ __UbuntuArch=armel
+ __UbuntuRepo="http://ftp.debian.org/debian/"
+ __UbuntuPackages="build-essential lldb-3.6-dev libunwind8-dev gettext symlinks liblttng-ust-dev libicu-dev"
+ __MachineTriple=arm-linux-gnueabi
+ __UbuntuCodeName=stable
+ ;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $i"
esac
@@ -51,9 +61,10 @@ fi
umount $__RootfsDir/*
rm -rf $__RootfsDir
-qemu-debootstrap --arch $__UbuntuArch trusty $__RootfsDir $__UbuntuRepo
+qemu-debootstrap --arch $__UbuntuArch $__UbuntuCodeName $__RootfsDir $__UbuntuRepo
cp $__CrossDir/$__BuildArch/sources.list $__RootfsDir/etc/apt/sources.list
chroot $__RootfsDir apt-get update
chroot $__RootfsDir apt-get -y install $__UbuntuPackages
chroot $__RootfsDir symlinks -cr /usr
-umount $__RootfsDir/* \ No newline at end of file
+umount $__RootfsDir/*
+
diff --git a/src/jit/CMakeLists.txt b/src/jit/CMakeLists.txt
index 8990afca47..79351e0861 100644
--- a/src/jit/CMakeLists.txt
+++ b/src/jit/CMakeLists.txt
@@ -11,6 +11,10 @@ if (CLR_CMAKE_PLATFORM_ARCH_AMD64)
add_definitions(-DFEATURE_AVX_SUPPORT)
endif (CLR_CMAKE_PLATFORM_ARCH_AMD64)
+if (ARM_SOFTFP)
+ add_definitions(-DARM_SOFTFP)
+endif (ARM_SOFTFP)
+
set( JIT_SOURCES
alloc.cpp
assertionprop.cpp
diff --git a/src/jit/codegencommon.cpp b/src/jit/codegencommon.cpp
index f07bf46aa4..b96f5c0956 100644
--- a/src/jit/codegencommon.cpp
+++ b/src/jit/codegencommon.cpp
@@ -4150,7 +4150,7 @@ void CodeGen::genFnPrologCalleeRegArgs(regNumber xtraReg,
(varDsc->lvType == TYP_STRUCT) ||
(varDsc->lvAddrExposed && compiler->info.compIsVarArgs));
#else // LEGACY_BACKEND
- noway_assert(varDsc->lvType == TYP_STRUCT || (varDsc->lvAddrExposed && compiler->info.compIsVarArgs));
+ noway_assert(varDsc->lvType == TYP_STRUCT || (varDsc->lvAddrExposed && (compiler->info.compIsVarArgs || compiler->opts.compUseSoftFP)));
#endif // LEGACY_BACKEND
#endif // !_TARGET_X86_
}
@@ -7449,7 +7449,7 @@ void CodeGen::genProfilingLeaveCallback(unsigned helper /*= CORIN
emitAttr attr = EA_UNKNOWN;
if (compiler->info.compRetType == TYP_VOID ||
- (!compiler->info.compIsVarArgs && (varTypeIsFloating(compiler->info.compRetType) || compiler->IsHfa(compiler->info.compMethodInfo->args.retTypeClass))))
+ (!compiler->opts.compUseSoftFP && !compiler->info.compIsVarArgs && (varTypeIsFloating(compiler->info.compRetType) || compiler->IsHfa(compiler->info.compMethodInfo->args.retTypeClass))))
{
r0Trashed = false;
}
diff --git a/src/jit/codegenlegacy.cpp b/src/jit/codegenlegacy.cpp
index 8b9f95937d..b5cacc3d91 100644
--- a/src/jit/codegenlegacy.cpp
+++ b/src/jit/codegenlegacy.cpp
@@ -20431,7 +20431,7 @@ regMaskTP CodeGen::genCodeForCall(GenTreePtr call,
if (call->gtType == TYP_FLOAT || call->gtType == TYP_DOUBLE)
{
#ifdef _TARGET_ARM_
- if (call->gtCall.IsVarargs())
+ if (call->gtCall.IsVarargs() || compiler->opts.compUseSoftFP)
{
// Result return for vararg methods is in r0, r1, but our callers would
// expect the return in s0, s1 because of floating type. Do the move now.
diff --git a/src/jit/compiler.h b/src/jit/compiler.h
index 0c18dba75f..b8ad1f540b 100644
--- a/src/jit/compiler.h
+++ b/src/jit/compiler.h
@@ -7583,6 +7583,12 @@ public :
bool compTailCallLoopOpt;
#endif
+#ifdef ARM_SOFTFP
+ static const bool compUseSoftFP = true;
+#else // !ARM_SOFTFP
+ static const bool compUseSoftFP = false;
+#endif
+
GCPollType compGCPollType;
}
opts;
diff --git a/src/jit/compiler.hpp b/src/jit/compiler.hpp
index cabd6ba8cd..198c8cfa5e 100644
--- a/src/jit/compiler.hpp
+++ b/src/jit/compiler.hpp
@@ -2574,7 +2574,7 @@ inline
var_types Compiler::mangleVarArgsType(var_types type)
{
#ifdef _TARGET_ARMARCH_
- if (info.compIsVarArgs)
+ if (info.compIsVarArgs || opts.compUseSoftFP)
{
switch (type) {
case TYP_FLOAT:
diff --git a/src/jit/lclvars.cpp b/src/jit/lclvars.cpp
index e6956cf3cf..3953d04b96 100644
--- a/src/jit/lclvars.cpp
+++ b/src/jit/lclvars.cpp
@@ -136,7 +136,7 @@ void Compiler::lvaInitTypeRef()
{
#ifdef _TARGET_ARM_
// TODO-ARM64-NYI: HFA
- if (!info.compIsVarArgs && IsHfa(info.compMethodInfo->args.retTypeClass))
+ if (!info.compIsVarArgs && !opts.compUseSoftFP && IsHfa(info.compMethodInfo->args.retTypeClass))
{
info.compRetNativeType = TYP_STRUCT;
}
@@ -570,13 +570,13 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo * varDscInfo)
#ifdef _TARGET_ARM_
var_types hfaType = (varTypeIsStruct(argType)) ? GetHfaType(typeHnd) : TYP_UNDEF;
- bool isHfaArg = !info.compIsVarArgs && varTypeIsFloating(hfaType);
+ bool isHfaArg = !info.compIsVarArgs && !opts.compUseSoftFP && varTypeIsFloating(hfaType);
// On ARM we pass the first 4 words of integer arguments and non-HFA structs in registers.
// But we pre-spill user arguments in varargs methods and structs.
//
unsigned cAlign;
- bool preSpill = info.compIsVarArgs;
+ bool preSpill = info.compIsVarArgs || opts.compUseSoftFP;
switch (argType)
{
@@ -912,7 +912,7 @@ void Compiler::lvaInitUserArgs(InitVarDscInfo * varDscInfo)
#else // !FEATURE_UNIX_AMD64_STRUCT_PASSING
compArgSize += argSize;
#endif // !FEATURE_UNIX_AMD64_STRUCT_PASSING
- if (info.compIsVarArgs)
+ if (info.compIsVarArgs || opts.compUseSoftFP)
{
#if defined(_TARGET_X86_)
varDsc->lvStkOffs = compArgSize;
@@ -4606,7 +4606,7 @@ int Compiler::lvaAssignVirtualFrameOffsetToArg(unsigned lclNum, unsigned argSize
if (!compIsProfilerHookNeeded())
#endif
{
- bool cond = (info.compIsVarArgs &&
+ bool cond = ((info.compIsVarArgs || opts.compUseSoftFP) &&
// Does cur stk arg require double alignment?
((varDsc->lvType == TYP_STRUCT && varDsc->lvStructDoubleAlign) ||
(varDsc->lvType == TYP_DOUBLE) ||
diff --git a/src/jit/morph.cpp b/src/jit/morph.cpp
index cc642ec433..444be6b018 100644
--- a/src/jit/morph.cpp
+++ b/src/jit/morph.cpp
@@ -2799,8 +2799,9 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* callNode)
// this can't be a struct.
assert(argx->gtType != TYP_STRUCT);
+ // FIXME: Issue #4025 Why do we need floating type for 'this' argument
/* Increment the argument register count and argument index */
- if (!varTypeIsFloating(argx->gtType))
+ if (!varTypeIsFloating(argx->gtType) || opts.compUseSoftFP)
{
intArgRegNum++;
#if defined(_TARGET_AMD64_) && !defined(UNIX_AMD64_ABI)
@@ -2950,7 +2951,6 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* callNode)
#ifdef _TARGET_ARM_
bool passUsingIntRegs;
-
if (lateArgsComputed)
{
passUsingFloatRegs = isValidFloatArgReg(argEntry->regNum);
@@ -2958,7 +2958,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* callNode)
}
else
{
- passUsingFloatRegs = !callIsVararg && (isHfaArg || varTypeIsFloating(argx));
+ passUsingFloatRegs = !callIsVararg && (isHfaArg || varTypeIsFloating(argx)) && !opts.compUseSoftFP;
passUsingIntRegs = passUsingFloatRegs ? false : (intArgRegNum < MAX_REG_ARG);
}
diff --git a/src/jit/regalloc.cpp b/src/jit/regalloc.cpp
index 1675f2c018..89f2955724 100644
--- a/src/jit/regalloc.cpp
+++ b/src/jit/regalloc.cpp
@@ -595,7 +595,7 @@ void Compiler::raSetupArgMasks(RegState *regState)
continue;
// only process args that apply to the current register file
- if ((argDsc->IsFloatRegType() && !info.compIsVarArgs) != regState->rsIsFloat)
+ if ((argDsc->IsFloatRegType() && !info.compIsVarArgs && !opts.compUseSoftFP) != regState->rsIsFloat)
{
continue;
}
@@ -691,7 +691,7 @@ regNumber Compiler::raUpdateRegStateForArg(RegState *regState, LclVarDsc *ar
#ifdef _TARGET_ARM_
if (argDsc->lvType == TYP_DOUBLE)
{
- if (info.compIsVarArgs)
+ if (info.compIsVarArgs || opts.compUseSoftFP)
{
assert((inArgReg == REG_R0) || (inArgReg == REG_R2));
assert(!regState->rsIsFloat);
diff --git a/src/jit/registerfp.cpp b/src/jit/registerfp.cpp
index 7779cfe8c2..9b7f651d41 100644
--- a/src/jit/registerfp.cpp
+++ b/src/jit/registerfp.cpp
@@ -229,7 +229,7 @@ void CodeGen::genFloatSimple(GenTree *tree, RegSet::RegisterPreference *pref)
genCodeForTreeFloat(op1, pref);
inst_RV_TT(ins_FloatConv(tree->TypeGet(), op1->TypeGet()), REG_FLOATRET, op1);
- if (compiler->info.compIsVarArgs)
+ if (compiler->info.compIsVarArgs || compiler->opts.compUseSoftFP)
{
if (tree->TypeGet() == TYP_FLOAT)
{
diff --git a/src/pal/tools/gen-buildsys-clang.sh b/src/pal/tools/gen-buildsys-clang.sh
index 087a4e107f..b7945f3091 100755
--- a/src/pal/tools/gen-buildsys-clang.sh
+++ b/src/pal/tools/gen-buildsys-clang.sh
@@ -134,6 +134,9 @@ if [[ -n "$CROSSCOMPILE" ]]; then
cmake_extra_defines="$cmake_extra_defines -C $1/cross/$build_arch/tryrun.cmake"
cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$1/cross/$build_arch/toolchain.cmake"
fi
+if [ "$build_arch" == "arm-softfp" ]; then
+ cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
+fi
cmake \
-G "$generator" \