FreeBSD/contrib/binutils/bfd/elf.c
/* Create a mapping from a set of sections to a program segment.  */
Create a mapping from a set of sections to a program segment.
Create a mapping from a set of sections to a program segment .
static struct elf_segment_map *
make_mapping (bfd *abfd,
	      asection **sections,
	      unsigned int from,
	      unsigned int to,
	      bfd_boolean phdr)
{
  struct elf_segment_map *m;
  unsigned int i;
  asection **hdrpp;
  bfd_size_type amt;
  amt = sizeof (struct elf_segment_map);
  amt += (to - from - 1) * sizeof (asection *);
  m = bfd_zalloc (abfd, amt);
  if (m == NULL)
    return NULL;
  m->next = NULL;
  m->p_type = PT_LOAD;
  for (i = from, hdrpp = sections + from; i < to; i++, hdrpp++)
    m->sections[i - from] = *hdrpp;
  m->count = to - from;
  if (from == 0 && phdr)
    {
      m->includes_filehdr = 1;
      m->includes_phdrs = 1;
    }
  return m;
}
static struct elf_segment_map * make_mapping ( bfd * abfd , asection * * sections , unsigned int from , unsigned int to , bfd_boolean phdr ) { struct elf_segment_map * m ; unsigned int i ; asection * * hdrpp ; bfd_size_type amt ; amt = sizeof ( struct elf_segment_map ) ; amt += ( to - from - 1 ) * sizeof ( asection * ) ; m = bfd_zalloc ( abfd , amt ) ; if ( m == NULL ) return NULL ; m -> next = NULL ; m -> p_type = PT_LOAD ; for ( i = from , hdrpp = sections + from ; i < to ; i ++ , hdrpp ++ ) m -> sections [ i - from ] = * hdrpp ; m -> count = to - from ; if ( from == 0 && phdr ) { m -> includes_filehdr = 1 ; m -> includes_phdrs = 1 ; } return m ; }
Create a mapping from a set of sections to a program segment.
Create a mapping from a set of sections to a program segment .
/* Include the headers in the first PT_LOAD segment.  */