elf.h (TEXT_SPACE_P, [...]): Delete.
authorJeffrey A Law <law@cygnus.com>
Fri, 6 Aug 1999 17:08:29 +0000 (17:08 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 6 Aug 1999 17:08:29 +0000 (11:08 -0600)
        * elf.h (TEXT_SPACE_P, FUNCTION_NAME_P): Delete.
        (ASM_GLOBALIZE_LABEL, ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT): Likewise.
        (ASM_FILE_START): Import _mcount with the right type.
        (ASM_DECLARE_FUNCTION_NAME): Define.
        (ASM_OUTPUT_EXTERNAL, ASM_OUTPUT_EXTERNAL_LIBCALL): Define.
        * pa.c (output_function_prologue): Always emit the function's label
        here.
        * pa.h (TEXT_SPACE_P): Define.
        (FUNCTION_NAME_P, ENCODE_SECTION_INFO, STRIP_NAME_ENCODING): Likewise.
        (ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT, ASM_GLOBALIZE_LABEL): Likewise.
        * som.h (TEXT_SPACE_P): Delete.
        (FUNCTION_NAME_P, ENCODE_SECTION_INFO, STRIP_NAME_ENCODING): Likewise.
        (ASM_GLOBALIZE_LABEL, ASM_OUTPUT_INT): Likewise.

From-SVN: r28549

gcc/ChangeLog
gcc/config/pa/elf.h
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/pa/som.h

index 4ef10b1b46b86c83577d4788dd7f203b8847821b..2b5d39fc202795be61b10592327b62464bb0d5be 100644 (file)
@@ -1,3 +1,19 @@
+Fri Aug  6 11:05:29 1999  Jeffrey A Law  (law@cygnus.com)
+
+       * elf.h (TEXT_SPACE_P, FUNCTION_NAME_P): Delete.
+       (ASM_GLOBALIZE_LABEL, ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT): Likewise.
+       (ASM_FILE_START): Import _mcount with the right type.
+       (ASM_DECLARE_FUNCTION_NAME): Define.
+       (ASM_OUTPUT_EXTERNAL, ASM_OUTPUT_EXTERNAL_LIBCALL): Define.
+       * pa.c (output_function_prologue): Always emit the function's label
+       here.
+       * pa.h (TEXT_SPACE_P): Define.
+       (FUNCTION_NAME_P, ENCODE_SECTION_INFO, STRIP_NAME_ENCODING): Likewise.
+       (ASM_OUTPUT_INT, ASM_OUTPUT_DOUBLE_INT, ASM_GLOBALIZE_LABEL): Likewise.
+       * som.h (TEXT_SPACE_P): Delete.
+       (FUNCTION_NAME_P, ENCODE_SECTION_INFO, STRIP_NAME_ENCODING): Likewise.
+       (ASM_GLOBALIZE_LABEL, ASM_OUTPUT_INT): Likewise.
+
 Thu Aug  5 19:29:39 1999  Jim Wilson  <wilson@cygnus.com>
 
        * expr.c (emit_group_load): Allow src to be a CONCAT.
index b284c85bddc4b952c42b8673c9c9b449d0860446..af5031c093ed93c50d83f26df9417ddfcfc26df3 100644 (file)
@@ -21,32 +21,10 @@ Boston, MA 02111-1307, USA.  */
 /* So we can conditionalize small amounts of code in pa.c or pa.md.  */
 #define OBJ_ELF
 
-/* Dummy definitions.  We do not care about this stuff for ELF.  */
-#define TEXT_SPACE_P(DECL) 0
-#define FUNCTION_NAME_P(NAME) 0
-
 #define TEXT_SECTION_ASM_OP "\t.text"
 #define DATA_SECTION_ASM_OP "\t.data"
 #define BSS_SECTION_ASM_OP "\t.section\t.bss"
 
-/* This is how to output a command to make the user-level label named NAME
-   defined for reference from other files.  */
-
-#define ASM_GLOBALIZE_LABEL(FILE,NAME)  \
-  (fputs ("\t.globl ", FILE), assemble_name (FILE, NAME), fputs ("\n", FILE))
-
-/* This is how to output an assembler line defining an `int' constant.  */
-
-#define ASM_OUTPUT_INT(FILE,VALUE)  \
-{ fputs ("\t.word ", FILE);                    \
-  output_addr_const (FILE, (VALUE));           \
-  fputs ("\n", FILE);}
-
-#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE)  \
-{ fputs ("\t.dword ", FILE);                   \
-  output_addr_const (FILE, (VALUE));           \
-  fputs ("\n", FILE);}
-
 #undef ASM_FILE_START
 #define ASM_FILE_START(FILE) \
 do {  \
@@ -57,7 +35,57 @@ do {  \
      else \
        fputs("\t.LEVEL 1.0\n", FILE); \
      if (profile_flag)\
-       fprintf (FILE, "\t.IMPORT _mcount, CODE\n");\
+       fprintf (FILE, "\t.IMPORT _mcount, ENTRY\n");\
      if (write_symbols != NO_DEBUG) \
        output_file_directive ((FILE), main_input_filename); \
    } while (0)
+
+#define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \
+do {  \
+  if (TREE_PUBLIC (DECL)) \
+    { \
+      fputs ("\t.EXPORT ", FILE); \
+      assemble_name (FILE, NAME); \
+      fputs (",ENTRY\n", FILE); \
+    } \
+   } while (0)
+
+/* This is how to output a command to make the user-level label named NAME
+   defined for reference from other files.
+
+   We call assemble_name, which in turn sets TREE_SYMBOL_REFERENCED.  This
+   macro will restore the original value of TREE_SYMBOL_REFERENCED to avoid
+   placing useless function definitions in the output file.
+
+   Also note that the SOM based tools need the symbol imported as a CODE
+   symbol, while the ELF based tools require the symbol to be imported as
+   an ENTRY symbol.  What a crock.  */
+
+#define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)  \
+  do { int save_referenced;                                    \
+       save_referenced = TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)); \
+       fputs ("\t.IMPORT ", FILE);                                     \
+        assemble_name (FILE, NAME);                            \
+       if (FUNCTION_NAME_P (NAME))                                     \
+        fputs (",ENTRY\n", FILE);                              \
+       else                                                    \
+        fputs (",DATA\n", FILE);                               \
+       TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (DECL)) = save_referenced; \
+     } while (0)
+
+/* The bogus HP assembler requires ALL external references to be
+   "imported", even library calls. They look a bit different, so
+   here's this macro.
+
+   Also note not all libcall names are passed to ENCODE_SECTION_INFO
+   (__main for example).  To make sure all libcall names have section
+   info recorded in them, we do it here.  */
+
+#define ASM_OUTPUT_EXTERNAL_LIBCALL(FILE, RTL) \
+  do { fputs ("\t.IMPORT ", FILE);                                     \
+       if (!function_label_operand (RTL, VOIDmode))                    \
+        hppa_encode_label (RTL, 1);                                    \
+       assemble_name (FILE, XSTR ((RTL), 0));                          \
+       fputs (",ENTRY\n", FILE);                                       \
+     } while (0)
+
index f5873f738dffa972fba90e7fe9bc6afbc38d51c7..12b28c6322c8f367797809fe4c982003800046bc 100644 (file)
@@ -2651,9 +2651,7 @@ output_function_prologue (file, size)
   /* The function's label and associated .PROC must never be
      separated and must be output *after* any profiling declarations
      to avoid changing spaces/subspaces within a procedure.  */
