forked from OSchip/llvm-project
[libc] Link the SCUDO integration tests to a special entrypoint collection.
We were previously linking to libllvmlibc.a. But, with libllvmlibc.a now including functions which depend on the loader, we will have to use the LLVM libc loader as well. To avoid this, we will link to a special library which is just a collection of SCUDO allocator entrypoints. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D122360
This commit is contained in:
parent
b0f1f3b95c
commit
316f9fd638
|
@ -2,6 +2,22 @@ if(NOT LLVM_LIBC_INCLUDE_SCUDO)
|
|||
return()
|
||||
endif()
|
||||
|
||||
# We use a special library consisting of only the SCUDO allocator
|
||||
# functions to link to the integration tests below. We could instead
|
||||
# link to libllvmlibc.a directly, but since libllvmlibc.a contains
|
||||
# functions which depend on the LLVM libc loader, the integration
|
||||
# test will have to link to the LLVM libc loader. LLVM libc's loader
|
||||
# is not complete enough to allow this. It is also desireable to
|
||||
# keep the dependencies as minimal as possible.
|
||||
add_entrypoint_library(
|
||||
libc_for_scudo_integration_test
|
||||
DEPENDS
|
||||
libc.src.stdlib.malloc
|
||||
libc.src.stdlib.calloc
|
||||
libc.src.stdlib.realloc
|
||||
libc.src.stdlib.free
|
||||
)
|
||||
|
||||
add_executable(
|
||||
libc-scudo-integration-test
|
||||
integration_test.cpp
|
||||
|
@ -10,14 +26,12 @@ add_executable(
|
|||
target_link_options(
|
||||
libc-scudo-integration-test
|
||||
PRIVATE
|
||||
# TODO: Uncomment "-nolibc" once llvm-libc is complete enough.
|
||||
# "-nolibc"
|
||||
-pthreads
|
||||
)
|
||||
|
||||
target_link_libraries(libc-scudo-integration-test
|
||||
PRIVATE
|
||||
llvmlibc
|
||||
libc_for_scudo_integration_test
|
||||
)
|
||||
|
||||
add_executable(
|
||||
|
@ -28,14 +42,12 @@ add_executable(
|
|||
target_link_options(
|
||||
libc-gwp-asan-uaf-should-crash
|
||||
PRIVATE
|
||||
# TODO: Uncomment "-nolibc" once llvm-libc is complete enough.
|
||||
# "-nolibc"
|
||||
-pthreads
|
||||
)
|
||||
|
||||
target_link_libraries(libc-gwp-asan-uaf-should-crash
|
||||
PRIVATE
|
||||
llvmlibc
|
||||
libc_for_scudo_integration_test
|
||||
)
|
||||
|
||||
add_custom_command(TARGET libc-scudo-integration-test
|
||||
|
|
Loading…
Reference in New Issue