FreeBSD/contrib/gcc/varasm.c
/* Select a set of attributes for section NAME based on the properties
   of DECL and whether or not RELOC indicates that DECL's initializer
   might contain runtime relocations.

   We make the section read-only and executable for a function decl,
   read-only for a const data decl, and writable for a non-const data decl.  */
Select a set of attributes for section NAME based on the properties
of DECL and whether or not RELOC indicates that DECL's initializer
might contain runtime relocations.

We make the section read-only and executable for a function decl,
read-only for a const data decl, and writable for a non-const data decl.
Select a set of attributes for section NAME based on the properties of DECL and whether or not RELOC indicates that DECL ' s initializer might contain runtime relocations . We make the section read - only and executable for a function decl read - only for a const data decl and writable for a non - const data decl .
unsigned int
default_section_type_flags (tree decl, const char *name, int reloc)
{
  unsigned int flags;
  if (decl && TREE_CODE (decl) == FUNCTION_DECL)
    flags = SECTION_CODE;
  else if (decl && decl_readonly_section (decl, reloc))
    flags = 0;
  else if (current_function_decl
	   && cfun
	   && cfun->unlikely_text_section_name
	   && strcmp (name, cfun->unlikely_text_section_name) == 0)
    flags = SECTION_CODE;
  else if (!decl
	   && (!current_function_decl || !cfun)
	   && strcmp (name, UNLIKELY_EXECUTED_TEXT_SECTION_NAME) == 0)
    flags = SECTION_CODE;
  else
    flags = SECTION_WRITE;
  if (decl && DECL_ONE_ONLY (decl))
    flags |= SECTION_LINKONCE;
  if (decl && TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
    flags |= SECTION_TLS | SECTION_WRITE;
  if (strcmp (name, ".bss") == 0
      || strncmp (name, ".bss.", 5) == 0
      || strncmp (name, ".gnu.linkonce.b.", 16) == 0
      || strcmp (name, ".sbss") == 0
      || strncmp (name, ".sbss.", 6) == 0
      || strncmp (name, ".gnu.linkonce.sb.", 17) == 0)
    flags |= SECTION_BSS;
  if (strcmp (name, ".tdata") == 0
      || strncmp (name, ".tdata.", 7) == 0
      || strncmp (name, ".gnu.linkonce.td.", 17) == 0)
    flags |= SECTION_TLS;
  if (strcmp (name, ".tbss") == 0
      || strncmp (name, ".tbss.", 6) == 0
      || strncmp (name, ".gnu.linkonce.tb.", 17) == 0)
    flags |= SECTION_TLS | SECTION_BSS;
  if (!(flags & (SECTION_CODE | SECTION_BSS | SECTION_TLS))
      && (strcmp (name, ".init_array") == 0
	  || strcmp (name, ".fini_array") == 0
	  || strcmp (name, ".preinit_array") == 0))
    flags |= SECTION_NOTYPE;
  return flags;
}
unsigned int default_section_type_flags ( tree decl , const char * name , int reloc ) { unsigned int flags ; if ( decl && TREE_CODE ( decl ) == FUNCTION_DECL ) flags = SECTION_CODE ; else if ( decl && decl_readonly_section ( decl , reloc ) ) flags = 0 ; else if ( current_function_decl && cfun && cfun -> unlikely_text_section_name && strcmp ( name , cfun -> unlikely_text_section_name ) == 0 ) flags = SECTION_CODE ; else if ( ! decl && ( ! current_function_decl || ! cfun ) && strcmp ( name , UNLIKELY_EXECUTED_TEXT_SECTION_NAME ) == 0 ) flags = SECTION_CODE ; else flags = SECTION_WRITE ; if ( decl && DECL_ONE_ONLY ( decl ) ) flags |= SECTION_LINKONCE ; if ( decl && TREE_CODE ( decl ) == VAR_DECL && DECL_THREAD_LOCAL_P ( decl ) ) flags |= SECTION_TLS | SECTION_WRITE ; if ( strcmp ( name , " " ) == 0 || strncmp ( name , " " , 5 ) == 0 || strncmp ( name , " " , 16 ) == 0 || strcmp ( name , " " ) == 0 || strncmp ( name , " " , 6 ) == 0 || strncmp ( name , " " , 17 ) == 0 ) flags |= SECTION_BSS ; if ( strcmp ( name , " " ) == 0 || strncmp ( name , " " , 7 ) == 0 || strncmp ( name , " " , 17 ) == 0 ) flags |= SECTION_TLS ; if ( strcmp ( name , " " ) == 0 || strncmp ( name , " " , 6 ) == 0 || strncmp ( name , " " , 17 ) == 0 ) flags |= SECTION_TLS | SECTION_BSS ; if ( ! ( flags & ( SECTION_CODE | SECTION_BSS | SECTION_TLS ) ) && ( strcmp ( name , " " ) == 0 || strcmp ( name , " " ) == 0 || strcmp ( name , " " ) == 0 ) ) flags |= SECTION_NOTYPE ; return flags ; }
Select a set of attributes for section NAME based on the properties
of DECL and whether or not RELOC indicates that DECL's initializer
might contain runtime relocations.
Select a set of attributes for section NAME based on the properties of DECL and whether or not RELOC indicates that DECL ' s initializer might contain runtime relocations .
/* These three sections have special ELF types.  They are neither
     SHT_PROGBITS nor SHT_NOBITS, so when changing sections we don't
     want to print a section type (@progbits or @nobits).  If someone
     is silly enough to emit code or TLS variables to one of these
     sections, then don't handle them specially.  */