-#ifdef OBJ_SOM
   ASM_OUTPUT_LABEL (file, XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));
-#endif
   fputs ("\t.PROC\n", file);
 
   /* hppa_expand_prologue does the dirty work now.  We just need
index 5bb196cf9fea2084a3324b1a7ee254e571041434..7ea6bdb6009750697e91a5cba1f979db79caa590 100644 (file)
@@ -1586,6 +1586,59 @@ extern struct rtx_def *hppa_legitimize_address ();
   else                                 \
     readonly_data_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).
+
+   The macro definition, if any, is executed immediately after the
+   rtl for DECL or other node is created.
+   The value of the rtl will be a `mem' whose address is a
+   `symbol_ref'.
+
+   The usual thing for this macro to do is to a flag in the
+   `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
+   name string in the `symbol_ref' (if one bit is not enough
+   information).
+
+   On the HP-PA we use this to indicate if a symbol is in text or
+   data space.  Also, function labels need special treatment. */
+
+#define TEXT_SPACE_P(DECL)\
+  (TREE_CODE (DECL) == FUNCTION_DECL                                   \
+   || (TREE_CODE (DECL) == VAR_DECL                                    \
+       && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL)           \
+       && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \
+       && !flag_pic)                                                   \
+   || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c'                       \
+       && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
+
+#define FUNCTION_NAME_P(NAME) \
+(*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
+
+#define ENCODE_SECTION_INFO(DECL)\
+do                                                     \
+  { if (TEXT_SPACE_P (DECL))                           \
+      {        rtx _rtl;                                       \
+       if (TREE_CODE (DECL) == FUNCTION_DECL           \
+           || TREE_CODE (DECL) == VAR_DECL)            \
+         _rtl = DECL_RTL (DECL);                       \
+       else                                            \
+         _rtl = TREE_CST_RTL (DECL);                   \
+       SYMBOL_REF_FLAG (XEXP (_rtl, 0)) = 1;           \
+       if (TREE_CODE (DECL) == FUNCTION_DECL)          \
+         hppa_encode_label (XEXP (DECL_RTL (DECL), 0), 0);\
+      }                                                        \
+  }                                                    \
+while (0)
+
+/* Store the user-specified part of SYMBOL_NAME in VAR.
+   This is sort of inverse to ENCODE_SECTION_INFO.  */
+
+#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)   \
+  (VAR) = ((SYMBOL_NAME)  + ((SYMBOL_NAME)[0] == '*' ? \
+                            1 + (SYMBOL_NAME)[1] == '@'\
+                            : (SYMBOL_NAME)[0] == '@'))
+
 /* Specify the machine mode that this machine uses
    for the index in the tablejump instruction.  */
 #define CASE_VECTOR_MODE (TARGET_BIG_SWITCH ? TImode : DImode)
@@ -1882,6 +1935,27 @@ extern struct rtx_def *hppa_legitimize_address ();
        fprintf (FILE, "\t.word 0x%lx\n", l);                           \
      } while (0)
 
