|
25 | 25 |
|
26 | 26 | #include <algorithm> |
27 | 27 | #include <cstdint> |
| 28 | +#include <filesystem> |
28 | 29 | #include <fstream> |
29 | 30 | #include <map> |
30 | 31 | #include <memory> |
@@ -57,6 +58,9 @@ DEFINE_string(arch, REMILL_ARCH, |
57 | 58 | "Architecture of the code being translated. " |
58 | 59 | "Valid architectures: x86, amd64 (with or without " |
59 | 60 | "`_avx` or `_avx512` appended), aarch64, aarch32"); |
| 61 | +DEFINE_string(sem_dir, "", |
| 62 | + "Directory containing architecture semantics bitcode to prefer " |
| 63 | + "when lifting tests."); |
60 | 64 |
|
61 | 65 | namespace { |
62 | 66 |
|
@@ -127,7 +131,14 @@ extern "C" int main(int argc, char *argv[]) { |
127 | 131 | auto os_name = remill::GetOSName(REMILL_OS); |
128 | 132 | auto arch_name = remill::GetArchName(FLAGS_arch); |
129 | 133 | auto arch = remill::Arch::Build(&context, os_name, arch_name); |
130 | | - auto module = remill::LoadArchSemantics(arch.get()); |
| 134 | + |
| 135 | + std::unique_ptr<llvm::Module> module; |
| 136 | + if (!FLAGS_sem_dir.empty()) { |
| 137 | + module = remill::LoadArchSemantics( |
| 138 | + arch.get(), std::vector<std::filesystem::path>{FLAGS_sem_dir}); |
| 139 | + } else { |
| 140 | + module = remill::LoadArchSemantics(arch.get()); |
| 141 | + } |
131 | 142 |
|
132 | 143 | remill::IntrinsicTable intrinsics(module.get()); |
133 | 144 | remill::TraceLifter trace_lifter(arch.get(), manager); |
|
0 commit comments