[v2,4/4] vxworks: don't define vxworks_asm_out_constructor when using .init_array

Message ID 20180628084329.22754-5-rv@rasmusvillemoes.dk
State New
Headers show
Series
  • some vxworks/powerpc patches
Related show

Commit Message

Rasmus Villemoes June 28, 2018, 8:43 a.m.
When the compiler is configured with --enable-initfini-array,
config/initfini-array.h gets included after config/vxworks.h by tm.h, so
the definitions of TARGET_ASM_CONSTRUTOR/TARGET_ASM_DESTRUCTOR in
vxworks.h get undone in initfini-array.h. Hence, we might as well not
define the vxworks_asm_out_* functions.

2018-06-01  Rasmus Villemoes  <rv@rasmusvillemoes.dk>

gcc/
	* config/vxworks.h: Guard vxworks_asm_out_constructor and
	  vxworks_asm_out_destructor by !HAVE_INITFINI_ARRAY_SUPPORT
	* config/vxworks.c: Likewise.
---
 gcc/config/vxworks.c | 2 ++
 gcc/config/vxworks.h | 2 ++
 2 files changed, 4 insertions(+)

-- 
2.16.4

Comments

Olivier Hainque Aug. 13, 2018, 12:53 p.m. | #1
Hello Rasmus,

> On 28 Jun 2018, at 10:43, Rasmus Villemoes <rv@rasmusvillemoes.dk> wrote:

> 

> 	* config/vxworks.h: Guard vxworks_asm_out_constructor and

> 	  vxworks_asm_out_destructor by !HAVE_INITFINI_ARRAY_SUPPORT

> 	* config/vxworks.c: Likewise.


ok as well, also modulo a ChangeLog formatting nit: log continuations
beyond the first line start below the '*' of the first line, so:

	* config/vxworks.h: Guard vxworks_asm_out_constructor and
	vxworks_asm_out_destructor by !HAVE_INITFINI_ARRAY_SUPPORT.

Thanks,

Olivier

Patch

diff --git a/gcc/config/vxworks.c b/gcc/config/vxworks.c
index 953f74f71af..3b6b2343859 100644
--- a/gcc/config/vxworks.c
+++ b/gcc/config/vxworks.c
@@ -28,6 +28,7 @@  along with GCC; see the file COPYING3.  If not see
 #include "output.h"
 #include "fold-const.h"
 
+#if !HAVE_INITFINI_ARRAY_SUPPORT
 /* Like default_named_section_asm_out_constructor, except that even
    constructors with DEFAULT_INIT_PRIORITY must go in a numbered
    section on VxWorks.  The VxWorks runtime uses a clever trick to get
@@ -56,6 +57,7 @@  vxworks_asm_out_destructor (rtx symbol, int priority)
 				    /*constructor_p=*/false);
   assemble_addr_to_section (symbol, sec);
 }
+#endif
 
 /* Return the list of FIELD_DECLs that make up an emulated TLS
    variable's control object.  TYPE is the structure these are fields
diff --git a/gcc/config/vxworks.h b/gcc/config/vxworks.h
index 4c2d98381f6..86773868ec2 100644
--- a/gcc/config/vxworks.h
+++ b/gcc/config/vxworks.h
@@ -150,6 +150,7 @@  extern void vxworks_override_options (void);
 #define SUPPORTS_INIT_PRIORITY \
   (TARGET_VXWORKS_RTP || HAVE_INITFINI_ARRAY_SUPPORT)
 
+#if !HAVE_INITFINI_ARRAY_SUPPORT
 /* VxWorks requires special handling of constructors and destructors.
    All VxWorks configurations must use these functions.  */
 #undef TARGET_ASM_CONSTRUCTOR
@@ -158,6 +159,7 @@  extern void vxworks_override_options (void);
 #define TARGET_ASM_DESTRUCTOR vxworks_asm_out_destructor
 extern void vxworks_asm_out_constructor (rtx symbol, int priority);
 extern void vxworks_asm_out_destructor (rtx symbol, int priority);
+#endif
 
 /* Override the vxworks-dummy.h definitions.  TARGET_VXWORKS_RTP
    is defined by vxworks.opt.  */