aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/init.c')
-rw-r--r--gcc/ada/init.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/ada/init.c b/gcc/ada/init.c
index 6198172..50e0feb 100644
--- a/gcc/ada/init.c
+++ b/gcc/ada/init.c
@@ -1777,6 +1777,41 @@ __gnat_initialize (void)
{
__gnat_init_float ();
+ /* On targets where we might be using the ZCX scheme, we need to register
+ the frame tables.
+
+ For application "modules", the crtstuff objects linked in (crtbegin/endS)
+ are tailored to provide this service a-la C++ constructor fashion,
+ typically triggered by the dynamic loader. This is achieved by way of a
+ special variable declaration in the crt object, the name of which has
+ been deduced by analyzing the output of the "munching" step documented
+ for C++. The de-registration call is handled symetrically, a-la C++
+ destructor fashion and typically triggered by the dynamic unloader. With
+ this scheme, a mixed Ada/C++ application has to be linked and loaded as
+ separate modules for each language, which is not unreasonable anyway.
+
+ For applications statically linked with the kernel, the module scheme
+ above would lead to duplicated symbols because the VxWorks kernel build
+ "munches" by default. To prevent those conflicts, we link against
+ crtbegin/end objects that don't include the special variable and directly
+ call the appropriate function here. We'll never unload that, so there is
+ no de-registration to worry about.
+
+ We can differentiate between the two cases by looking at the
+ __module_has_ctors value provided by each class of crt objects. As of
+ today, selecting the crt set intended for applications to be statically
+ linked with the kernel is triggered by adding "-static" to the gcc *link*
+ command line options. */
+
+#if 0
+ {
+ extern const int __module_has_ctors;
+ extern void __do_global_ctors ();
+
+ if (! __module_has_ctors)
+ __do_global_ctors ();
+ }
+#endif
}
/********************************/