diff options
author | Jo Shields <directhex@apebox.org> | 2022-01-25 00:29:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-25 00:29:57 +0300 |
commit | df69293bdbe75bf5903583c472fcd257119dbda4 (patch) | |
tree | 92c11c146ada65822ce759ec83d0285c47d5a2bf /eng/native | |
parent | ae755ab3c7f838f7dccd2a4c2d5934a9d7d82c69 (diff) |
Port Mono to Raspberry Pi, ship as new linux-armv6 RID (#62594)
* Initial ARMv6 arch addition. Builds mono runtime, not CoreCLR (Mono already supports the CPU arch subset used by Raspberry Pi, whilst porting CoreCLR to e.g. VFPv2 would be major work)
* Build small clr subset on ARMv6, it's needed for SDK and we want to check it works
Diffstat (limited to 'eng/native')
-rwxr-xr-x | eng/native/build-commons.sh | 6 | ||||
-rw-r--r-- | eng/native/configurecompiler.cmake | 19 | ||||
-rw-r--r-- | eng/native/configureplatform.cmake | 13 | ||||
-rw-r--r-- | eng/native/configuretools.cmake | 4 | ||||
-rw-r--r-- | eng/native/functions.cmake | 6 | ||||
-rw-r--r-- | eng/native/init-os-and-arch.sh | 4 | ||||
-rw-r--r-- | eng/native/tryrun.cmake | 6 |
7 files changed, 51 insertions, 7 deletions
diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 373091b13a0..294e9832ad3 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -197,7 +197,7 @@ usage() echo "" echo "Common Options:" echo "" - echo "BuildArch can be: -arm, -armel, -arm64, -loongarch64, -s390x, x64, x86, -wasm" + echo "BuildArch can be: -arm, -armv6, -armel, -arm64, -loongarch64, -s390x, x64, x86, -wasm" echo "BuildType can be: -debug, -checked, -release" echo "-os: target OS (defaults to running OS)" echo "-bindir: output directory (defaults to $__ProjectRoot/artifacts)" @@ -270,6 +270,10 @@ while :; do __BuildArch=arm ;; + armv6|-armv6) + __BuildArch=armv6 + ;; + arm64|-arm64) __BuildArch=arm64 ;; diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index fad1ac58d39..b67594cb60f 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -213,6 +213,9 @@ elseif (CLR_CMAKE_HOST_ARCH_I386) elseif (CLR_CMAKE_HOST_ARCH_ARM) set(ARCH_HOST_NAME arm) add_definitions(-DHOST_ARM) +elseif (CLR_CMAKE_HOST_ARCH_ARMV6) + set(ARCH_HOST_NAME armv6) + add_definitions(-DHOST_ARMV6) elseif (CLR_CMAKE_HOST_ARCH_ARM64) set(ARCH_HOST_NAME arm64) add_definitions(-DHOST_ARM64 -DHOST_64BIT) @@ -238,6 +241,8 @@ if (CLR_CMAKE_HOST_UNIX) message("Detected Linux x86_64") elseif(CLR_CMAKE_HOST_UNIX_ARM) message("Detected Linux ARM") + elseif(CLR_CMAKE_HOST_UNIX_ARMV6) + message("Detected Linux ARMv6") elseif(CLR_CMAKE_HOST_UNIX_ARM64) message("Detected Linux ARM64") elseif(CLR_CMAKE_HOST_UNIX_LOONGARCH64) @@ -301,6 +306,12 @@ elseif (CLR_CMAKE_TARGET_ARCH_ARM) set(ARCH_TARGET_NAME arm) add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_ARM>) add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_32BIT>) +elseif (CLR_CMAKE_TARGET_ARCH_ARMV6) + set(ARCH_SOURCES_DIR arm) + set(ARCH_TARGET_NAME armv6) + add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_ARM>) + add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_ARMV6>) + add_compile_definitions($<$<NOT:$<BOOL:$<TARGET_PROPERTY:IGNORE_DEFAULT_TARGET_ARCH>>>:TARGET_32BIT>) elseif (CLR_CMAKE_TARGET_ARCH_I386) set(ARCH_TARGET_NAME x86) set(ARCH_SOURCES_DIR i386) @@ -507,6 +518,14 @@ if(CLR_CMAKE_HOST_UNIX_ARM) endif(ARM_SOFTFP) endif(CLR_CMAKE_HOST_UNIX_ARM) +if(CLR_CMAKE_HOST_UNIX_ARMV6) + add_compile_options(-mfpu=vfp) + add_definitions(-DCLR_ARM_FPU_CAPABILITY=0x0) + add_compile_options(-march=armv6zk) + add_compile_options(-mcpu=arm1176jzf-s) + add_compile_options(-mfloat-abi=hard) +endif(CLR_CMAKE_HOST_UNIX_ARMV6) + if(CLR_CMAKE_HOST_UNIX_X86) add_compile_options(-msse2) endif() diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index cdf33430b49..ecf10a8d4c3 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -41,6 +41,8 @@ if(CLR_CMAKE_HOST_OS STREQUAL Linux) set(CLR_CMAKE_HOST_UNIX_ARMV7L 1) elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv7-a) set(CLR_CMAKE_HOST_UNIX_ARM 1) + elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv6 OR CMAKE_SYSTEM_PROCESSOR STREQUAL armv6l) + set(CLR_CMAKE_HOST_UNIX_ARMV6 1) elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm64) set(CLR_CMAKE_HOST_UNIX_ARM64 1) elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL loongarch64) @@ -217,6 +219,13 @@ if(CLR_CMAKE_HOST_UNIX_ARM) if(CLR_CMAKE_HOST_UNIX_ARMV7L) set(CLR_CMAKE_HOST_ARCH_ARMV7L 1) endif() +elseif(CLR_CMAKE_HOST_UNIX_ARMV6) + set(CLR_CMAKE_HOST_ARCH_ARMV6 1) + set(CLR_CMAKE_HOST_ARCH "armv6") + + if(CLR_CMAKE_HOST_UNIX_ARMV6L) + set(CLR_CMAKE_HOST_ARCH_ARMV6L 1) + endif() elseif(CLR_CMAKE_HOST_UNIX_ARM64) set(CLR_CMAKE_HOST_ARCH_ARM64 1) set(CLR_CMAKE_HOST_ARCH "arm64") @@ -277,6 +286,8 @@ if (CLR_CMAKE_TARGET_ARCH STREQUAL x64) set(CLR_CMAKE_TARGET_ARCH_LOONGARCH64 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm) set(CLR_CMAKE_TARGET_ARCH_ARM 1) + elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armv6) + set(CLR_CMAKE_TARGET_ARCH_ARMV6 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel) set(CLR_CMAKE_TARGET_ARCH_ARM 1) set(CLR_CMAKE_TARGET_ARCH_ARMV7L 1) @@ -379,6 +390,8 @@ if(CLR_CMAKE_TARGET_UNIX) set(CLR_CMAKE_TARGET_UNIX_ARM 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm) set(CLR_CMAKE_TARGET_UNIX_ARM 1) + elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armv6) + set(CLR_CMAKE_TARGET_UNIX_ARMV6 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64) set(CLR_CMAKE_TARGET_UNIX_ARM64 1) elseif(CLR_CMAKE_TARGET_ARCH STREQUAL loongarch64) diff --git a/eng/native/configuretools.cmake b/eng/native/configuretools.cmake index 136cd67925d..ad5dc38107c 100644 --- a/eng/native/configuretools.cmake +++ b/eng/native/configuretools.cmake @@ -52,8 +52,8 @@ if(NOT WIN32 AND NOT CLR_CMAKE_TARGET_BROWSER) if(CLR_CMAKE_TARGET_ANDROID) set(TOOLSET_PREFIX ${ANDROID_TOOLCHAIN_PREFIX}) - elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND (CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l OR - CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL arm OR CMAKE_SYSTEM_PROCESSOR STREQUAL s390x)) + elseif(CMAKE_CROSSCOMPILING AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD AND + CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l|armv6l|aarch64|arm|s390x)$") set(TOOLSET_PREFIX "${TOOLCHAIN}-") else() set(TOOLSET_PREFIX "") diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index c4af68ba7dc..0c28f75706d 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -4,7 +4,7 @@ function(clr_unknown_arch) elseif(CLR_CROSS_COMPONENTS_BUILD) message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component. Found: ${CMAKE_SYSTEM_PROCESSOR}") else() - message(FATAL_ERROR "Only AMD64, ARM64, LOONGARCH64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}") + message(FATAL_ERROR "Only AMD64, ARMV6, ARM64, LOONGARCH64 and ARM are supported. Found: ${CMAKE_SYSTEM_PROCESSOR}") endif() endfunction() @@ -155,6 +155,10 @@ function(find_unwind_libs UnwindLibs) find_library(UNWIND_ARCH NAMES unwind-arm) endif() + if(CLR_CMAKE_HOST_ARCH_ARMV6) + find_library(UNWIND_ARCH NAMES unwind-arm) + endif() + if(CLR_CMAKE_HOST_ARCH_ARM64) find_library(UNWIND_ARCH NAMES unwind-aarch64) endif() diff --git a/eng/native/init-os-and-arch.sh b/eng/native/init-os-and-arch.sh index 586534be1c8..eda07a5feeb 100644 --- a/eng/native/init-os-and-arch.sh +++ b/eng/native/init-os-and-arch.sh @@ -53,6 +53,10 @@ case "$CPUName" in fi ;; + armv6l) + arch=armv6 + ;; + i[3-6]86) echo "Unsupported CPU $CPUName detected, build might not succeed!" arch=x86 diff --git a/eng/native/tryrun.cmake b/eng/native/tryrun.cmake index e8a04c5698a..fca410fcb4b 100644 --- a/eng/native/tryrun.cmake +++ b/eng/native/tryrun.cmake @@ -68,7 +68,7 @@ if(DARWIN) else() message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only arm64 or x64 is supported for OSX cross build!") endif() -elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|loongarch64|s390x|x86)$" OR FREEBSD OR ILLUMOS) +elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|armv6|arm64|loongarch64|s390x|x86)$" OR FREEBSD OR ILLUMOS) set_cache_value(FILE_OPS_CHECK_FERROR_OF_PREVIOUS_CALL_EXITCODE 1) set_cache_value(GETPWUID_R_SETS_ERRNO_EXITCODE 0) set_cache_value(HAS_POSIX_SEMAPHORES_EXITCODE 0) @@ -146,9 +146,9 @@ elseif(TARGET_ARCH_NAME MATCHES "^(armel|arm|arm64|loongarch64|s390x|x86)$" OR F set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0) endif() else() - message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64, loongarch64, s390x and x86 are supported!") + message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, armv6, arm64, loongarch64, s390x and x86 are supported!") endif() -if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x" OR TARGET_ARCH_NAME STREQUAL "loongarch64") +if(TARGET_ARCH_NAME STREQUAL "x86" OR TARGET_ARCH_NAME STREQUAL "s390x" OR TARGET_ARCH_NAME STREQUAL "armv6" OR TARGET_ARCH_NAME STREQUAL "loongarch64") set_cache_value(HAVE_FUNCTIONAL_PTHREAD_ROBUST_MUTEXES_EXITCODE 0) endif() |