(ASM_OUTPUT_SECTION_NAME): New arg DECL.
authorDoug Evans <dje@gnu.org>
Wed, 16 Nov 1994 01:02:01 +0000 (01:02 +0000)
committerDoug Evans <dje@gnu.org>
Wed, 16 Nov 1994 01:02:01 +0000 (01:02 +0000)
From-SVN: r8461

gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h
gcc/config/sh/sh.h
gcc/config/sparc/sysv4.h

index d0689b3..8208b2a 100644 (file)
@@ -576,9 +576,10 @@ handle_pragma (file)
   if (strcmp (pbuf, "saveall") == 0)
     pragma_saveall = 1;
 
-  /* ??? This is deprecated.  Use section attributes.  */
+  /* ??? This is deprecated.  Delete for gcc 2.8.  */
   if (strcmp (pbuf, "section") == 0)
     {
+      warning ("#pragma section is deprecated, use section attributes");
       while (c && !isalpha (c))
        c = getc (file);
       psize = 0;
@@ -589,7 +590,7 @@ handle_pragma (file)
          c = getc (file);
        }
       pbuf[psize] = 0;
-      named_section (pbuf);
+      named_section (NULL_TREE, pbuf);
     }
   ungetc (c, file);
   return c;
index 7ce716a..1b24204 100644 (file)
@@ -1022,14 +1022,9 @@ dtors_section()                                          \
     }                                                          \
 }                                                              \
 
-#if 0
-#define ASM_OUTPUT_CONSTRUCTOR(FILE, NAME) \
-  do { named_section(".init"); fprintf(FILE,"\t.word\t%s\n", NAME); } while (0)
-#else
 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)      \
   do { ctors_section();                                \
        fprintf(FILE, "\t%s\t_%s\n", ASM_WORD_OP, NAME); } while (0)
-#endif
 
 #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)       \
   do { dtors_section();                                \
@@ -1079,11 +1074,13 @@ dtors_section()                                                 \
 #define SDB_DEBUGGING_INFO
 #define SDB_DELIM      "\n"
 
-/* Assemble generic sections.
-   This is currently only used to support section attributes.  */
+/* A C statement to output something to the assembler file to switch to section
+   NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+   NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
+   define this macro in such cases.  */
 
-#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \
-   fprintf (FILE, ".section\t%s\n", NAME)
+#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
+  fprintf (FILE, "\t.section %s\n", NAME)
 
 /* This is how to output the definition of a user-level label named NAME,
    such as the label on a static function or variable NAME.  */
index 58bb113..791ba6c 100644 (file)
@@ -1244,10 +1244,12 @@ dtors_section()                                              \
     }                                                       \
 }                                                            
 
-/* Assemble generic sections.
-   This is currently only used to support section attributes.  */
+/* A C statement to output something to the assembler file to switch to section
+   NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+   NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
+   define this macro in such cases.  */
 
-#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \
+#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
    do { fprintf (FILE, ".section\t%s\n", NAME); } while (0)
 
 #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)      \
index 066fa18..f81a4f7 100644 (file)
@@ -175,11 +175,20 @@ do { ASM_OUTPUT_ALIGN ((FILE), Pmode == SImode ? 2 : 3);          \
 #define CTORS_SECTION_ASM_OP    ".section\t\".ctors\",#alloc,#execinstr"
 #define DTORS_SECTION_ASM_OP    ".section\t\".dtors\",#alloc,#execinstr"
 
-/* Assemble generic sections.
-   This is currently only used to support section attributes.  */
-
-#define ASM_OUTPUT_SECTION_NAME(FILE, NAME) \
-   fprintf (FILE, ".section\t\"%s\",#alloc\n", NAME)
+/* A C statement to output something to the assembler file to switch to section
+   NAME for object DECL which is either a FUNCTION_DECL, a VAR_DECL or
+   NULL_TREE.  Some target formats do not support arbitrary sections.  Do not
+   define this macro in such cases.  */
+
+#define ASM_OUTPUT_SECTION_NAME(FILE, DECL, NAME) \
+do {                                                                   \
+  if (TREE_CODE (DECL) == FUNCTION_DECL)                               \
+    fprintf (FILE, ".section\t\"%s\",#alloc,#execinstr\n", (NAME));    \
+  else if (TREE_READONLY (DECL))                                       \
+    fprintf (FILE, ".section\t\"%s\",#alloc\n", (NAME));               \
+  else                                                                 \
+    fprintf (FILE, ".section\t\"%s\",#alloc,#write\n", (NAME));                \
+} while (0)
 
 /* If the host and target formats match, output the floats as hex.  */
 #if HOST_FLOAT_FORMAT == TARGET_FLOAT_FORMAT