if (DEFINED ENV{CROSSCOMPILE})
if (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
find_program(OBJCOPY ${TOOLCHAIN}-objcopy)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+ find_program(OBJCOPY objcopy)
else()
clr_unknown_arch()
endif()
set(CLR_CMAKE_PLATFORM_UNIX_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(CLR_CMAKE_PLATFORM_UNIX_ARM64 1)
+ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+ set(CLR_CMAKE_PLATFORM_UNIX_X86 1)
else()
clr_unknown_arch()
endif()
elseif(CLR_CMAKE_PLATFORM_UNIX_AMD64)
set(CLR_CMAKE_PLATFORM_ARCH_AMD64 1)
set(CLR_CMAKE_HOST_ARCH "x64")
+elseif(CLR_CMAKE_PLATFORM_UNIX_X86)
+ set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+ set(CLR_CMAKE_HOST_ARCH "x86")
elseif(WIN32)
# CLR_CMAKE_HOST_ARCH is passed in as param to cmake
if (CLR_CMAKE_HOST_ARCH STREQUAL x64)
elseif(CLR_CMAKE_PLATFORM_UNIX_ARM64)
message("Detected Linux ARM64")
add_definitions(-DLINUX64)
+ elseif(CLR_CMAKE_PLATFORM_UNIX_X86)
+ message("Detected Linux i686")
+ add_definitions(-DLINUX32)
else()
clr_unknown_arch()
endif()
usage()
{
echo "Usage: $0 [BuildArch] [UbuntuCodeName] [lldbx.y]"
- echo "BuildArch can be: arm(default), arm-softfp, arm64"
+ echo "BuildArch can be: arm(default), arm-softfp, arm64, x86"
echo "UbuntuCodeName - optional, Code name for Ubuntu, can be: trusty(default), vivid, wily, xenial. If BuildArch is arm-softfp, UbuntuCodeName is ignored."
echo "lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8"
__UbuntuRepo="http://ftp.debian.org/debian/"
__UbuntuCodeName=jessie
;;
+ x86)
+ __BuildArch=x86
+ __UbuntuArch=i386
+ __UbuntuRepo="http://archive.ubuntu.com/ubuntu/"
+ ;;
lldb3.6)
__LLDB_Package="lldb-3.6-dev"
;;
--- /dev/null
+deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
--- /dev/null
+deb http://archive.ubuntu.com/ubuntu/ vivid main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ vivid main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ vivid-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ vivid-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ vivid-security main restricted universe multiverse
--- /dev/null
+deb http://archive.ubuntu.com/ubuntu/ wily main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ wily main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ wily-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ wily-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ wily-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ wily-security main restricted universe multiverse
--- /dev/null
+deb http://archive.ubuntu.com/ubuntu/ xenial main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ xenial main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe
+deb-src http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted universe
+
+deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted
+deb-src http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted
+
+deb http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
+deb-src http://archive.ubuntu.com/ubuntu/ xenial-security main restricted universe multiverse
--- /dev/null
+
+set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
+
+set(CMAKE_SYSTEM_NAME Linux)
+set(CMAKE_SYSTEM_PROCESSOR i686)
+
+add_compile_options("-m32")
+add_compile_options("--sysroot=${CROSS_ROOTFS}")
+add_compile_options("-Wno-error=unused-command-line-argument")
+
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=${CROSS_ROOTFS}")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/i686-linux-gnu")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/i386-linux-gnu")
+set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -m32")
+
+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(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}")
+if(LLVM_CROSS_DIR)
+ set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "")
+ set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "")
+ set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "")
+ set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "")
+else()
+ set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "")
+ set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include")
+ if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}")
+ set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}")
+ else()
+ set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include")
+ endif()
+endif()
--- /dev/null
+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( 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)
+
+SET( HAVE_PROCFS_CTL_EXITCODE
+ 1
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_PROCFS_MAPS_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_PROCFS_STAT_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_PROCFS_STATUS_EXITCODE
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
+
+SET( HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES
+ 0
+ CACHE STRING "Result from TRY_RUN" FORCE)
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+.intel_syntax noprefix
+#include "unixasmmacros.inc"
+
+//extern FuncEvalHijackWorker:proc
+
+// @dbgtodo- once we port Funceval, use the ExceptionHijack stub instead of this func-eval stub.
+NESTED_ENTRY FuncEvalHijack, _TEXT, UnhandledExceptionHandlerUnix
+ push eax // the ptr to the DebuggerEval
+ call C_FUNC(FuncEvalHijackWorker)
+ jmp eax // return is the patch addresss to jmp to
+
+NESTED_END FuncEvalHijack, _TEXT
+
+//
+// Flares for interop debugging.
+// Flares are exceptions (breakpoints) at well known addresses which the RS
+// listens for when interop debugging.
+//
+
+// This exception is from managed code.
+LEAF_ENTRY SignalHijackStartedFlare, _TEXT
+ int 3
+ // make sure that the basic block is unique
+ test eax,1
+ ret
+LEAF_END SignalHijackStartedFlare, _TEXT
+
+// Start the handoff
+LEAF_ENTRY ExceptionForRuntimeHandoffStartFlare, _TEXT
+ int 3
+ // make sure that the basic block is unique
+ test eax,2
+ ret
+LEAF_END ExceptionForRuntimeHandoffStartFlare, _TEXT
+
+// Finish the handoff.
+LEAF_ENTRY ExceptionForRuntimeHandoffCompleteFlare, _TEXT
+ int 3
+ // make sure that the basic block is unique
+ test eax,3
+ ret
+LEAF_END ExceptionForRuntimeHandoffCompleteFlare, _TEXT
+
+// Signal execution return to unhijacked state
+LEAF_ENTRY SignalHijackCompleteFlare, _TEXT
+ int 3
+ // make sure that the basic block is unique
+ test eax,4
+ ret
+LEAF_END SignalHijackCompleteFlare, _TEXT
+
+// This exception is from unmanaged code.
+LEAF_ENTRY ExceptionNotForRuntimeFlare, _TEXT
+ int 3
+ // make sure that the basic block is unique
+ test eax,5
+ ret
+LEAF_END ExceptionNotForRuntimeFlare, _TEXT
+
+// The Runtime is synchronized.
+LEAF_ENTRY NotifyRightSideOfSyncCompleteFlare, _TEXT
+ int 3
+ // make sure that the basic block is unique
+ test eax,6
+ ret
+LEAF_END NotifyRightSideOfSyncCompleteFlare, _TEXT
add_compile_options(-fPIC)
-if(CLR_CMAKE_PLATFORM_ARCH_AMD64)
- add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ../${ARCH_SOURCES_DIR}/dbghelpers.S)
-elseif(CLR_CMAKE_PLATFORM_ARCH_ARM)
+if(CLR_CMAKE_PLATFORM_ARCH_AMD64 OR CLR_CMAKE_PLATFORM_ARCH_ARM OR CLR_CMAKE_PLATFORM_ARCH_I386)
add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS} ../${ARCH_SOURCES_DIR}/dbghelpers.S)
elseif(CLR_CMAKE_PLATFORM_ARCH_ARM64)
add_library_clr(cordbee_wks ${CORDBEE_SOURCES_WKS})
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(PAL_CMAKE_PLATFORM_ARCH_ARM64 1)
add_definitions(-D_ARM64_)
+elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+ set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
+ add_definitions(-D_X86_)
else()
message(FATAL_ERROR "Only ARM and AMD64 is supported")
endif()
elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-DBIT64=1)
add_definitions(-D_WIN64=1)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+ add_definitions(-DBIT32=1)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Linux AND NOT CLR_CMAKE_PLATFORM_ALPINE_LINUX)
arch/arm64/exceptionhelper.S
arch/arm64/processor.cpp
)
+elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+ set(ARCH_SOURCES
+ #arch/i386/context2.S
+ #arch/i386/debugbreak.S
+ #arch/i386/exceptionhelper.S
+ arch/i386/processor.cpp
+ )
endif()
if(PAL_CMAKE_PLATFORM_ARCH_ARM)
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+#include "common.h"
+
+extern "C"
+{
+ void RedirectForThrowControl()
+ {
+ PORTABILITY_ASSERT("Implement for PAL");
+ }
+
+ void NakedThrowHelper()
+ {
+ PORTABILITY_ASSERT("Implement for PAL");
+ }
+
+ void PInvokeStubForHost()
+ {
+ PORTABILITY_ASSERT("Implement for PAL");
+ }
+
+ void PInvokeStubForHostInner(DWORD dwStackSize, LPVOID pStackFrame, LPVOID pTarget)
+ {
+ PORTABILITY_ASSERT("Implement for PAL");
+ }
+
+ void ProfileEnterNaked(FunctionIDOrClientID functionIDOrClientID)
+ {
+ PORTABILITY_ASSERT("Implement for PAL");
+ }
+
+ void ProfileLeaveNaked(FunctionIDOrClientID functionIDOrClientID)
+ {
+ PORTABILITY_ASSERT("Implement for PAL");
+ }
+
+ void ProfileTailcallNaked(FunctionIDOrClientID functionIDOrClientID)
+ {
+ PORTABILITY_ASSERT("Implement for PAL");
+ }
+
+ DWORD getcpuid(DWORD arg, unsigned char result[16])
+ {
+ DWORD eax;
+ __asm(" xor %%ecx, %%ecx\n" \
+ " cpuid\n" \
+ " mov %%eax, 0(%[result])\n" \
+ " mov %%ebx, 4(%[result])\n" \
+ " mov %%ecx, 8(%[result])\n" \
+ " mov %%edx, 12(%[result])\n" \
+ : "=a"(eax) /*output in eax*/\
+ : "a"(arg), [result]"r"(result) /*inputs - arg in eax, result in any register*/\
+ : "eax", "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
+ );
+ return eax;
+ }
+
+ DWORD getextcpuid(DWORD arg1, DWORD arg2, unsigned char result[16])
+ {
+ DWORD eax;
+ __asm(" cpuid\n" \
+ " mov %%eax, 0(%[result])\n" \
+ " mov %%ebx, 4(%[result])\n" \
+ " mov %%ecx, 8(%[result])\n" \
+ " mov %%edx, 12(%[result])\n" \
+ : "=a"(eax) /*output in eax*/\
+ : "c"(arg1), "a"(arg2), [result]"r"(result) /*inputs - arg1 in ecx, arg2 in eax, result in any register*/\
+ : "eax", "rbx", "ecx", "edx", "memory" /* registers that are clobbered, *result is clobbered */
+ );
+ return eax;
+ }
+
+ DWORD xmmYmmStateSupport()
+ {
+ DWORD eax;
+ __asm(" xgetbv\n" \
+ : "=a"(eax) /*output in eax*/\
+ : "c"(0) /*inputs - 0 in ecx*/\
+ : "eax", "edx" /* registers that are clobbered*/
+ );
+ // check OS has enabled both XMM and YMM state support
+ return ((eax & 0x06) == 0x06) ? 1 : 0;
+ }
+
+ void STDCALL JIT_ProfilerEnterLeaveTailcallStub(UINT_PTR ProfilerHandle)
+ {
+ }
+};