OSDN Git Service

* rs6000.c (rs6000_assemble_visibility): Protect declaration
authordje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Sep 2002 12:39:20 +0000 (12:39 +0000)
committerdje <dje@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Sep 2002 12:39:20 +0000 (12:39 +0000)
        inside macro.  Correct function definition typo.
        (rs6000_xcoff_section_type_flags): New function.
        (TARGET_SECTION_TYPE_FLAGS): Remove definition.
        (rs6000_elf_section_type_flags): Call default_section_type_flags_1
        with appropriate PIC test.
        (rs6000_xcoff_select_section): Use decl_readonly_section_1 to
        determine readonly.
        (rs6000_binds_local_p): Combine PIC flags.
        * sysv4.h (TARGET_SECTION_TYPE_FLAGS): Define.
        * xcoff.h (TARGET_SECTION_TYPE_FLAGS): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57005 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/sysv4.h
gcc/config/rs6000/xcoff.h

index fb214bd..dedab93 100644 (file)
@@ -1,3 +1,17 @@
+2002-09-10  David Edelsohn  <edelsohn@gnu.org>
+
+       * rs6000.c (rs6000_assemble_visibility): Protect declaration
+       inside macro.  Correct function definition typo.
+       (rs6000_xcoff_section_type_flags): New function.
+       (TARGET_SECTION_TYPE_FLAGS): Remove definition.
+       (rs6000_elf_section_type_flags): Call default_section_type_flags_1
+       with appropriate PIC test.
+       (rs6000_xcoff_select_section): Use decl_readonly_section_1 to
+       determine readonly.
+       (rs6000_binds_local_p): Combine PIC flags.
+       * sysv4.h (TARGET_SECTION_TYPE_FLAGS): Define.
+       * xcoff.h (TARGET_SECTION_TYPE_FLAGS): Define.
+
 2002-09-09  Per Bothner  <per@bothner.com>
 
        * print-tree.c (print_node):  In a STRING_CST, escape non-ascii
index dbdb008..c6cf095 100644 (file)
@@ -186,7 +186,9 @@ static void toc_hash_mark_table PARAMS ((void *));
 static int constant_pool_expr_1 PARAMS ((rtx, int *, int *));
 static struct machine_function * rs6000_init_machine_status PARAMS ((void));
 static bool rs6000_assemble_integer PARAMS ((rtx, unsigned int, int));
+#ifdef HAVE_GAS_HIDDEN
 static void rs6000_assemble_visibility PARAMS ((tree, const char *));
+#endif
 static int rs6000_ra_ever_killed PARAMS ((void));
 static tree rs6000_handle_longcall_attribute PARAMS ((tree *, tree, tree, int, bool *));
 const struct attribute_spec rs6000_attribute_table[];
@@ -219,6 +221,7 @@ static void rs6000_xcoff_unique_section PARAMS ((tree, int));
 static void rs6000_xcoff_select_rtx_section PARAMS ((enum machine_mode, rtx,
                                                     unsigned HOST_WIDE_INT));
 static const char * rs6000_xcoff_strip_name_encoding PARAMS ((const char *));
+static unsigned int rs6000_xcoff_section_type_flags PARAMS ((tree, const char *, int));
 #endif
 static void rs6000_xcoff_encode_section_info PARAMS ((tree, int))
      ATTRIBUTE_UNUSED;
@@ -355,11 +358,6 @@ static const char alt_reg_names[][8] =
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE rs6000_output_function_epilogue
 
-#if TARGET_ELF
-#undef TARGET_SECTION_TYPE_FLAGS
-#define TARGET_SECTION_TYPE_FLAGS  rs6000_elf_section_type_flags
-#endif
-
 #undef TARGET_SCHED_ISSUE_RATE
 #define TARGET_SCHED_ISSUE_RATE rs6000_issue_rate
 #undef TARGET_SCHED_ADJUST_COST
@@ -8163,7 +8161,7 @@ rs6000_assemble_integer (x, size, aligned_p)
 /* Emit an assembler directive to set symbol visibility for DECL to
    VISIBILITY_TYPE.  */
 
-void
+static void
 rs6000_assemble_visibility (decl, visibility_type)
      tree decl;
      const char *visibility_type;
