diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aee97d8d12de..9bfa84d15f51 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-08-29 Paolo Bonzini + + PR target/33168 + * config/rs6000/rs6000.c (compare_section_name): New function. + (rs6000_elf_in_small_data_p): Compare section prefixes instead + of full name. + 2007-08-29 Olivier Hainque * xcoffout.c: #include debug.h. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index dbf7e785a655..38659bf1554a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -19234,6 +19234,16 @@ rs6000_elf_encode_section_info (tree decl, rtx rtl, int first) } } +static inline bool +compare_section_name (const char *section, const char *template) +{ + int len; + + len = strlen (template); + return (strncmp (section, template, len) == 0 + && (section[len] == 0 || section[len] == '.')); +} + bool rs6000_elf_in_small_data_p (const_tree decl) { @@ -19251,10 +19261,12 @@ rs6000_elf_in_small_data_p (const_tree decl) if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl)) { const char *section = TREE_STRING_POINTER (DECL_SECTION_NAME (decl)); - if (strcmp (section, ".sdata") == 0 - || strcmp (section, ".sdata2") == 0 - || strcmp (section, ".sbss") == 0 - || strcmp (section, ".sbss2") == 0 + if (compare_section_name (section, ".sdata") == 0 + || compare_section_name (section, ".sdata2") == 0 + || compare_section_name (section, ".gnu.linkonce.s") == 0 + || compare_section_name (section, ".sbss") == 0 + || compare_section_name (section, ".sbss2") == 0 + || compare_section_name (section, ".gnu.linkonce.sb") == 0 || strcmp (section, ".PPC.EMB.sdata0") == 0 || strcmp (section, ".PPC.EMB.sbss0") == 0) return true;