From 99b70a1d7e2ec504873ed04517ba62f660f996bf Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Tue, 24 Mar 2026 21:54:35 +0100 Subject: [PATCH] Add sem_dir argument to lifter cli --- tests/X86/CMakeLists.txt | 4 +++- tests/X86/Lift.cpp | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/X86/CMakeLists.txt b/tests/X86/CMakeLists.txt index 5f0c61ba..72526ef7 100644 --- a/tests/X86/CMakeLists.txt +++ b/tests/X86/CMakeLists.txt @@ -46,7 +46,9 @@ function(COMPILE_X86_TESTS name address_size has_avx has_avx512) add_custom_command( OUTPUT tests_${name}.bc - COMMAND lift-${name}-tests --arch ${name} --bc_out tests_${name}.bc + COMMAND lift-${name}-tests --arch ${name} + --sem_dir ${CMAKE_BINARY_DIR}/lib/Arch/X86/Runtime + --bc_out tests_${name}.bc DEPENDS semantics lift-${name}-tests ${name} ) diff --git a/tests/X86/Lift.cpp b/tests/X86/Lift.cpp index 876ad0c3..6cedfd99 100644 --- a/tests/X86/Lift.cpp +++ b/tests/X86/Lift.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -57,6 +58,9 @@ DEFINE_string(arch, REMILL_ARCH, "Architecture of the code being translated. " "Valid architectures: x86, amd64 (with or without " "`_avx` or `_avx512` appended), aarch64, aarch32"); +DEFINE_string(sem_dir, "", + "Directory containing architecture semantics bitcode to prefer " + "when lifting tests."); namespace { @@ -127,7 +131,14 @@ extern "C" int main(int argc, char *argv[]) { auto os_name = remill::GetOSName(REMILL_OS); auto arch_name = remill::GetArchName(FLAGS_arch); auto arch = remill::Arch::Build(&context, os_name, arch_name); - auto module = remill::LoadArchSemantics(arch.get()); + + std::unique_ptr module; + if (!FLAGS_sem_dir.empty()) { + module = remill::LoadArchSemantics( + arch.get(), std::vector{FLAGS_sem_dir}); + } else { + module = remill::LoadArchSemantics(arch.get()); + } remill::IntrinsicTable intrinsics(module.get()); remill::TraceLifter trace_lifter(arch.get(), manager);