From f6c51ea84ac914454142ee76f317c5f66a088434 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 9 Dec 2024 13:38:07 +1100 Subject: [PATCH] [ORC-RT] Fix unit tests on Linux. The unit tests may transiently depend on __orc_rt_log_error, which is usually provided by an alias when loading the runtime through the JIT. The unit tests statically link the runtime, so this patch provides a fixed definition. --- compiler-rt/lib/orc/tests/unit/CMakeLists.txt | 1 + compiler-rt/lib/orc/tests/unit/common.cpp | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 compiler-rt/lib/orc/tests/unit/common.cpp diff --git a/compiler-rt/lib/orc/tests/unit/CMakeLists.txt b/compiler-rt/lib/orc/tests/unit/CMakeLists.txt index aec689a407be6e..16cd16c45683df 100644 --- a/compiler-rt/lib/orc/tests/unit/CMakeLists.txt +++ b/compiler-rt/lib/orc/tests/unit/CMakeLists.txt @@ -2,6 +2,7 @@ set(UNITTEST_SOURCES adt_test.cpp bitmask_enum_test.cpp c_api_test.cpp + common.cpp endian_test.cpp error_test.cpp executor_address_test.cpp diff --git a/compiler-rt/lib/orc/tests/unit/common.cpp b/compiler-rt/lib/orc/tests/unit/common.cpp new file mode 100644 index 00000000000000..9479cc80943085 --- /dev/null +++ b/compiler-rt/lib/orc/tests/unit/common.cpp @@ -0,0 +1,6 @@ +#include + +/// Defined so that tests can use code that logs errors. +extern "C" void __orc_rt_log_error(const char *ErrMsg) { + fprintf(stderr, "orc runtime error: %s\n", ErrMsg); +}