pa-protos.h (readonly_data, [...]): Rename to som_readonly_data_section...
authorZack Weinberg <zack@codesourcery.com>
Fri, 20 Aug 2004 15:11:43 +0000 (15:11 +0000)
committerJohn David Anglin <danglin@gcc.gnu.org>
Fri, 20 Aug 2004 15:11:43 +0000 (15:11 +0000)
        * config/pa/pa-protos.h (readonly_data, one_only_readonly_data_section,
one_only_data_section): Rename to som_readonly_data_section,
som_one_only_readonly_data_section and som_one_only_data_section.
        * config/pa/pa.c (ONE_ONLY_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP,
DEFAULT_TEXT_SECTION_ASM_OP): Delete conditional defines.
(som_text_section_asm_op): Replace ONE_ONLY_TEXT_SECTION_ASM_OP,
NEW_TEXT_SECTION_ASM_OP and DEFAULT_TEXT_SECTION_ASM_OP with actual
string values.
(pa_select_section): Use renamed section functions.
* config/pa/pa.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS,
        SOM_READONLY_DATA_SECTION_FUNCTION,
SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION,
        SOM_ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION):
        Define here ...
        * config/pa/som.h: ... not here.
        (DEFAULT_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP,
ONE_ONLY_TEXT_SECTION_ASM_OP, READONLY_DATA_ASM_OP,
ONE_ONLY_READONLY_DATA_SECTION_ASM_OP,
        ONE_ONLY_DATA_SECTION_ASM_OP): Delete.
        (READONLY_DATA_SECTION): Use som_readonly_data_section.

Co-Authored-By: John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
From-SVN: r86325

gcc/ChangeLog
gcc/config/pa/pa-protos.h
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/pa/som.h

index d0e31e46676d7b999ffa25f2564eabab6c32399f..06a8bd405f57fc8406b7d2f74dafbc1e23057a38 100644 (file)
@@ -1,3 +1,27 @@
+2004-08-20  Zack Weinberg  <zack@codesourcery.com>
+           John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
+
+        * config/pa/pa-protos.h (readonly_data, one_only_readonly_data_section,
+       one_only_data_section): Rename to som_readonly_data_section,
+       som_one_only_readonly_data_section and som_one_only_data_section.
+        * config/pa/pa.c (ONE_ONLY_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP,
+       DEFAULT_TEXT_SECTION_ASM_OP): Delete conditional defines.
+       (som_text_section_asm_op): Replace ONE_ONLY_TEXT_SECTION_ASM_OP,
+       NEW_TEXT_SECTION_ASM_OP and DEFAULT_TEXT_SECTION_ASM_OP with actual
+       string values.
+       (pa_select_section): Use renamed section functions.
+       * config/pa/pa.h (EXTRA_SECTIONS, EXTRA_SECTION_FUNCTIONS,
+        SOM_READONLY_DATA_SECTION_FUNCTION,
+       SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION,
+        SOM_ONE_ONLY_DATA_SECTION_FUNCTION, FORGET_SECTION_FUNCTION):
+        Define here ...
+        * config/pa/som.h: ... not here.
+        (DEFAULT_TEXT_SECTION_ASM_OP, NEW_TEXT_SECTION_ASM_OP,
+       ONE_ONLY_TEXT_SECTION_ASM_OP, READONLY_DATA_ASM_OP,
+       ONE_ONLY_READONLY_DATA_SECTION_ASM_OP,
+        ONE_ONLY_DATA_SECTION_ASM_OP): Delete.
+        (READONLY_DATA_SECTION): Use som_readonly_data_section.
+
 2004-08-20  Nathan Sidwell  <nathan@codesourcery.com>
 
        * fold-const.c (int_const_binop): Don't generate non-overflowing
