summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--utils/regtools/lib/soc_desc.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/utils/regtools/lib/soc_desc.cpp b/utils/regtools/lib/soc_desc.cpp
index 1c9eaf7972..3904f6a77e 100644
--- a/utils/regtools/lib/soc_desc.cpp
+++ b/utils/regtools/lib/soc_desc.cpp
@@ -293,7 +293,6 @@ bool soc_desc_parse_xml(const std::string& filename, soc_t& socs)
bool ret = parse_root_elem(root_element, socs);
xmlFreeDoc(doc);
- xmlCleanupParser();
return ret;
}
@@ -967,3 +966,20 @@ bool soc_desc_evaluate_formula(const std::string& formula,
my_evaluator e(formula, var);
return e.parse(result, error);
}
+
+/** WARNING we need to call xmlInitParser() to init libxml2 but it needs to
+ * called from the main thread, which is a super strong requirement, so do it
+ * using a static constructor */
+namespace
+{
+class xml_parser_init
+{
+public:
+ xml_parser_init()
+ {
+ xmlInitParser();
+ }
+};
+
+xml_parser_init __xml_parser_init;
+}