This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

alpha/vms.h: Patch to call static constructors/destructors


egcs currently doesn't call static constructors and destructors
on openvms/alpha. This patch fixes this.

Mon Jun  8 17:42:03 1998  Klaus Kaempf (kkaempf@progis.de)

	* alpha/vms.h (EXTRA_SECTIONS): Add in_ctors and in_dtors.
	(EXTRA_SECTION_FUNCTIONS): Add ctors_section and dtors_section.
	(ASM_OUTPUT_CONSTRUCTOR, ASM_OUTPUT_DESTRUCTOR): Define.

===================================================================
RCS file: alpha/RCS/vms.h,v
retrieving revision 1.1
diff -c -r1.1 alpha/vms.h
*** alpha/vms.h	1998/06/08 15:24:46	1.1
--- alpha/vms.h	1998/06/08 15:26:39
***************
*** 289,297 ****
  #define LINK_SECTION_ASM_OP ".link"
  #define READONLY_SECTION_ASM_OP ".rdata"
  #define LITERALS_SECTION_ASM_OP ".literals"
  
  #undef EXTRA_SECTIONS
! #define EXTRA_SECTIONS	in_link, in_rdata, in_literals
  
  #undef EXTRA_SECTION_FUNCTIONS
  #define EXTRA_SECTION_FUNCTIONS					\
--- 289,299 ----
  #define LINK_SECTION_ASM_OP ".link"
  #define READONLY_SECTION_ASM_OP ".rdata"
  #define LITERALS_SECTION_ASM_OP ".literals"
+ #define CTORS_SECTION_ASM_OP ".ctors"
+ #define DTORS_SECTION_ASM_OP ".dtors"
  
  #undef EXTRA_SECTIONS
! #define EXTRA_SECTIONS	in_link, in_rdata, in_literals, in_ctors, in_dtors
  
  #undef EXTRA_SECTION_FUNCTIONS
  #define EXTRA_SECTION_FUNCTIONS					\
***************
*** 321,326 ****
--- 323,346 ----
        fprintf (asm_out_file, "%s\n", LITERALS_SECTION_ASM_OP); 	\
        in_section = in_literals;					\
      }								\
+ }								\
+ void								\
+ ctors_section ()						\
+ {								\
+   if (in_section != in_ctors)					\
+     {								\
+       fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);	\
+       in_section = in_ctors;					\
+     }								\
+ }								\
+ void								\
+ dtors_section ()						\
+ {								\
+   if (in_section != in_dtors)					\
+     {								\
+       fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);	\
+       in_section = in_dtors;					\
+     }								\
  }
  
  #undef ASM_OUTPUT_ADDR_DIFF_ELT
***************
*** 398,403 ****
--- 418,443 ----
  }
  
  #undef TRANSFER_FROM_TRAMPOLINE
+ 
+ /* A C statement (sans semicolon) to output an element in the table of
+    global constructors.  */
+ #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)		\
+   do {							\
+     ctors_section ();					\
+     fprintf (FILE, "\t.quad "); 			\
+     assemble_name (FILE, NAME); 			\
+     fprintf (FILE, "\n");				\
+   } while (0)
+ 
+ /* A C statement (sans semicolon) to output an element in the table of
+    global destructors.	*/
+ #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)		\
+   do {							\
+     dtors_section ();					\
+     fprintf (FILE, "\t.quad "); 			\
+     assemble_name (FILE, NAME); 			\
+     fprintf (FILE, "\n");				\
+   } while (0)
  
  #define VALID_MACHINE_DECL_ATTRIBUTE(DECL, ATTRIBUTES, NAME, ARGS) \
    (vms_valid_decl_attribute_p (DECL, ATTRIBUTES, NAME, ARGS))

-- 
proGIS Software                 E-Mail: kkaempf@progis.de
Dipl.-Inform. Klaus K"ampf      Fax:    0241-47067-29
Jakobstr. 117                   Voice:  0241-47067-11
D-52064 Aachen                  WWW:	http://www.progis.de



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]