Force extension loaders to be linked in
authorAndrew Waterman <waterman@eecs.berkeley.edu>
Tue, 28 Jan 2014 11:38:28 +0000 (03:38 -0800)
committerAndrew Waterman <waterman@eecs.berkeley.edu>
Tue, 28 Jan 2014 11:38:28 +0000 (03:38 -0800)
riscv/extension.cc
spike/extensions.cc

index 34d3f4f015e551874a2b9e3c1b53dc01ef97b94c..b758eef61cedd08ad218da8dbc4579a51c8c333f 100644 (file)
@@ -1,12 +1,6 @@
 #include "extension.h"
 #include "trap.h"
 
-std::map<std::string, std::function<extension_t*()>>& extensions()
-{
-  static std::map<std::string, std::function<extension_t*()>> v;
-  return v;
-}
-
 extension_t::~extension_t()
 {
 }
index 53b62a174f411487904cc6d80081231e8f3b4a1e..d6ee6f18b089329c5cfef86dd04236021c58c67a 100644 (file)
@@ -1 +1,11 @@
+#include "extension.h"
 #include "hwacha.h"
+#include "dummy-rocc.h"
+
+// Static constructors want to make use of the extensions map, so we
+// access it through a function call to guarantee initialization order.
+std::map<std::string, std::function<extension_t*()>>& extensions()
+{
+  static std::map<std::string, std::function<extension_t*()>> v;
+  return v;
+}