From 5e648d3021c10f8bc1fcc3404dcd5ede6cdc32f9 Mon Sep 17 00:00:00 2001 From: Olivier Hainque Date: Wed, 30 May 2018 08:57:50 +0000 Subject: [PATCH] [Ada] Craft .ctors/.dtors sections manually for VxWorks EH registration Temporary change for experimental purposes. Further cleanups will be needed if this sheme works as we hope. 2018-05-30 Olivier Hainque gcc/ada/ * vx_crtbegin_attr.c (CTOR_ATTRIBUTE, DTOR_ATTRIBUTE): Empty. (eh_registration_ctors, eh_registration_tors): New static variables, forced in a .ctors/.dtors section, respectively, with priority. From-SVN: r260938 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/vx_crtbegin_attr.c | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1e1056b6fd9..7d70d82fd6e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-05-30 Olivier Hainque + + * vx_crtbegin_attr.c (CTOR_ATTRIBUTE, DTOR_ATTRIBUTE): Empty. + (eh_registration_ctors, eh_registration_tors): New static variables, + forced in a .ctors/.dtors section, respectively, with priority. + 2018-05-30 Bob Duff * aspects.ads, contracts.adb, exp_util.adb, expander.adb, expander.ads, diff --git a/gcc/ada/vx_crtbegin_attr.c b/gcc/ada/vx_crtbegin_attr.c index 19fbe6061bb..f10555d21a5 100644 --- a/gcc/ada/vx_crtbegin_attr.c +++ b/gcc/ada/vx_crtbegin_attr.c @@ -31,12 +31,19 @@ /* crtbegin kind of file for ehframe registration/deregistration purposes on VxWorks. This variant exposes the ctor/dtor functions - as explicit constructors, expected to be placed in a .ctors/.dtors - section. */ + as explicit constructors referenced from a .ctors/.dtors section. */ + +#define CTOR_ATTRIBUTE +#define DTOR_ATTRIBUTE + +#include "vx_crtbegin.inc" /* 101 is the highest user level priority allowed by VxWorks. */ -#define CTOR_ATTRIBUTE __attribute__((constructor(101))) -#define DTOR_ATTRIBUTE __attribute__((destructor(101))) +static void (* volatile eh_registration_ctors[])() + __attribute__((section (".ctors.65424"))) += { &CTOR_NAME }; -#include "vx_crtbegin.inc" +static void (* volatile eh_registration_dtors[])() + __attribute__((section (".dtors.65424"))) += { &DTOR_NAME }; -- 2.30.2