summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt20
-rw-r--r--cross/arm/toolchain.cmake6
-rw-r--r--src/mscorlib/src/System/String.cs28
-rw-r--r--src/pal/src/arch/arm/context2.S24
4 files changed, 44 insertions, 34 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9da3675a0..d0f3f54389 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -166,15 +166,23 @@ else()
if (STRIP STREQUAL "STRIP-NOTFOUND")
message(FATAL_ERROR "strip not found")
endif()
-
- else (CMAKE_SYSTEM_NAME STREQUAL Darwin)
-
+ elseif (CMAKE_SYSTEM_NAME STREQUAL Linux)
# Ensure that objcopy is present
- find_program(OBJCOPY objcopy)
+ if(DEFINED ENV{CROSSCOMPILE})
+ if(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
+ find_program(OBJCOPY arm-linux-gnueabihf-objcopy)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
+ find_program(OBJCOPY aarch64-linux-gnu-objcopy)
+ else()
+ clr_unknown_arch()
+ endif()
+ else()
+ find_program(OBJCOPY objcopy)
+ endif()
if (OBJCOPY STREQUAL "OBJCOPY-NOTFOUND")
message(FATAL_ERROR "objcopy not found")
endif()
- endif (CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ endif ()
endif(WIN32)
# Build a list of compiler definitions by putting -D in front of each define.
@@ -287,7 +295,7 @@ function(strip_symbols targetName outputFilename)
COMMAND ${STRIP} -u -r ${strip_source_file}
COMMENT Stripping symbols from ${strip_source_file} into file ${strip_destination_file}
)
- else(CMAKE_SYSTEM_NAME STREQUAL Darwin)
+ elseif(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(strip_destination_file ${strip_source_file}.dbg)
add_custom_command(
diff --git a/cross/arm/toolchain.cmake b/cross/arm/toolchain.cmake
index c7fea199cb..9cc92798af 100644
--- a/cross/arm/toolchain.cmake
+++ b/cross/arm/toolchain.cmake
@@ -7,9 +7,9 @@ set(CMAKE_SYSTEM_PROCESSOR armv7l)
## Specify the toolchain
set(TOOLCHAIN "arm-linux-gnueabihf")
set(TOOLCHAIN_PREFIX ${TOOLCHAIN}-)
-# set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
-# set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
-# set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}as)
+#set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
+#set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
+#set(CMAKE_ASM_COMPILER ${TOOLCHAIN_PREFIX}as)
#set(CMAKE_AR ${TOOLCHAIN_PREFIX}ar)
#set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
#set(CMAKE_OBJDUMP ${TOOLCHAIN_PREFIX}objdump)
diff --git a/src/mscorlib/src/System/String.cs b/src/mscorlib/src/System/String.cs
index 9c4c9e0ad5..b17baa9006 100644
--- a/src/mscorlib/src/System/String.cs
+++ b/src/mscorlib/src/System/String.cs
@@ -386,19 +386,19 @@ namespace System {
while (length >= 12)
{
- if (*(long*)a != *(long*)b) return false;
- if (*(long*)(a+4) != *(long*)(b+4)) return false;
- if (*(long*)(a+8) != *(long*)(b+8)) return false;
+ if (*(long*)a != *(long*)b) goto ReturnFalse;
+ if (*(long*)(a + 4) != *(long*)(b + 4)) goto ReturnFalse;
+ if (*(long*)(a + 8) != *(long*)(b + 8)) goto ReturnFalse;
length -= 12; a += 12; b += 12;
}
#else
while (length >= 10)
{
- if (*(int*)a != *(int*)b) return false;
- if (*(int*)(a+2) != *(int*)(b+2)) return false;
- if (*(int*)(a+4) != *(int*)(b+4)) return false;
- if (*(int*)(a+6) != *(int*)(b+6)) return false;
- if (*(int*)(a+8) != *(int*)(b+8)) return false;
+ if (*(int*)a != *(int*)b) goto ReturnFalse;
+ if (*(int*)(a + 2) != *(int*)(b + 2)) goto ReturnFalse;
+ if (*(int*)(a + 4) != *(int*)(b + 4)) goto ReturnFalse;
+ if (*(int*)(a + 6) != *(int*)(b + 6)) goto ReturnFalse;
+ if (*(int*)(a + 8) != *(int*)(b + 8)) goto ReturnFalse;
length -= 10; a += 10; b += 10;
}
#endif
@@ -409,11 +409,14 @@ namespace System {
// the zero terminator.
while (length > 0)
{
- if (*(int*)a != *(int*)b) break;
+ if (*(int*)a != *(int*)b) goto ReturnFalse;
length -= 2; a += 2; b += 2;
}
- return (length <= 0);
+ return true;
+
+ ReturnFalse:
+ return false;
}
}
@@ -662,13 +665,10 @@ namespace System {
return true;
}
- if ((Object)a==null || (Object)b==null) {
+ if ((Object)a == null || (Object)b == null || a.Length != b.Length) {
return false;
}
- if (a.Length != b.Length)
- return false;
-
return EqualsHelper(a, b);
}
diff --git a/src/pal/src/arch/arm/context2.S b/src/pal/src/arch/arm/context2.S
index 006d0d8b43..3eafbb7bb9 100644
--- a/src/pal/src/arch/arm/context2.S
+++ b/src/pal/src/arch/arm/context2.S
@@ -192,23 +192,25 @@ LEAF_ENTRY RtlRestoreContext, _TEXT
ldr R2, [r0, #(CONTEXT_Cpsr)]
msr APSR, r2
- mov r12, r0 // ideally we would ldmia r0, {r0-r12, sp, lr, pc} here, but that isn't supported on new clang
- add r12, CONTEXT_R0 // so we'll burn r12 as the IPC reg for now -- TODO: is this ok?
+ // Ideally, we would like to use `ldmia r0, {r0-r12, sp, lr, pc}` here,
+ // but clang 3.6 and later, as per ARM recommendation, disallows using
+ // Sp in the register list, and Pc and Lr simultaneously.
+ // So we are going to use the IPC register r12 to copy Sp, Lr and Pc
+ // which should be ok -- TODO: Is this really ok?
+ add r12, r0, CONTEXT_R0
ldm r12, {r0-r11}
- add r12, (CONTEXT_Sp - CONTEXT_R0)
- ldr sp, [r12]
- ldr lr, [r12, #(CONTEXT_Lr - CONTEXT_Sp)]
- ldr pc, [r12, #(CONTEXT_Pc - CONTEXT_Sp)]
-
+ ldr sp, [r12, #(CONTEXT_Sp - (CONTEXT_R0))]
+ ldr lr, [r12, #(CONTEXT_Lr - (CONTEXT_R0))]
+ ldr pc, [r12, #(CONTEXT_Pc - (CONTEXT_R0))]
+
LOCAL_LABEL(No_Restore_CONTEXT_INTEGER):
ldr r2, [r0, #(CONTEXT_Cpsr)]
msr APSR, r2
- add r0, CONTEXT_Sp
- ldr sp, [r0]
- ldr lr, [r0, #(CONTEXT_Lr - CONTEXT_Sp)]
- ldr pc, [r0, #(CONTEXT_Pc - CONTEXT_Sp)]
+ ldr sp, [r0, #(CONTEXT_Sp)]
+ ldr lr, [r0, #(CONTEXT_Lr)]
+ ldr pc, [r0, #(CONTEXT_Pc)]
LOCAL_LABEL(No_Restore_CONTEXT_CONTROL):
ldr r2, [r0, #(CONTEXT_ContextFlags)]