+/* This is how to output an assembler line defining an `int' constant. 
+
+   This is made more complicated by the fact that functions must be
+   prefixed by a P% as well as code label references for the exception
+   table -- otherwise the linker chokes.  */
+
+#define ASM_OUTPUT_INT(FILE,VALUE)  \
+{ fputs ("\t.word ", FILE);                    \
+  if (function_label_operand (VALUE, VOIDmode))        \
+    fputs ("P%", FILE);                                \
+  output_addr_const (FILE, (VALUE));           \
+  fputs ("\n", FILE);}
+
+/* Likewise for double integers.  */
+#define ASM_OUTPUT_DOUBLE_INT(FILE,VALUE)  \
+{ fputs ("\t.dword ", FILE);                   \
+  if (function_label_operand (VALUE, VOIDmode))        \
+    fputs ("P%", FILE);                                \
+  output_addr_const (FILE, (VALUE));           \
+  fputs ("\n", FILE);}
+
 /* Likewise for `short' and `char' constants.  */
 
 #define ASM_OUTPUT_SHORT(FILE,VALUE)  \
@@ -1899,6 +1973,18 @@ extern struct rtx_def *hppa_legitimize_address ();
 #define ASM_OUTPUT_BYTE(FILE,VALUE)  \
   fprintf (FILE, "\t.byte 0x%x\n", (VALUE))
 
+#define ASM_GLOBALIZE_LABEL(FILE, NAME)                                        \
+  do {                                                                 \
+    /* We only handle DATA objects here, functions are globalized in   \
+       ASM_DECLARE_FUNCTION_NAME.  */                                  \
+    if (! FUNCTION_NAME_P (NAME))                                      \
+      {                                                                        \
+       fputs ("\t.EXPORT ", FILE);                                     \
+       assemble_name (FILE, NAME);                                     \
+       fputs (",DATA\n", FILE);                                        \
+      }                                                                        \
+  } while (0)
+
 #define ASM_OUTPUT_ASCII(FILE, P, SIZE)  \
   output_ascii ((FILE), (P), (SIZE))
 
