diff options
author | Rasmus Villemoes <rv@rasmusvillemoes.dk> | 2018-08-21 10:50:27 +0200 |
---|---|---|
committer | Rasmus Villemoes <villemoes@gcc.gnu.org> | 2018-08-21 08:50:27 +0000 |
commit | ace193dc4773159a2c545ab6ca80842c56019e3a (patch) | |
tree | fc20d372cc962ea6382184e80aa1fcac7b03a9ff /gcc/config/vxworks.c | |
parent | 9a5b8df7007b350015509ee8f809fd7d2c8fa963 (diff) |
vxworks: enable use of .init_array/.fini_array for cdtors
The target OS actually runs all function pointers found in the _ctors
array when the module is loaded. So it is not that hard to make use of
the "modern" .init_array/.fini_array mechanism - it mostly just requires
a linker script adding the _ctors and _dtors symbols and terminating
LONG(0) entries.
Assume that if the user passed --enable-initfini-array when building
gcc, the rest of the toolchain (including the link spec and linker
script) is set up appropriately.
Note that configuring with --enable-initfini-array may prevent the -mrtp
mode from working, due to the (unconditional) use of .init_array.*
sections instead of .ctors.* - however, that is the case regardless of this
patch.
From-SVN: r263691
Diffstat (limited to 'gcc/config/vxworks.c')
-rw-r--r-- | gcc/config/vxworks.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c index 061f02057c2..953f74f71af 100644 --- a/gcc/config/vxworks.c +++ b/gcc/config/vxworks.c @@ -143,8 +143,11 @@ vxworks_override_options (void) targetm.emutls.debug_form_tls_address = true; } - /* We can use .ctors/.dtors sections only in RTP mode. */ - targetm.have_ctors_dtors = TARGET_VXWORKS_RTP; + /* We can use .ctors/.dtors sections only in RTP mode. But, if the + compiler was built with --enable-initfini-array, assume the + toolchain implements the proper glue to make .init_array and + .fini_array work. */ + targetm.have_ctors_dtors = TARGET_VXWORKS_RTP || HAVE_INITFINI_ARRAY_SUPPORT; /* PIC is only supported for RTPs. */ if (flag_pic && !TARGET_VXWORKS_RTP) |