aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/vxworks.c7
-rw-r--r--gcc/config/vxworks.h10
3 files changed, 19 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index da16c90..609965b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2018-08-21 Rasmus Villemoes <rv@rasmusvillemoes.dk>
+ * config/vxworks.c: Set targetm.have_ctors_dtors
+ if HAVE_INITFINI_ARRAY_SUPPORT.
+ * config/vxworks.h: Set SUPPORTS_INIT_PRIORITY
+ if HAVE_INITFINI_ARRAY_SUPPORT.
+
+2018-08-21 Rasmus Villemoes <rv@rasmusvillemoes.dk>
+
* config/vxworks.h: Add $(WIND_BASE)/target/h/wrn/coreip to
default search path for VxWorks < 7.
diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c
index 061f020..953f74f71 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)
diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index 08d2c9d..4c2d983 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -142,9 +142,13 @@ along with GCC; see the file COPYING3. If not see
#define VXWORKS_OVERRIDE_OPTIONS vxworks_override_options ()
extern void vxworks_override_options (void);
-/* Only RTPs support prioritized constructors and destructors:
- the implementation relies on numbered .ctors* sections. */
-#define SUPPORTS_INIT_PRIORITY TARGET_VXWORKS_RTP
+/* RTPs support prioritized constructors and destructors: the
+ implementation relies on numbered .ctors* sections. If the compiler
+ was built with --enable-initfini-array, we assume the user uses a
+ linker script that sorts and merges the .init_array.* sections
+ appropriately. */
+#define SUPPORTS_INIT_PRIORITY \
+ (TARGET_VXWORKS_RTP || HAVE_INITFINI_ARRAY_SUPPORT)
/* VxWorks requires special handling of constructors and destructors.
All VxWorks configurations must use these functions. */