index c27ef124ac69a9c7791e72d1757e3c67ebfe3b88..46d26b6d41c82dcf55f26b3fec907ad84e2862d3 100644 (file)
@@ -177,7 +177,7 @@ extern void pa_asm_output_aligned_local (FILE *, const char *,
                                         unsigned int);
 
 /* Functions in varasm.c used by pa.c.  */
-extern void readonly_data (void);
-extern void one_only_readonly_data_section (void);
-extern void one_only_data_section (void);
+extern void som_readonly_data_section (void);
+extern void som_one_only_readonly_data_section (void);
+extern void som_one_only_data_section (void);
 extern void forget_section (void);
index be1c4bd4618864e4c6eb5166c11f30d965aa4f42..a35820be23bce3870a0218125b5730b05e03fb85 100644 (file)
@@ -9236,27 +9236,18 @@ cmpib_comparison_operator (rtx op, enum machine_mode mode)
              || GET_CODE (op) == LEU));
 }
 
-#ifndef ONE_ONLY_TEXT_SECTION_ASM_OP
-#define ONE_ONLY_TEXT_SECTION_ASM_OP ""
-#endif
-
-#ifndef NEW_TEXT_SECTION_ASM_OP
-#define NEW_TEXT_SECTION_ASM_OP ""
-#endif
-
-#ifndef DEFAULT_TEXT_SECTION_ASM_OP
-#define DEFAULT_TEXT_SECTION_ASM_OP ""
-#endif
-
-/* Select and return a TEXT_SECTION_ASM_OP for the current function.
+/* Return a string to output before text in the current function.
 
    This function is only used with SOM.  Because we don't support
    named subspaces, we can only create a new subspace or switch back
-   into the default text subspace.  */
+   to the default text subspace.  */
 const char *
 som_text_section_asm_op (void)
 {
-  if (TARGET_SOM && TARGET_GAS)
+  if (!TARGET_SOM)
+    return "";
+
+  if (TARGET_GAS)
     {
       if (cfun && !cfun->machine->in_nsubspa)
        {
@@ -9269,9 +9260,10 @@ som_text_section_asm_op (void)
          if (cfun->decl
              && DECL_ONE_ONLY (cfun->decl)
              && !DECL_WEAK (cfun->decl))
-           return ONE_ONLY_TEXT_SECTION_ASM_OP;
+           return
+ "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=24,COMDAT";
 
-         return NEW_TEXT_SECTION_ASM_OP;
+         return "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$";
        }
       else
        {
@@ -9279,13 +9271,13 @@ som_text_section_asm_op (void)
             function has been completed.  So, we are changing to the
             text section to output debugging information.  Do this in
             the default text section.  We need to forget that we are
-            in the text section so that text_section will call us the
-            next time around.  */
+            in the text section so that the function text_section in
+            varasm.c will call us the next time around.  */
          forget_section ();
        }
     }
 
-  return DEFAULT_TEXT_SECTION_ASM_OP;
+  return "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$";
 }
 
 /* On hpux10, the linker will give an error if we have a reference
@@ -9308,7 +9300,7 @@ pa_select_section (tree exp, int reloc,
       if (TARGET_SOM
          && DECL_ONE_ONLY (exp)
          && !DECL_WEAK (exp))
-       one_only_readonly_data_section ();
+       som_one_only_readonly_data_section ();
       else
        readonly_data_section ();
     }
@@ -9320,7 +9312,7 @@ pa_select_section (tree exp, int reloc,
           && DECL_ONE_ONLY (exp)
           && !DECL_WEAK (exp)
           && DECL_INITIAL (exp))
-    one_only_data_section ();
+    som_one_only_data_section ();
   else
     data_section ();
 }
index aefecd20bb40e3008328112a9df408a91ff1afe7..b7e32c46979f401e786a6ca60de6ad3a1a145d35 100644 (file)
@@ -1653,12 +1653,78 @@ do {                                                                    \
     goto LABEL
 \f
 #define TARGET_ASM_SELECT_SECTION  pa_select_section
-   
+
 /* Return a nonzero value if DECL has a section attribute.  */
 #define IN_NAMED_SECTION_P(DECL) \
   ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
    && DECL_SECTION_NAME (DECL) != NULL_TREE)
 
