FreeBSD/contrib/binutils/bfd/elf.c
/* Create a pseudosection containing SIZE bytes at FILEPOS.  This
   actually creates up to two pseudosections:
   - For the single-threaded case, a section named NAME, unless
     such a section already exists.
   - For the multi-threaded case, a section named "NAME/PID", where
     PID is elfcore_make_pid (abfd).
   Both pseudosections have identical contents. */
Create a pseudosection containing SIZE bytes at FILEPOS.  This
actually creates up to two pseudosections:
For the single-threaded case, a section named NAME, unless
such a section already exists.
For the multi-threaded case, a section named "NAME/PID", where
PID is elfcore_make_pid (abfd).
Both pseudosections have identical contents.
Create a pseudosection containing SIZE bytes at FILEPOS . This actually creates up to two pseudosections : For the single - threaded case a section named NAME unless such a section already exists . For the multi - threaded case a section named " NAME / PID " where PID is elfcore_make_pid ( abfd ) . Both pseudosections have identical contents .
bfd_boolean
_bfd_elfcore_make_pseudosection (bfd *abfd,
				 char *name,
				 size_t size,
				 ufile_ptr filepos)
{
  char buf[100];
  char *threaded_name;
  size_t len;
  asection *sect;
  sprintf (buf, "%s/%d", name, elfcore_make_pid (abfd));
  len = strlen (buf) + 1;
  threaded_name = bfd_alloc (abfd, len);
  if (threaded_name == NULL)
    return FALSE;
  memcpy (threaded_name, buf, len);
  sect = bfd_make_section_anyway_with_flags (abfd, threaded_name,
					     SEC_HAS_CONTENTS);
  if (sect == NULL)
    return FALSE;
  sect->size = size;
  sect->filepos = filepos;
  sect->alignment_power = 2;
  return elfcore_maybe_make_sect (abfd, name, sect);
}
bfd_boolean _bfd_elfcore_make_pseudosection ( bfd * abfd , char * name , size_t size , ufile_ptr filepos ) { char buf [ 100 ] ; char * threaded_name ; size_t len ; asection * sect ; sprintf ( buf , " " , name , elfcore_make_pid ( abfd ) ) ; len = strlen ( buf ) + 1 ; threaded_name = bfd_alloc ( abfd , len ) ; if ( threaded_name == NULL ) return FALSE ; memcpy ( threaded_name , buf , len ) ; sect = bfd_make_section_anyway_with_flags ( abfd , threaded_name , SEC_HAS_CONTENTS ) ; if ( sect == NULL ) return FALSE ; sect -> size = size ; sect -> filepos = filepos ; sect -> alignment_power = 2 ; return elfcore_maybe_make_sect ( abfd , name , sect ) ; }
Create a pseudosection containing SIZE bytes at FILEPOS.
Create a pseudosection containing SIZE bytes at FILEPOS .
/* Build the section name.  */