[PATCH] cdtest: Restrict exceptions during sysinit
Kinsey Moore
kinsey.moore at oarcorp.com
Thu Jul 14 18:39:49 UTC 2022
I believe the logic in this patch is inverted for generating that #define.
Kinsey
-----Original Message-----
From: devel <devel-bounces at rtems.org> On Behalf Of Sebastian Huber
Sent: Wednesday, July 13, 2022 06:42
To: devel at rtems.org
Subject: [PATCH] cdtest: Restrict exceptions during sysinit
Exceptions during system initialization work only on targets which do not need
a registration of exception frames during the global construction. In
particular, targets which use the DWARF2 unwinder cannot use exceptions during
system initialization.
---
testsuites/samples/cdtest/main.cc | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/testsuites/samples/cdtest/main.cc b/testsuites/samples/cdtest/main.cc
index 44cdaf84bb..d5530a657d 100644
--- a/testsuites/samples/cdtest/main.cc
+++ b/testsuites/samples/cdtest/main.cc
@@ -238,6 +238,17 @@ rtems_task main_task(
exit(0);
}
+/*
+ * Exceptions during system initialization work only on targets which do not
+ * need a registration of exception frames during the global construction. In
+ * particular, targets which use the DWARF2 unwinder cannot use exceptions
+ * during system initialization.
+ */
+#if defined(__arm__) || defined(__aarch64__)
+#define CAN_DO_EXCEPTIONS_DURING_SYSINIT
+#endif
+
+#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT
static void early_exception()
{
try
@@ -250,11 +261,13 @@ static void early_exception()
throw "early exception 2";
}
}
+#endif
static void test_exceptions_during_system_init()
{
TEST_BEGIN();
+#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT
try
{
early_exception();
@@ -263,6 +276,7 @@ static void test_exceptions_during_system_init()
{
rtems_test_assert(strcmp(e, "early exception 2") == 0);
}
+#endif
}
RTEMS_SYSINIT_ITEM(
--
2.35.3
_______________________________________________
devel mailing list
devel at rtems.org
http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list