+/* The following extra sections and extra section functions are only used
+   for SOM, but they must be provided unconditionally because pa.c's calls
+   to the functions might not get optimized out when other object formats
+   are in use.  */
+
+#define EXTRA_SECTIONS                                                 \
+  in_som_readonly_data,                                                        \
+  in_som_one_only_readonly_data,                                       \
+  in_som_one_only_data
+
+#define EXTRA_SECTION_FUNCTIONS                                                \
+  SOM_READONLY_DATA_SECTION_FUNCTION                                   \
+  SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION                          \
+  SOM_ONE_ONLY_DATA_SECTION_FUNCTION                                   \
+  FORGET_SECTION_FUNCTION
+
+/* SOM puts readonly data in the default $LIT$ subspace when PIC code
+   is not being generated.  */
+#define SOM_READONLY_DATA_SECTION_FUNCTION                             \
+void                                                                   \
+som_readonly_data_section (void)                                       \
+{                                                                      \
+  if (!TARGET_SOM)                                                     \
+    return;                                                            \
+  if (in_section != in_som_readonly_data)                              \
+    {                                                                  \
+      in_section = in_som_readonly_data;                               \
+      fputs ("\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n", asm_out_file);      \
+    }                                                                  \
+}
+
+/* When secondary definitions are not supported, SOM makes readonly data one
+   only by creating a new $LIT$ subspace in $TEXT$ with the comdat flag.  */
+#define SOM_ONE_ONLY_READONLY_DATA_SECTION_FUNCTION                    \
+void                                                                   \
+som_one_only_readonly_data_section (void)                              \
+{                                                                      \
+  if (!TARGET_SOM)                                                     \
+    return;                                                            \
+  in_section = in_som_one_only_readonly_data;                          \
+  fputs ("\t.SPACE $TEXT$\n"                                           \
+        "\t.NSUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16,COMDAT\n",\
+        asm_out_file);                                                 \
+}
+
+/* When secondary definitions are not supported, SOM makes data one only by
+   creating a new $DATA$ subspace in $PRIVATE$ with the comdat flag.  */
+#define SOM_ONE_ONLY_DATA_SECTION_FUNCTION                             \
+void                                                                   \
+som_one_only_data_section (void)                                       \
+{                                                                      \
+  if (!TARGET_SOM)                                                     \
+    return;                                                            \
+  in_section = in_som_one_only_data;                                   \
+  fputs ("\t.SPACE $PRIVATE$\n"                                                \
+        "\t.NSUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=24,COMDAT\n", \
+        asm_out_file);                                                 \
+}
+
+#define FORGET_SECTION_FUNCTION                                                \
+void                                                                   \
+forget_section (void)                                                  \
+{                                                                      \
+  in_section = no_section;                                             \
+}
+
 /* Define this macro if references to a symbol must be treated
    differently depending on something about the variable or
    function named by the symbol (such as what section it is in).
index a87b2fda174991f30e4a38b01f7b34c467552a55..ff152aecf962d5cdadc42e79a83f56e173a8609a 100644 (file)
@@ -206,84 +206,15 @@ do {                                                              \
 
 #define TARGET_ASM_FILE_START pa_som_file_start
 
-/* Select and return a TEXT_SECTION_ASM_OP string.  */
+/* String to output before text.  */
 #define TEXT_SECTION_ASM_OP som_text_section_asm_op ()
 
