From a1c61962a1c2d5d14f0a28dd9b2f52b8d4a7cfa6 Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Thu, 10 Oct 2024 13:20:50 -0700 Subject: [PATCH] Workaround lack of musttail in gcc --- CMakeLists.txt | 5 +++++ test_conflict_set.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c5327f..b5e8406 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,11 @@ if(NOT APPLE) add_compile_options(-g -fno-omit-frame-pointer) endif() +# work around lack of musttail for gcc +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_BUILD_TYPE STREQUAL "Debug") + add_compile_options(-O1 -foptimize-sibling-calls) +endif() + set(full_relro_flags "-pie;LINKER:-z,relro,-z,now,-z,noexecstack") cmake_push_check_state() list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${full_relro_flags}) diff --git a/test_conflict_set.py b/test_conflict_set.py index c18f83b..468271b 100644 --- a/test_conflict_set.py +++ b/test_conflict_set.py @@ -164,6 +164,12 @@ def test_fixup_256(): cs.check(read(0, bytes([1]), bytes([2]))) +def test_tailcall(): + with DebugConflictSet() as cs: + cs.addWrites(0, write(bytes([1]))) + cs.check(*[read(0, bytes([1])) for _ in range(100000)]) + + if __name__ == "__main__": # budget "pytest" for ctest integration without pulling in a dependency. You can of course still use pytest in local development. import argparse