This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] XCOFF select section tweak


	This patch adds support to pass CSECT alignment requirements
through the section flags variable.  It also ensures that non-public
symbols are collected into a statics pool instead of individual CSECTs
because CSECT names default to global.

	With the dbxout.c and xcoffout.h patches waiting for review, AIX
will support -ffunction-sections and -fdata-sections.

David


	* config/rs6000/rs6000.c (rs6000_xcoff_asm_named_section): Append
	alignment to csect.
	(rs6000_xcoff_unique_section): Only set section name for public
	data.
	(rs6000_xcoff_section_type_flags): Store log2 alignment in flags.
	* config/rs6000/xcoff.h (TARGET_ASM_SELECT_SECTION): Remove
	duplicate definition.


Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.374
diff -c -p -r1.374 rs6000.c
*** rs6000.c	10 Sep 2002 12:39:19 -0000	1.374
--- rs6000.c	11 Sep 2002 17:24:56 -0000
*************** rs6000_xcoff_asm_named_section (name, fl
*** 13096,13104 ****
    else
      smclass = 1;
  
!   fprintf (asm_out_file, "\t.csect %s%s[%s]\n",
  	   (flags & SECTION_CODE) ? "." : "",
! 	   name, suffix[smclass]);
  }
  
  static void
--- 13096,13104 ----
    else
      smclass = 1;
  
!   fprintf (asm_out_file, "\t.csect %s%s[%s],%u\n",
  	   (flags & SECTION_CODE) ? "." : "",
! 	   name, suffix[smclass], flags & SECTION_ENTSIZE);
  }
  
  static void
*************** rs6000_xcoff_unique_section (decl, reloc
*** 13131,13137 ****
    const char *name;
  
    /* Use select_section for uninitialized data.  */
!   if (DECL_COMMON (decl)
        || DECL_INITIAL (decl) == NULL_TREE
        || DECL_INITIAL (decl) == error_mark_node
        || (flag_zero_initialized_in_bss
--- 13131,13138 ----
    const char *name;
  
    /* Use select_section for uninitialized data.  */
!   if (!TREE_PUBLIC (decl)
!       || DECL_COMMON (decl)
        || DECL_INITIAL (decl) == NULL_TREE
        || DECL_INITIAL (decl) == error_mark_node
        || (flag_zero_initialized_in_bss
*************** rs6000_xcoff_section_type_flags (decl, n
*** 13185,13191 ****
       const char *name;
       int reloc;
  {
!   return default_section_type_flags_1 (decl, name, reloc, 1);
  }
  
  #endif /* TARGET_XCOFF */
--- 13186,13204 ----
       const char *name;
       int reloc;
  {
!   unsigned int align;
!   unsigned int flags = default_section_type_flags_1 (decl, name, reloc, 1);
! 
!   /* Align to at least UNIT size.  */
!   if (flags & SECTION_CODE)
!     align = MIN_UNITS_PER_WORD;
!   else
!     /* Increase alignment of large objects if not already stricter.  */
!     align = MAX ((DECL_ALIGN (decl) / BITS_PER_UNIT),
! 		 int_size_in_bytes (TREE_TYPE (decl)) > MIN_UNITS_PER_WORD
! 		 ? UNITS_PER_FP_WORD : MIN_UNITS_PER_WORD);
! 
!   return flags | (exact_log2 (align) & SECTION_ENTSIZE);
  }
  
  #endif /* TARGET_XCOFF */
Index: xcoff.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/xcoff.h,v
retrieving revision 1.35
diff -c -p -r1.35 xcoff.h
*** xcoff.h	10 Sep 2002 12:39:20 -0000	1.35
--- xcoff.h	11 Sep 2002 17:24:56 -0000
*************** toc_section ()						\
*** 135,142 ****
  
  #define READONLY_DATA_SECTION read_only_data_section
  
- #define TARGET_ASM_SELECT_SECTION  rs6000_xcoff_select_section
- 
  /* Return non-zero if this entry is to be written into the constant
     pool in a special way.  We do so if this is a SYMBOL_REF, LABEL_REF
     or a CONST containing one of them.  If -mfp-in-toc (the default),
--- 135,140 ----
*************** toc_section ()						\
*** 166,173 ****
  #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.  */
--- 164,171 ----
  #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.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]