@@ -12992,7 +12990,9 @@ rs6000_elf_section_type_flags (decl, name, reloc)
      const char *name;
      int reloc;
 {
-  unsigned int flags = default_section_type_flags (decl, name, reloc);
+  unsigned int flags
+    = default_section_type_flags_1 (decl, name, reloc,
+                                   flag_pic || DEFAULT_ABI == ABI_AIX);
 
   if (TARGET_RELOCATABLE)
     flags |= SECTION_WRITE;
@@ -13107,25 +13107,7 @@ rs6000_xcoff_select_section (decl, reloc, align)
      int reloc;
      unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED;
 {
-  bool readonly = false;
-
-  if (TREE_CODE (decl) == STRING_CST)
-    readonly = !flag_writable_strings;
-  else if (TREE_CODE (decl) == VAR_DECL)
-    readonly = (!reloc
-               && TREE_READONLY (decl)
-               && !TREE_SIDE_EFFECTS (decl)
-               && DECL_INITIAL (decl)
-               && DECL_INITIAL (decl) != error_mark_node
-               && TREE_CONSTANT (DECL_INITIAL (decl)));
-  else if (TREE_CODE (decl) == CONSTRUCTOR)
-    readonly = (!reloc
-               && !TREE_SIDE_EFFECTS (decl)
-               && TREE_CONSTANT (decl));
-  else
-    readonly = !reloc;
-
-  if (readonly)
+  if (decl_readonly_section_1 (decl, reloc, 1))
     {
       if (TREE_PUBLIC (decl))
         read_only_data_section ();
@@ -13195,6 +13177,17 @@ rs6000_xcoff_strip_name_encoding (name)
     return name;
 }
 
+/* Section attributes.  AIX is always PIC.  */
+
+static unsigned int
+rs6000_xcoff_section_type_flags (decl, name, reloc)
+     tree decl;
+     const char *name;
+     int reloc;
+{
+  return default_section_type_flags_1 (decl, name, reloc, 1);
+}
+
 #endif /* TARGET_XCOFF */
 
 /* Note that this is also used for PPC64 Linux.  */
@@ -13217,9 +13210,6 @@ static bool
 rs6000_binds_local_p (decl)
      tree decl;
 {
-  if (DEFAULT_ABI == ABI_AIX)
-    return default_binds_local_p_1 (decl, rs6000_flag_pic);
-  else
-    return default_binds_local_p_1 (decl, flag_pic);
+  return default_binds_local_p_1 (decl, flag_pic || rs6000_flag_pic);
 }
 
index f77e284..89b12a5 100644 (file)
@@ -789,6 +789,7 @@ extern int fixuplabelno;
 #define TARGET_ENCODE_SECTION_INFO  rs6000_elf_encode_section_info
 #define TARGET_STRIP_NAME_ENCODING  rs6000_elf_strip_name_encoding
 #define TARGET_IN_SMALL_DATA_P  rs6000_elf_in_small_data_p
+#define TARGET_SECTION_TYPE_FLAGS  rs6000_elf_section_type_flags
 
 /* The ELF version doesn't encode [DS] or whatever at the end of symbols.  */
 
index d032b65..dbe18ea 100644 (file)
@@ -161,9 +161,14 @@ toc_section ()                                             \
               || (GET_MODE_CLASS (GET_MODE (X)) == MODE_FLOAT          \
                   && ! TARGET_NO_FP_IN_TOC)))))
 
+#define TARGET_ASM_GLOBALIZE_LABEL  rs6000_xcoff_asm_globalize_label
+#define TARGET_ASM_NAMED_SECTION  rs6000_xcoff_asm_named_section
+#define TARGET_ASM_SELECT_SECTION  rs6000_xcoff_select_section
 #define TARGET_ASM_SELECT_RTX_SECTION  rs6000_xcoff_select_rtx_section
+#define TARGET_ASM_UNIQUE_SECTION  rs6000_xcoff_unique_section
 #define TARGET_ENCODE_SECTION_INFO rs6000_xcoff_encode_section_info
 #define TARGET_STRIP_NAME_ENCODING rs6000_xcoff_strip_name_encoding
+#define TARGET_SECTION_TYPE_FLAGS  rs6000_xcoff_section_type_flags
 
 /* FP save and restore routines.  */
 #define        SAVE_FP_PREFIX "._savef"
@@ -411,15 +416,6 @@ toc_section ()                                             \
    Align entire section to BIGGEST_ALIGNMENT.  */
 #define DATA_SECTION_ASM_OP "\t.csect .data[RW],3"
 
-/* Define unique section name -- functions only.  */
-#define TARGET_ASM_UNIQUE_SECTION  rs6000_xcoff_unique_section
-
-/* Switch into a generic section.  */
-#define TARGET_ASM_NAMED_SECTION  rs6000_xcoff_asm_named_section
-
-/* Globalize a label.  */
-#define TARGET_ASM_GLOBALIZE_LABEL  rs6000_xcoff_asm_globalize_label
-
 /* Define the name of the section to use for the EH language specific
    data areas (.gcc_except_table on most other systems).  */
 #define TARGET_ASM_EXCEPTION_SECTION data_section