OSDN Git Service

Add support for COFF style constructors
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Mar 1995 19:54:01 +0000 (19:54 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 Mar 1995 19:54:01 +0000 (19:54 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9101 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/config/i960/i960-coff.h

index 20c6126..50f78c5 100644 (file)
@@ -29,4 +29,70 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #undef PREFERRED_DEBUGGING_TYPE
 #define PREFERRED_DEBUGGING_TYPE SDB_DEBUG
 
+#undef ASM_FILE_START
+#define ASM_FILE_START(FILE) \
+  output_file_directive ((FILE), main_input_filename)
+
+/* Support the ctors and dtors sections for g++.  */
+
+#define CTORS_SECTION_ASM_OP   ".section\t.ctors,\"x\""
+#define DTORS_SECTION_ASM_OP   ".section\t.dtors,\"x\""
+
+/* A list of other sections which the compiler might be "in" at any
+   given time.  */
+
+#undef EXTRA_SECTIONS
+#define EXTRA_SECTIONS in_ctors, in_dtors
+
+/* A list of extra section function definitions.  */
+
+#undef EXTRA_SECTION_FUNCTIONS
+#define EXTRA_SECTION_FUNCTIONS                                                \
+  CTORS_SECTION_FUNCTION                                               \
+  DTORS_SECTION_FUNCTION
+
+#define CTORS_SECTION_FUNCTION                                         \
+void                                                                   \
+ctors_section ()                                                       \
+{                                                                      \
+  if (in_section != in_ctors)                                          \
+    {                                                                  \
+      fprintf (asm_out_file, "%s\n", CTORS_SECTION_ASM_OP);            \
+      in_section = in_ctors;                                           \
+    }                                                                  \
+}
+
+#define DTORS_SECTION_FUNCTION                                         \
+void                                                                   \
+dtors_section ()                                                       \
+{                                                                      \
+  if (in_section != in_dtors)                                          \
+    {                                                                  \
+      fprintf (asm_out_file, "%s\n", DTORS_SECTION_ASM_OP);            \
+      in_section = in_dtors;                                           \
+    }                                                                  \
+}
+
+#define INT_ASM_OP ".word"
+
+/* 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%s\t ", INT_ASM_OP);                             \
+    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%s\t ", INT_ASM_OP);                             \
+    assemble_name (FILE, NAME);                                        \
+    fprintf (FILE, "\n");                                              \
+  } while (0)
+
 /* end of i960-coff.h */