[libffi] add risc-v support (#29870)

This commit is contained in:
Yingwei Zheng 2023-03-01 02:06:28 +08:00 committed by GitHub
parent 41b17b8090
commit 1d26dc852e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 2 deletions

View File

@ -11,7 +11,7 @@ endif()
# config variables for ffi.h.in # config variables for ffi.h.in
set(VERSION 3.4.4) 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) string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" lower_system_processor)
@ -33,6 +33,8 @@ elseif(lower_system_processor MATCHES "mips64")
set(TARGET MIPS64) set(TARGET MIPS64)
elseif(lower_system_processor MATCHES "arm") elseif(lower_system_processor MATCHES "arm")
set(TARGET 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) elseif(CMAKE_SYSTEM_NAME MATCHES "BSD" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set(TARGET X86_FREEBSD) set(TARGET X86_FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 4) 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) file(COPY src/arm/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
elseif ("${TARGET}" MATCHES "MIPS") elseif ("${TARGET}" MATCHES "MIPS")
file(COPY src/mips/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) 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() else()
file(COPY src/x86/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include) file(COPY src/x86/ffitarget.h DESTINATION ${CMAKE_BINARY_DIR}/include)
endif() endif()
@ -93,6 +97,10 @@ elseif("${TARGET}" MATCHES "MIPS")
set(FFI_SOURCES set(FFI_SOURCES
${FFI_SOURCES} ${FFI_SOURCES}
src/mips/ffi.c) src/mips/ffi.c)
elseif("${TARGET}" STREQUAL "RISCV")
set(FFI_SOURCES
${FFI_SOURCES}
src/riscv/ffi.c)
else() else()
set(FFI_SOURCES set(FFI_SOURCES
${FFI_SOURCES} ${FFI_SOURCES}
@ -199,6 +207,8 @@ elseif("${TARGET}" STREQUAL "ARM64")
add_assembly(src/aarch64/sysv.S) add_assembly(src/aarch64/sysv.S)
elseif("${TARGET}" MATCHES "MIPS") elseif("${TARGET}" MATCHES "MIPS")
add_assembly(src/mips/n32.S) add_assembly(src/mips/n32.S)
elseif("${TARGET}" MATCHES "RISCV")
add_assembly(src/riscv/sysv.S)
else() else()
message(FATAL_ERROR "Target not implemented") message(FATAL_ERROR "Target not implemented")
endif() endif()

View File

@ -1,6 +1,7 @@
{ {
"name": "libffi", "name": "libffi",
"version": "3.4.4", "version": "3.4.4",
"port-version": 1,
"description": "Portable, high level programming interface to various calling conventions", "description": "Portable, high level programming interface to various calling conventions",
"homepage": "https://github.com/libffi/libffi", "homepage": "https://github.com/libffi/libffi",
"license": "MIT", "license": "MIT",

View File

@ -3882,7 +3882,7 @@
}, },
"libffi": { "libffi": {
"baseline": "3.4.4", "baseline": "3.4.4",
"port-version": 0 "port-version": 1
}, },
"libfido2": { "libfido2": {
"baseline": "1.10.0", "baseline": "1.10.0",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "2422375e9ac93e01de0b511e1181000c340da613",
"version": "3.4.4",
"port-version": 1
},
{ {
"git-tree": "6552925531e923480b50d806c7d4538c1ff15481", "git-tree": "6552925531e923480b50d806c7d4538c1ff15481",
"version": "3.4.4", "version": "3.4.4",