mirror of
https://github.com/google/sandboxed-api.git
synced 2024-03-22 13:11:30 +08:00
Simplify libunwind build files
Sandbox2 and SAPI only use the `unwind-ptrace-wrapped` target. PiperOrigin-RevId: 338450188 Change-Id: Iee7d7aeda244cad90dae8b5228316f506efc3deb
This commit is contained in:
parent
cba334a9d1
commit
040d76be28
@ -59,7 +59,6 @@ endif()
|
||||
if(SAPI_DOWNLOAD_LIBUNWIND)
|
||||
include(cmake/libunwind/Download.cmake)
|
||||
endif()
|
||||
check_target(unwind_ptrace)
|
||||
check_target(unwind_ptrace_wrapped)
|
||||
|
||||
if(SAPI_DOWNLOAD_GFLAGS)
|
||||
|
@ -33,8 +33,7 @@ if(error)
|
||||
endif()
|
||||
|
||||
set(_unwind_src "${CMAKE_BINARY_DIR}/libunwind-src")
|
||||
foreach(wrapped _wrapped "")
|
||||
add_library(unwind_ptrace${wrapped} STATIC
|
||||
add_library(unwind_ptrace_wrapped STATIC
|
||||
# internal_headers
|
||||
${_unwind_src}/include/compiler.h
|
||||
${_unwind_src}/include/config.h
|
||||
@ -118,29 +117,22 @@ foreach(wrapped _wrapped "")
|
||||
${_unwind_src}/include/libunwind.h
|
||||
# source_ptrace
|
||||
${_unwind_src}/src/x86_64/Ginit_remote.c
|
||||
)
|
||||
add_library(unwind::unwind_ptrace${wrapped} ALIAS unwind_ptrace${wrapped})
|
||||
target_include_directories(unwind_ptrace${wrapped} PUBLIC
|
||||
)
|
||||
add_library(unwind::unwind_ptrace_wrapped ALIAS unwind_ptrace_wrapped)
|
||||
target_include_directories(unwind_ptrace_wrapped PUBLIC
|
||||
${_unwind_src}/include
|
||||
${_unwind_src}/include/tdep
|
||||
${_unwind_src}/src
|
||||
)
|
||||
target_compile_options(unwind_ptrace${wrapped} PRIVATE
|
||||
)
|
||||
target_compile_options(unwind_ptrace_wrapped PRIVATE
|
||||
-fno-common
|
||||
-Wno-cpp
|
||||
)
|
||||
target_compile_definitions(unwind_ptrace${wrapped} PRIVATE
|
||||
-DHAVE_CONFIG_H
|
||||
)
|
||||
target_compile_definitions(unwind_ptrace_wrapped
|
||||
PRIVATE -DHAVE_CONFIG_H
|
||||
-D_GNU_SOURCE
|
||||
-DNO_FRAME_POINTER
|
||||
)
|
||||
target_link_libraries(unwind_ptrace${wrapped} PRIVATE
|
||||
sapi::base
|
||||
sandbox2::ptrace_hook
|
||||
)
|
||||
endforeach()
|
||||
target_compile_definitions(unwind_ptrace_wrapped PUBLIC
|
||||
-D_UPT_accessors=_UPT_accessors_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
|
||||
@ -151,3 +143,7 @@ target_compile_definitions(unwind_ptrace_wrapped PUBLIC
|
||||
-D_Ux86_64_step=_Ux86_64_step_wrapped
|
||||
-Dptrace=ptrace_wrapped
|
||||
)
|
||||
target_link_libraries(unwind_ptrace_wrapped PRIVATE
|
||||
sapi::base
|
||||
sandbox2::ptrace_hook
|
||||
)
|
||||
|
47
sandboxed_api/bazel/external/libunwind.BUILD
vendored
47
sandboxed_api/bazel/external/libunwind.BUILD
vendored
@ -106,8 +106,8 @@ filegroup(
|
||||
srcs = ["src/x86_64/Ginit_remote.c"],
|
||||
)
|
||||
|
||||
[cc_library(
|
||||
name = "unwind-ptrace" + ("-wrapped" if do_wrap else ""),
|
||||
cc_library(
|
||||
name = "unwind-ptrace-wrapped",
|
||||
srcs = [
|
||||
"src/mi/Gdyn-remote.c",
|
||||
"src/ptrace/_UPT_access_fpreg.c",
|
||||
@ -138,30 +138,21 @@ filegroup(
|
||||
# whether we ourselves do or not.
|
||||
"-DNO_FRAME_POINTER",
|
||||
"-fno-common",
|
||||
# Ignore warning in src/ptrace/_UPT_get_dyn_info_list_addr.c
|
||||
"-Wno-cpp",
|
||||
] + (
|
||||
["-D{symbol}={symbol}_wrapped".format(symbol = symbol) for symbol in [
|
||||
"_UPT_accessors",
|
||||
"_UPT_create",
|
||||
"_UPT_destroy",
|
||||
"_Ux86_64_create_addr_space",
|
||||
"_Ux86_64_destroy_addr_space",
|
||||
"_Ux86_64_get_proc_name",
|
||||
"_Ux86_64_get_reg",
|
||||
"_Ux86_64_init_remote",
|
||||
"_Ux86_64_step",
|
||||
"ptrace",
|
||||
]] if do_wrap else []
|
||||
),
|
||||
"-Wno-cpp", # Warning in src/ptrace/_UPT_get_dyn_info_list_addr.c
|
||||
"-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",
|
||||
"-Dptrace=ptrace_wrapped",
|
||||
],
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [":included_sources"] + (
|
||||
["@com_google_sandboxed_api//sandboxed_api/sandbox2/unwind:ptrace_hook"] if do_wrap else []
|
||||
),
|
||||
# This forces a link failure in any target that depends on both
|
||||
# unwind-ptrace and unwind-ptrace-wrapped.
|
||||
alwayslink = 1,
|
||||
) for do_wrap in [
|
||||
True,
|
||||
False,
|
||||
]]
|
||||
deps = [
|
||||
":included_sources",
|
||||
"@com_google_sandboxed_api//sandboxed_api/sandbox2/unwind:ptrace_hook",
|
||||
],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user