[compiler-rt] f6c51ea - [ORC-RT] Fix unit tests on Linux.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 8 18:42:18 PST 2024


Author: Lang Hames
Date: 2024-12-09T13:41:24+11:00
New Revision: f6c51ea84ac914454142ee76f317c5f66a088434

URL: https://github.com/llvm/llvm-project/commit/f6c51ea84ac914454142ee76f317c5f66a088434
DIFF: https://github.com/llvm/llvm-project/commit/f6c51ea84ac914454142ee76f317c5f66a088434.diff

LOG: [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.

Added: 
    compiler-rt/lib/orc/tests/unit/common.cpp

Modified: 
    compiler-rt/lib/orc/tests/unit/CMakeLists.txt

Removed: 
    


################################################################################
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 <stdio.h>
+
+/// 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);
+}


        


More information about the llvm-commits mailing list