diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 14fa46998ce..cab4f487aa2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2002-09-11 David Edelsohn + + * 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. + 2002-09-10 John David Anglin * pa.md (extzv): Check predicates before emitting extzv_32. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c6cf09522d6..5974d3bce09 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -13096,9 +13096,9 @@ rs6000_xcoff_asm_named_section (name, flags) else smclass = 1; - fprintf (asm_out_file, "\t.csect %s%s[%s]\n", + fprintf (asm_out_file, "\t.csect %s%s[%s],%u\n", (flags & SECTION_CODE) ? "." : "", - name, suffix[smclass]); + name, suffix[smclass], flags & SECTION_ENTSIZE); } static void @@ -13130,8 +13130,9 @@ rs6000_xcoff_unique_section (decl, reloc) { const char *name; - /* Use select_section for uninitialized data. */ - if (DECL_COMMON (decl) + /* Use select_section for private and 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 @@ -13185,7 +13186,19 @@ rs6000_xcoff_section_type_flags (decl, name, reloc) const char *name; int reloc; { - return default_section_type_flags_1 (decl, name, reloc, 1); + 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 */ diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h index dbe18ead29d..b83f678b9f8 100644 --- a/gcc/config/rs6000/xcoff.h +++ b/gcc/config/rs6000/xcoff.h @@ -135,8 +135,6 @@ toc_section () \ #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), @@ -166,8 +164,8 @@ toc_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_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. */