diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f274197575f0aa366f23a678db66997fdba53e3..7c4dc518a629540318c25e254b7afc256248cb7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Added code to correct fork issues. `pthread_at_fork` cleans and starts GekkoFS ([!210](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/210)). - Updated mochi to solve ucx corruption issues ([!211])(https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/211)). - Update capstone to version 6.0.0-Alpha1 and syscall intercept to match ([!215](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/215)). +- Update ARM version and make user library optional in cmake ([!330](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/330)) + ### Fixed ## [0.9.3] - 2024-07 diff --git a/CMake/gkfs-options.cmake b/CMake/gkfs-options.cmake index 07891c69bc00b36ca90fc8c7321a181e7a25aa10..1f4688cf0760fbe415b0baffa3dc9860e46d60b1 100644 --- a/CMake/gkfs-options.cmake +++ b/CMake/gkfs-options.cmake @@ -234,6 +234,12 @@ gkfs_define_option( DEFAULT_VALUE OFF ) +#build user_lib +gkfs_define_option( + GKFS_BUILD_USER_LIB + HELP_TEXT "Compile user lib" + DEFAULT_VALUE ON +) # use old resolve function gkfs_define_option( diff --git a/examples/user_library/CMakeLists.txt b/examples/user_library/CMakeLists.txt index ee8d915ab6bec3234bc222ab4e68de7e8537575b..40d76503a37c648f5188bd7d5c69be5d5398575d 100644 --- a/examples/user_library/CMakeLists.txt +++ b/examples/user_library/CMakeLists.txt @@ -27,6 +27,7 @@ ################################################################################ set(CMAKE_CXX_STANDARD 17) +if (GKFS_BUILD_USER_LIB) add_executable(gkfs_lib_example gkfs_lib_example.cpp) target_link_libraries(gkfs_lib_example @@ -36,4 +37,5 @@ if (GKFS_INSTALL_TESTS) install(TARGETS gkfs_lib_example DESTINATION ${CMAKE_INSTALL_BINDIR} ) +endif () endif () \ No newline at end of file diff --git a/include/client/CMakeLists.txt b/include/client/CMakeLists.txt index 6d3594b0ae6b420b642dd0ae250198964556cc8e..d56e1c52ee5535935813655b12786514d583a3a0 100644 --- a/include/client/CMakeLists.txt +++ b/include/client/CMakeLists.txt @@ -55,6 +55,7 @@ target_sources( syscalls/detail/syscall_info.h ) +if (GKFS_BUILD_USER_LIB) target_sources( gkfs_user_lib PUBLIC gkfs_functions.hpp @@ -84,3 +85,4 @@ target_sources( void_syscall_intercept.hpp user_functions.hpp ) +endif() \ No newline at end of file diff --git a/scripts/profiles/0.9.4/arm.specs b/scripts/profiles/0.9.4/arm.specs index 39d609c273be62d17d767934645e52979c9bd20c..3a9b1c9be658a678ed37e186a1c5eb7f55e5e533 100644 --- a/scripts/profiles/0.9.4/arm.specs +++ b/scripts/profiles/0.9.4/arm.specs @@ -50,7 +50,7 @@ clonedeps=( ["libfabric"]="HEAD@v1.20.1" ["mercury"]="v2.4.0" ["margo"]="v0.18.3" - ["syscall_intercept"]="34a41033fce94195700c5ab1e097f40741d7f016" + ["syscall_intercept"]="88043bdbbc60801d4fbe0076962ed1a766ba4800" ) # Extra arguments for git clone diff --git a/scripts/profiles/0.9.4/install/syscall_intercept.install b/scripts/profiles/0.9.4/install/syscall_intercept.install index 03a27be53a05678c00a461c7df7cb9670951e572..f47185c9f2d18346d17f9de8be5a5039dea69087 100644 --- a/scripts/profiles/0.9.4/install/syscall_intercept.install +++ b/scripts/profiles/0.9.4/install/syscall_intercept.install @@ -60,6 +60,7 @@ pkg_install() { -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \ -DCMAKE_BUILD_TYPE:STRING=Debug \ -DBUILD_EXAMPLES:BOOL=OFF \ + -DSTATIC_CAPSTONE:BOOL=OFF \ -DBUILD_TESTS:BOOK=OFF .. make -j"${CORES}" install if [[ ${EXTRA_INSTALL_ARGS} == "ARM64" ]]; then diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index c31abeedcfe4b304288e5eeafb3b0359bfa79d44..af5f0a356669e87dfbba5bb8809358d70a704e99 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -33,8 +33,6 @@ # ############################################################################## add_library(gkfs_intercept SHARED) -add_library(gkfs_user_lib SHARED) - target_sources(gkfs_intercept PRIVATE gkfs_functions.cpp @@ -56,6 +54,8 @@ target_sources(gkfs_intercept rpc/forward_metadata_proxy.cpp syscalls/detail/syscall_info.c) +if (GKFS_BUILD_USER_LIB) +add_library(gkfs_user_lib SHARED) target_sources( gkfs_user_lib PRIVATE gkfs_functions.cpp @@ -82,6 +82,7 @@ target_sources( target_compile_definitions(gkfs_user_lib PUBLIC BYPASS_SYSCALL) target_link_options(gkfs_user_lib PRIVATE -z noexecstack) +endif() if (GKFS_ENABLE_AGIOS) target_compile_definitions(gkfs_intercept PUBLIC GKFS_ENABLE_AGIOS) @@ -109,6 +110,7 @@ if (GKFS_ENABLE_CLIENT_METRICS) target_compile_definitions(gkfs_intercept PUBLIC GKFS_ENABLE_CLIENT_METRICS) endif () +if (GKFS_BUILD_USER_LIB) target_link_libraries( gkfs_user_lib PRIVATE metadata distributor env_util arithmetic path_util rpc_utils @@ -120,14 +122,6 @@ target_link_libraries( Microsoft.GSL::GSL ) -install( - TARGETS gkfs_intercept - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gkfs -) - - set_target_properties(gkfs_user_lib PROPERTIES PUBLIC_HEADER "../../include/client/void_syscall_intercept.hpp" @@ -141,3 +135,13 @@ install( ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gkfs ) +endif() + +install( + TARGETS gkfs_intercept + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/gkfs +) + + diff --git a/src/client/syscalls/util.S b/src/client/syscalls/util.S index 67c9b279afdcad35a0409dd800c392f079029956..83abcdd9a35475092a030dce4c71f77847c8bd84 100644 --- a/src/client/syscalls/util.S +++ b/src/client/syscalls/util.S @@ -36,14 +36,35 @@ .text syscall_no_intercept: - movq %rdi, %rax /* convert from linux ABI calling */ +#ifdef __riscv + mv a7, a0 /* convert from linux ABI calling */ + mv a0, a1 /* convention to syscall calling convention */ + mv a1, a2 + mv a2, a3 + mv a3, a4 + mv a4, a5 + mv a5, a6 + ecall +#elif __aarch64__ + uxtw x8, w0 /* convert from linux ABI calling */ + mov x0, x1 /* convention to syscall calling convention */ + mov x1, x2 + mov x2, x3 + mov x3, x4 + mov x4, x5 + mov x5, x6 + mov x6, x7 /* following aarch64 glibc calling convention */ + svc #0x0 + ret +#else + movq %rdi, %rax /* convert from linux ABI calling */ movq %rsi, %rdi /* convention to syscall calling convention */ movq %rdx, %rsi - movq %rcx, %rdx + movq %rcx, %rdx movq %r8, %r10 movq %r9, %r8 movq 8(%rsp), %r9 syscall - ret +#endif .size syscall_no_intercept, .-syscall_no_intercept diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 210446e8bc32e8a5fb86ed1078a8bbbd78a3b314..86ee83bf87677544796148e2ceab127f065eb625 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -70,6 +70,7 @@ if (GKFS_TESTS_GUIDED_DISTRIBUTION) target_sources(tests PRIVATE ${CMAKE_CURRENT_LIST_DIR}/test_guided_distributor.cpp) endif () +if (GKFS_BUILD_USER_LIB) target_link_libraries(tests PRIVATE catch2_main @@ -79,6 +80,16 @@ target_link_libraries(tests distributor gkfs_user_lib ) +else () +target_link_libraries(tests + PRIVATE + catch2_main + fmt::fmt + helpers + arithmetic + distributor +) +endif() # Catch2's contrib folder includes some helper functions # to auto-discover Catch tests and register them in CTest