mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Support AArch64 and PPC64 in third party dependencies
PiperOrigin-RevId: 338992825 Change-Id: I2f77ea8379e55007a22ad0461efc98f41a01ad44
This commit is contained in:
parent
28bb32add6
commit
19a8e38a51
|
@ -87,10 +87,9 @@ if(UNIX)
|
|||
-Wno-psabi)
|
||||
check_cxx_compiler_flag(${flag} _sapi_has_flag)
|
||||
if(_sapi_has_flag)
|
||||
target_compile_options(sapi_base INTERFACE
|
||||
${flag}
|
||||
)
|
||||
target_compile_options(sapi_base INTERFACE ${flag})
|
||||
endif()
|
||||
unset(_sapi_has_flag)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -36,6 +36,39 @@ set(_ffi_src "${CMAKE_BINARY_DIR}/libffi-src")
|
|||
|
||||
set(libffi_INCLUDE_DIR ${_ffi_src}/libffi/include)
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
list(APPEND _ffi_platform_srcs
|
||||
${_ffi_src}/src/x86/asmnames.h
|
||||
${_ffi_src}/src/x86/ffi.c
|
||||
${_ffi_src}/src/x86/ffi64.c
|
||||
${_ffi_src}/src/x86/ffiw64.c
|
||||
${_ffi_src}/src/x86/internal.h
|
||||
${_ffi_src}/src/x86/internal64.h
|
||||
${_ffi_src}/src/x86/sysv.S
|
||||
${_ffi_src}/src/x86/unix64.S
|
||||
${_ffi_src}/src/x86/win64.S
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64")
|
||||
list(APPEND _ffi_platform_srcs
|
||||
${_ffi_src}/src/powerpc/ffi.c
|
||||
${_ffi_src}/src/powerpc/ffi_linux64.c
|
||||
${_ffi_src}/src/powerpc/ffi_sysv.c
|
||||
${_ffi_src}/src/powerpc/linux64.S
|
||||
${_ffi_src}/src/powerpc/linux64_closure.S
|
||||
${_ffi_src}/src/powerpc/ppc_closure.S
|
||||
${_ffi_src}/src/powerpc/sysv.S
|
||||
# Textual headers
|
||||
${_ffi_src}/src/powerpc/ffi_powerpc.h
|
||||
${_ffi_src}/src/powerpc/asm.h
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
|
||||
list(APPEND _ffi_platform_srcs
|
||||
${_ffi_src}/src/aarch64/ffi.c
|
||||
${_ffi_src}/src/aarch64/internal.h
|
||||
${_ffi_src}/src/aarch64/sysv.S
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(ffi STATIC
|
||||
${_ffi_src}/fficonfig.h
|
||||
${_ffi_src}/include/ffi.h
|
||||
|
@ -48,15 +81,7 @@ add_library(ffi STATIC
|
|||
${_ffi_src}/src/prep_cif.c
|
||||
${_ffi_src}/src/raw_api.c
|
||||
${_ffi_src}/src/types.c
|
||||
${_ffi_src}/src/x86/asmnames.h
|
||||
${_ffi_src}/src/x86/ffi.c
|
||||
${_ffi_src}/src/x86/ffi64.c
|
||||
${_ffi_src}/src/x86/ffiw64.c
|
||||
${_ffi_src}/src/x86/internal.h
|
||||
${_ffi_src}/src/x86/internal64.h
|
||||
${_ffi_src}/src/x86/sysv.S
|
||||
${_ffi_src}/src/x86/unix64.S
|
||||
${_ffi_src}/src/x86/win64.S
|
||||
${_ffi_platform_srcs}
|
||||
)
|
||||
add_library(libffi::libffi ALIAS ffi)
|
||||
target_include_directories(ffi PUBLIC
|
||||
|
|
|
@ -33,6 +33,58 @@ if(error)
|
|||
endif()
|
||||
|
||||
set(_unwind_src "${CMAKE_BINARY_DIR}/libunwind-src")
|
||||
|
||||
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
||||
set(_unwind_cpu "x86_64")
|
||||
list(APPEND _unwind_platform_srcs
|
||||
${_unwind_src}/src/x86_64/Gcreate_addr_space.c
|
||||
${_unwind_src}/src/x86_64/Gglobal.c
|
||||
${_unwind_src}/src/x86_64/Ginit.c
|
||||
${_unwind_src}/src/x86_64/Gos-linux.c
|
||||
${_unwind_src}/src/x86_64/Gregs.c
|
||||
${_unwind_src}/src/x86_64/Gresume.c
|
||||
${_unwind_src}/src/x86_64/Gstash_frame.c
|
||||
${_unwind_src}/src/x86_64/Gstep.c
|
||||
${_unwind_src}/src/x86_64/is_fpreg.c
|
||||
${_unwind_src}/src/x86_64/setcontext.S
|
||||
)
|
||||
list(APPEND _unwind_ptrace_srcs
|
||||
${_unwind_src}/src/x86_64/Ginit_remote.c
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "ppc64")
|
||||
set(_unwind_cpu "ppc64")
|
||||
list(APPEND _unwind_platform_srcs
|
||||
${_unwind_src}/src/ppc/Gis_signal_frame.c
|
||||
${_unwind_src}/src/ppc64/Gcreate_addr_space.c
|
||||
${_unwind_src}/src/ppc64/Gglobal.c
|
||||
${_unwind_src}/src/ppc64/Ginit.c
|
||||
${_unwind_src}/src/ppc64/Gregs.c
|
||||
${_unwind_src}/src/ppc64/Gresume.c
|
||||
${_unwind_src}/src/ppc64/Gstep.c
|
||||
${_unwind_src}/src/ppc64/get_func_addr.c
|
||||
${_unwind_src}/src/ppc64/is_fpreg.c
|
||||
)
|
||||
list(APPEND _unwind_ptrace_srcs
|
||||
${_unwind_src}/src/ppc/Ginit_remote.c
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
|
||||
set(_unwind_cpu "aarch64")
|
||||
list(APPEND _unwind_platform_srcs
|
||||
${_unwind_src}/src/aarch64/Gcreate_addr_space.c
|
||||
${_unwind_src}/src/aarch64/Gglobal.c
|
||||
${_unwind_src}/src/aarch64/Ginit.c
|
||||
${_unwind_src}/src/aarch64/Gis_signal_frame.c
|
||||
${_unwind_src}/src/aarch64/Gregs.c
|
||||
${_unwind_src}/src/aarch64/Gresume.c
|
||||
${_unwind_src}/src/aarch64/Gstash_frame.c
|
||||
${_unwind_src}/src/aarch64/Gstep.c
|
||||
${_unwind_src}/src/aarch64/is_fpreg.c
|
||||
)
|
||||
list(APPEND _unwind_ptrace_srcs
|
||||
${_unwind_src}/src/aarch64/Ginit_remote.c
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(unwind_ptrace_wrapped STATIC
|
||||
# internal_headers
|
||||
${_unwind_src}/include/compiler.h
|
||||
|
@ -86,16 +138,7 @@ add_library(unwind_ptrace_wrapped STATIC
|
|||
${_unwind_src}/src/mi/init.c
|
||||
${_unwind_src}/src/mi/mempool.c
|
||||
${_unwind_src}/src/os-linux.c
|
||||
${_unwind_src}/src/x86_64/Gcreate_addr_space.c
|
||||
${_unwind_src}/src/x86_64/Gglobal.c
|
||||
${_unwind_src}/src/x86_64/Ginit.c
|
||||
${_unwind_src}/src/x86_64/Gos-linux.c
|
||||
${_unwind_src}/src/x86_64/Gregs.c
|
||||
${_unwind_src}/src/x86_64/Gresume.c
|
||||
${_unwind_src}/src/x86_64/Gstash_frame.c
|
||||
${_unwind_src}/src/x86_64/Gstep.c
|
||||
${_unwind_src}/src/x86_64/is_fpreg.c
|
||||
${_unwind_src}/src/x86_64/setcontext.S
|
||||
${_unwind_platform_srcs}
|
||||
# srcs
|
||||
${_unwind_src}/src/mi/Gdyn-remote.c
|
||||
${_unwind_src}/src/ptrace/_UPT_access_fpreg.c
|
||||
|
@ -116,7 +159,7 @@ add_library(unwind_ptrace_wrapped STATIC
|
|||
${_unwind_src}/include/config.h
|
||||
${_unwind_src}/include/libunwind.h
|
||||
# source_ptrace
|
||||
${_unwind_src}/src/x86_64/Ginit_remote.c
|
||||
${_unwind_ptrace_srcs}
|
||||
)
|
||||
add_library(unwind::unwind_ptrace_wrapped ALIAS unwind_ptrace_wrapped)
|
||||
target_include_directories(unwind_ptrace_wrapped PUBLIC
|
||||
|
@ -135,12 +178,14 @@ target_compile_definitions(unwind_ptrace_wrapped
|
|||
PUBLIC -D_UPT_accessors=_UPT_accessors_wrapped
|
||||
-D_UPT_create=_UPT_create_wrapped
|
||||
-D_UPT_destroy=_UPT_destroy_wrapped
|
||||
-D_Ux86_64_create_addr_space=_Ux86_64_create_addr_space_wrapped
|
||||
-D_Ux86_64_destroy_addr_space=_Ux86_64_destroy_addr_space_wrapped
|
||||
-D_Ux86_64_get_proc_name=_Ux86_64_get_proc_name_wrapped
|
||||
-D_Ux86_64_get_reg=_Ux86_64_get_reg_wrapped
|
||||
-D_Ux86_64_init_remote=_Ux86_64_init_remote_wrapped
|
||||
-D_Ux86_64_step=_Ux86_64_step_wrapped
|
||||
|
||||
-D_U${_unwind_cpu}_create_addr_space=_U${_unwind_cpu}_create_addr_space_wrapped
|
||||
-D_U${_unwind_cpu}_destroy_addr_space=_U${_unwind_cpu}_destroy_addr_space_wrapped
|
||||
-D_U${_unwind_cpu}_get_proc_name=_U${_unwind_cpu}_get_proc_name_wrapped
|
||||
-D_U${_unwind_cpu}_get_reg=_U${_unwind_cpu}_get_reg_wrapped
|
||||
-D_U${_unwind_cpu}_init_remote=_U${_unwind_cpu}_init_remote_wrapped
|
||||
-D_U${_unwind_cpu}_step=_U${_unwind_cpu}_step_wrapped
|
||||
|
||||
-Dptrace=ptrace_wrapped
|
||||
)
|
||||
target_link_libraries(unwind_ptrace_wrapped PRIVATE
|
||||
|
|
47
sandboxed_api/bazel/external/libffi.BUILD
vendored
47
sandboxed_api/bazel/external/libffi.BUILD
vendored
|
@ -15,26 +15,45 @@
|
|||
cc_library(
|
||||
name = "libffi",
|
||||
srcs = [
|
||||
"configure-bazel-gen/fficonfig.h",
|
||||
"configure-bazel-gen/include/ffi.h",
|
||||
"configure-bazel-gen/include/ffitarget.h",
|
||||
"include/ffi_cfi.h",
|
||||
"include/ffi_common.h",
|
||||
"src/closures.c",
|
||||
"src/debug.c",
|
||||
"src/java_raw_api.c",
|
||||
"src/prep_cif.c",
|
||||
"src/raw_api.c",
|
||||
"src/types.c",
|
||||
"src/x86/asmnames.h",
|
||||
"src/x86/ffi.c",
|
||||
"src/x86/ffi64.c",
|
||||
"src/x86/ffiw64.c",
|
||||
"src/x86/internal.h",
|
||||
"src/x86/internal64.h",
|
||||
"src/x86/sysv.S",
|
||||
"src/x86/unix64.S",
|
||||
"src/x86/win64.S",
|
||||
] + select({
|
||||
"@bazel_tools//src/conditions:linux_x86_64": [
|
||||
"src/x86/asmnames.h",
|
||||
"src/x86/ffi.c",
|
||||
"src/x86/ffi64.c",
|
||||
"src/x86/ffiw64.c",
|
||||
"src/x86/internal.h",
|
||||
"src/x86/internal64.h",
|
||||
"src/x86/sysv.S",
|
||||
"src/x86/unix64.S",
|
||||
"src/x86/win64.S",
|
||||
],
|
||||
"@bazel_tools//src/conditions:linux_ppc": [
|
||||
"src/powerpc/ffi.c",
|
||||
"src/powerpc/ffi_linux64.c",
|
||||
"src/powerpc/ffi_sysv.c",
|
||||
"src/powerpc/linux64.S",
|
||||
"src/powerpc/linux64_closure.S",
|
||||
"src/powerpc/ppc_closure.S",
|
||||
"src/powerpc/sysv.S",
|
||||
],
|
||||
"@bazel_tools//src/conditions:linux_aarch64": [
|
||||
"src/aarch64/ffi.c",
|
||||
"src/aarch64/internal.h",
|
||||
"src/aarch64/sysv.S",
|
||||
],
|
||||
}),
|
||||
hdrs = [
|
||||
"configure-bazel-gen/fficonfig.h",
|
||||
"configure-bazel-gen/include/ffi.h",
|
||||
"configure-bazel-gen/include/ffitarget.h",
|
||||
"include/ffi_cfi.h",
|
||||
"include/ffi_common.h",
|
||||
],
|
||||
copts = [
|
||||
# libffi-3.3-rc0 uses variable length arrays for closures on all
|
||||
|
|
Loading…
Reference in New Issue
Block a user