-/* Output before code in the default text section.  */
-#define DEFAULT_TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $CODE$"
-
-/* Output before text in a new subspace.  This allows the linker to
-   place stubs between functions.  */
-#define NEW_TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\t.NSUBSPA $CODE$"
-    
-/* Output before text in a new one-only subspace.  */
-#define ONE_ONLY_TEXT_SECTION_ASM_OP "\t.SPACE $TEXT$\n\
-\t.NSUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,SORT=24,COMDAT"
-
-/* Output before read-only data.  */
-#define READONLY_DATA_ASM_OP "\t.SPACE $TEXT$\n\t.SUBSPA $LIT$\n"
-
-/* Output before one-only readonly data.  We make readonly data one only
-   by creating a new $LIT$ subspace in $TEXT$ with the comdat flag.  */
-#define ONE_ONLY_READONLY_DATA_SECTION_ASM_OP "\t.SPACE $TEXT$\n\
-\t.NSUBSPA $LIT$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=16,COMDAT\n"
-
-/* Output before writable data.  */
+/* String to output before writable data.  */
 #define DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $DATA$\n"
 
-/* Output before one-only data.  We make data one only by creating
-   a new $DATA$ subspace in $PRIVATE$ with the comdat flag.  */
-#define ONE_ONLY_DATA_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\
-\t.NSUBSPA $DATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=24,COMDAT\n"
-
-/* Output before uninitialized data.  */
+/* String to output before uninitialized data.  */
 #define BSS_SECTION_ASM_OP "\t.SPACE $PRIVATE$\n\t.SUBSPA $BSS$\n"
 
-#define EXTRA_SECTIONS                                                 \
-  in_readonly_data,                                                    \
-  in_one_only_readonly_data,                                           \
-  in_one_only_data
-
-#define EXTRA_SECTION_FUNCTIONS                                                \
-  READONLY_DATA_FUNCTION                                               \
-  ONE_ONLY_READONLY_DATA_SECTION_FUNCTION                              \
-  ONE_ONLY_DATA_SECTION_FUNCTION                                       \
-  FORGET_SECTION_FUNCTION
-
-#define READONLY_DATA_FUNCTION                                         \
-void                                                                   \
-readonly_data (void)                                                   \
-{                                                                      \
-  if (in_section != in_readonly_data)                                  \
-    {                                                                  \
-      in_section = in_readonly_data;                                   \
-      fputs (READONLY_DATA_ASM_OP, asm_out_file);                      \
-    }                                                                  \
-}                                                                      \
-
-#define ONE_ONLY_READONLY_DATA_SECTION_FUNCTION                                \
-void                                                                   \
-one_only_readonly_data_section (void)                                  \
-{                                                                      \
-  in_section = in_one_only_readonly_data;                              \
-  fputs (ONE_ONLY_READONLY_DATA_SECTION_ASM_OP, asm_out_file);         \
-}                                                                      \
-
-#define ONE_ONLY_DATA_SECTION_FUNCTION                                 \
-void                                                                   \
-one_only_data_section (void)                                           \
-{                                                                      \
-  in_section = in_one_only_data;                                       \
-  fputs (ONE_ONLY_DATA_SECTION_ASM_OP, asm_out_file);                  \
-}
-
-#define FORGET_SECTION_FUNCTION                                                \
-void                                                                   \
-forget_section (void)                                                  \
-{                                                                      \
-  in_section = no_section;                                             \
-}                                                                      \
-
 /* FIXME: HPUX ld generates incorrect GOT entries for "T" fixups
    which reference data within the $TEXT$ space (for example constant
    strings in the $LIT$ subspace).
@@ -296,7 +227,8 @@ forget_section (void)                                                       \
    $TEXT$ space during PIC generation.  Instead place all constant
    data into the $PRIVATE$ subspace (this reduces sharing, but it
    works correctly).  */
-#define READONLY_DATA_SECTION (flag_pic ? data_section : readonly_data)
+#define READONLY_DATA_SECTION \
+  (flag_pic ? data_section : som_readonly_data_section)
 
 /* We must not have a reference to an external symbol defined in a
    shared library in a readonly section, else the SOM linker will