diff --git a/ci-tests/custom-csr.cc b/ci-tests/custom-csr.cc index 857c9c32..89b0149b 100644 --- a/ci-tests/custom-csr.cc +++ b/ci-tests/custom-csr.cc @@ -37,7 +37,7 @@ struct xdummycsr_t : public extension_t { } }; -REGISTER_EXTENSION(dummycsr, []() { return new xdummycsr_t; }) +REGISTER_EXTENSION(dummycsr, []() { static xdummycsr_t ext; return &ext; }) // Copied from spike main. // TODO: This should really be provided in libriscv diff --git a/ci-tests/test-customext.cc b/ci-tests/test-customext.cc index 77c739fa..90cdb35a 100644 --- a/ci-tests/test-customext.cc +++ b/ci-tests/test-customext.cc @@ -46,7 +46,7 @@ struct xslliuw_dummy_t : public extension_t { } }; -REGISTER_EXTENSION(dummyslliuw, []() { return new xslliuw_dummy_t; }) +REGISTER_EXTENSION(dummyslliuw, []() { static xslliuw_dummy_t ext; return &ext; }) // Copied from spike main. // TODO: This should really be provided in libriscv diff --git a/customext/cflush.cc b/customext/cflush.cc index c090e884..5a9d2793 100644 --- a/customext/cflush.cc +++ b/customext/cflush.cc @@ -40,4 +40,4 @@ class cflush_t : public extension_t } }; -REGISTER_EXTENSION(cflush, []() { return new cflush_t; }) +REGISTER_EXTENSION(cflush, []() { static cflush_t ext; return &ext; }) diff --git a/customext/dummy_rocc.cc b/customext/dummy_rocc.cc index 66698873..bc239394 100644 --- a/customext/dummy_rocc.cc +++ b/customext/dummy_rocc.cc @@ -44,4 +44,4 @@ class dummy_rocc_t : public rocc_t reg_t acc[num_acc]; }; -REGISTER_EXTENSION(dummy_rocc, []() { return new dummy_rocc_t; }) +REGISTER_EXTENSION(dummy_rocc, []() { static dummy_rocc_t ext; return &ext; })