index e9e9ceb418465843c22feedb6e35603157c5a849..f9c7682d2eaf9217c5cdfb0c4b515392414d13cd 100644 (file)
@@ -136,59 +136,6 @@ do {                                                               \
 #endif
 
 \f
-/* 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).
-
-   The macro definition, if any, is executed immediately after the
-   rtl for DECL or other node is created.
-   The value of the rtl will be a `mem' whose address is a
-   `symbol_ref'.
-
-   The usual thing for this macro to do is to a flag in the
-   `symbol_ref' (such as `SYMBOL_REF_FLAG') or to store a modified
-   name string in the `symbol_ref' (if one bit is not enough
-   information).
-
-   On the HP-PA we use this to indicate if a symbol is in text or
-   data space.  Also, function labels need special treatment. */
-
-#define TEXT_SPACE_P(DECL)\
-  (TREE_CODE (DECL) == FUNCTION_DECL                                   \
-   || (TREE_CODE (DECL) == VAR_DECL                                    \
-       && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL)           \
-       && (! DECL_INITIAL (DECL) || ! reloc_needed (DECL_INITIAL (DECL))) \
-       && !flag_pic)                                                   \
-   || (TREE_CODE_CLASS (TREE_CODE (DECL)) == 'c'                       \
-       && !(TREE_CODE (DECL) == STRING_CST && flag_writable_strings)))
-
-#define FUNCTION_NAME_P(NAME) \
-(*(NAME) == '@' || (*(NAME) == '*' && *((NAME) + 1) == '@'))
-
-#define ENCODE_SECTION_INFO(DECL)\
-do                                                     \
-  { if (TEXT_SPACE_P (DECL))                           \
-      {        rtx _rtl;                                       \
-       if (TREE_CODE (DECL) == FUNCTION_DECL           \
-           || TREE_CODE (DECL) == VAR_DECL)            \
-         _rtl = DECL_RTL (DECL);                       \
-       else                                            \
-         _rtl = TREE_CST_RTL (DECL);                   \
-       SYMBOL_REF_FLAG (XEXP (_rtl, 0)) = 1;           \
-       if (TREE_CODE (DECL) == FUNCTION_DECL)          \
-         hppa_encode_label (XEXP (DECL_RTL (DECL), 0), 0);\
-      }                                                        \
-  }                                                    \
-while (0)
-
-/* Store the user-specified part of SYMBOL_NAME in VAR.
-   This is sort of inverse to ENCODE_SECTION_INFO.  */
-
-#define STRIP_NAME_ENCODING(VAR,SYMBOL_NAME)   \
-  (VAR) = ((SYMBOL_NAME)  + ((SYMBOL_NAME)[0] == '*' ? \
-                            1 + (SYMBOL_NAME)[1] == '@'\
-                            : (SYMBOL_NAME)[0] == '@'))
-
 /* NAME refers to the function's name.  If we are placing each function into
    its own section, we need to switch to the section for this function.  Note
    that the section name will have a "." prefix.  */
@@ -395,7 +342,11 @@ DTORS_SECTION_FUNCTION
 
    We call assemble_name, which in turn sets TREE_SYMBOL_REFERENCED.  This
    macro will restore the original value of TREE_SYMBOL_REFERENCED to avoid
-   placing useless function definitions in the output file.  */
+   placing useless function definitions in the output file.
+
+   Also note that the SOM based tools need the symbol imported as a CODE
+   symbol, while the ELF based tools require the symbol to be imported as
+   an ENTRY symbol.  What a crock.  */
 
 #define ASM_OUTPUT_EXTERNAL(FILE, DECL, NAME)  \
   do { int save_referenced;                                    \
@@ -425,34 +376,8 @@ DTORS_SECTION_FUNCTION
        fputs (",CODE\n", FILE);                                                \
      } while (0)
 
-#define ASM_GLOBALIZE_LABEL(FILE, NAME)                                        \
-  do {                                                                 \
-    /* We only handle DATA objects here, functions are globalized in   \
-       ASM_DECLARE_FUNCTION_NAME.  */                                  \
-    if (! FUNCTION_NAME_P (NAME))                                      \
-      {                                                                        \
-       fputs ("\t.EXPORT ", FILE);                                     \
-       assemble_name (FILE, NAME);                                     \
-       fputs (",DATA\n", FILE);                                        \
-      }                                                                        \
-  } while (0)
-
 #define ASM_FILE_END(FILE) output_deferred_plabels (FILE)
 
-/* This is how to output an assembler line defining an `int' constant. 
-
-   This is made more complicated by the fact that functions must be
-   prefixed by a P% as well as code label references for the exception
-   table -- otherwise the linker chokes.  */
-
-#define ASM_OUTPUT_INT(FILE,VALUE)  \
-{ fputs ("\t.word ", FILE);                    \
-  if (function_label_operand (VALUE, VOIDmode))        \
-    fputs ("P%", FILE);                                \
-  output_addr_const (FILE, (VALUE));           \
-  fputs ("\n", FILE);}
-
-
 /* We want __gcc_plt_call to appear in every program built by
    gcc, so we make a reference to it out of __main.
    We use the asm statement to fool the optimizer into not