1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

Tests: Add test for dlsym(RTLD_DEFAULT) for symbols from dlopen'd libs

This broke with recent changes to library loading and mapping order.
This commit is contained in:
Andrew Kaster 2022-06-24 01:59:34 -06:00 committed by Linus Groh
parent 6732fec8b8
commit a0eb0a275d
2 changed files with 29 additions and 1 deletions

View file

@ -1,3 +1,4 @@
set(CMAKE_SKIP_RPATH FALSE)
macro(add_dlopen_lib NAME FUNCTION)
add_library(${NAME} SHARED Dynlib.cpp)
target_compile_definitions(${NAME} PRIVATE -DFUNCTION=${FUNCTION})
@ -6,11 +7,17 @@ macro(add_dlopen_lib NAME FUNCTION)
# Avoid execution by the test runner
install(TARGETS ${NAME}
DESTINATION usr/Tests/LibELF
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE GROUP_WRITE)
endmacro()
add_dlopen_lib(DynlibA dynliba_function)
add_dlopen_lib(DynlibB dynlibb_function)
add_dlopen_lib(DynlibC dynlibc_function)
set(CMAKE_INSTALL_RPATH $ORIGIN)
add_dlopen_lib(DynlibD dynlibd_function)
target_link_libraries(DynlibD DynlibC)
unset(CMAKE_INSTALL_RPATH)
set(TEST_SOURCES
test-elf.cpp
TestDlOpen.cpp