From 1d26dc852ebd7f9905af2b039d185394fe26fa6c Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 1 Mar 2023 02:06:28 +0800 Subject: [PATCH] [libffi] add risc-v support (#29870) --- ports/libffi/CMakeLists.txt | 12 +++++++++++- ports/libffi/vcpkg.json | 1 + versions/baseline.json | 2 +- versions/l-/libffi.json | 5 +++++ 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ports/libffi/CMakeLists.txt b/ports/libffi/CMakeLists.txt index 61a5fbd448d..21da1306c8e 100644 --- a/ports/libffi/CMakeLists.txt +++ b/ports/libffi/CMakeLists.txt @@ -11,7 +11,7 @@ endif() # config variables for ffi.h.in set(VERSION 3.4.4) -set(KNOWN_PROCESSORS x86 x86_64 amd64 arm arm64 i386 i686 armv7l armv7-a aarch64 mips64el) +set(KNOWN_PROCESSORS x86 x86_64 amd64 arm arm64 i386 i686 armv7l armv7-a aarch64 mips64el riscv32 riscv64) string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" lower_system_processor) @@ -33,6 +33,8 @@ elseif(lower_system_processor MATCHES "mips64") set(TARGET MIPS64) elseif(lower_system_processor MATCHES "arm") set(TARGET ARM) +elseif(lower_system_processor MATCHES "riscv") + set(TARGET RISCV) elseif(CMAKE_SYSTEM_NAME MATCHES "BSD" AND CMAKE_SIZEOF_VOID_P EQUAL 4) set(TARGET X86_FREEBSD) elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -62,6 +64,8 @@ elseif ("${TARGET}" STREQUAL "ARM_WIN32" OR "${TARGET}" STREQUAL "ARM") file(COPY src/arm/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) elseif ("${TARGET}" MATCHES "MIPS") file(COPY src/mips/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) +elseif ("${TARGET}" STREQUAL "RISCV") + file(COPY src/riscv/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) else() file(COPY src/x86/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) endif() @@ -93,6 +97,10 @@ elseif("${TARGET}" MATCHES "MIPS") set(FFI_SOURCES ${FFI_SOURCES} src/mips/ffi.c) +elseif("${TARGET}" STREQUAL "RISCV") + set(FFI_SOURCES + ${FFI_SOURCES} + src/riscv/ffi.c) else() set(FFI_SOURCES ${FFI_SOURCES} @@ -199,6 +207,8 @@ elseif("${TARGET}" STREQUAL "ARM64") add_assembly(src/aarch64/sysv.S) elseif("${TARGET}" MATCHES "MIPS") add_assembly(src/mips/n32.S) +elseif("${TARGET}" MATCHES "RISCV") + add_assembly(src/riscv/sysv.S) else() message(FATAL_ERROR "Target not implemented") endif() diff --git a/ports/libffi/vcpkg.json b/ports/libffi/vcpkg.json index 34ca821470c..6c4c452a5db 100644 --- a/ports/libffi/vcpkg.json +++ b/ports/libffi/vcpkg.json @@ -1,6 +1,7 @@ { "name": "libffi", "version": "3.4.4", + "port-version": 1, "description": "Portable, high level programming interface to various calling conventions", "homepage": "https://github.com/libffi/libffi", "license": "MIT", diff --git a/versions/baseline.json b/versions/baseline.json index 97057b13e02..c67b8d2602a 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3882,7 +3882,7 @@ }, "libffi": { "baseline": "3.4.4", - "port-version": 0 + "port-version": 1 }, "libfido2": { "baseline": "1.10.0", diff --git a/versions/l-/libffi.json b/versions/l-/libffi.json index 87ec5a2351a..a5e726fd6c0 100644 --- a/versions/l-/libffi.json +++ b/versions/l-/libffi.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "2422375e9ac93e01de0b511e1181000c340da613", + "version": "3.4.4", + "port-version": 1 + }, { "git-tree": "6552925531e923480b50d806c7d4538c1ff15481", "version": "3.4.4",