[compiler-rt] 7c07863 - [ORC-RT] Test basic C++ static initialization support in the ORC runtime.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 20 23:20:50 PST 2024


Author: Lang Hames
Date: 2024-11-21T18:20:43+11:00
New Revision: 7c0786363e6b14e05a868cfe7614074cf742e7cc

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

LOG: [ORC-RT] Test basic C++ static initialization support in the ORC runtime.

This tests that a simple C++ static initializer works as expected.

Compared to the architecture specific, assembly level regression tests for the
ORC runtime; this test is expected to catch cases where the compiler adopts
some new MachO feature that the ORC runtime does not yet support (e.g. a new
initializer section).

Added: 
    compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp b/compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp
new file mode 100644
index 00000000000000..c3c9cad6342bc6
--- /dev/null
+++ b/compiler-rt/test/orc/TestCases/Darwin/Generic/trivial-cxx-constructor.cpp
@@ -0,0 +1,17 @@
+// RUN: %clangxx -c -o %t %s
+// RUN: %llvm_jitlink %t
+//
+// REQUIRES: system-darwin && host-arch-compatible
+
+static int x = 1;
+
+class Init {
+public:
+  Init() { x = 0; }
+};
+
+static Init I;
+
+int main(int argc, char *argv[]) {
+  return x;
+}


        


More information about the llvm-commits mailing list