FreeBSD/contrib/binutils/bfd/elf.c
/* Copy private BFD data.  This copies or rewrites ELF program header
   information.  */
Copy private BFD data.  This copies or rewrites ELF program header
information.
Copy private BFD data . This copies or rewrites ELF program header information .
static bfd_boolean
copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
    return TRUE;
  if (elf_tdata (ibfd)->phdr == NULL)
    return TRUE;
  if (ibfd->xvec == obfd->xvec)
    {
      Elf_Internal_Phdr *segment;
      asection *section, *osec;
      unsigned int i, num_segments;
      Elf_Internal_Shdr *this_hdr;
      for (section = obfd->sections; section != NULL;
	   section = section->next)
	section->segment_mark = FALSE;
      num_segments = elf_elfheader (ibfd)->e_phnum;
      for (i = 0, segment = elf_tdata (ibfd)->phdr;
	   i < num_segments;
	   i++, segment++)
	{
	  if (segment->p_paddr == 0
	      && segment->p_memsz == 0
	      && (segment->p_type == PT_INTERP || segment->p_type == PT_DYNAMIC))
	    goto rewrite;
	  for (section = ibfd->sections;
	       section != NULL; section = section->next)
	    {
	      osec = section->output_section;
	      if (osec)
		osec->segment_mark = TRUE;
	      this_hdr = &(elf_section_data(section)->this_hdr);
	      if (ELF_IS_SECTION_IN_SEGMENT_FILE (this_hdr, segment))
		{
		  if (osec == NULL
		      || section->flags != osec->flags
		      || section->lma != osec->lma
		      || section->vma != osec->vma
		      || section->size != osec->size
		      || section->rawsize != osec->rawsize
		      || section->alignment_power != osec->alignment_power)
		    goto rewrite;
		}
	    }
	}
      for (section = obfd->sections; section != NULL;
	   section = section->next)
	{
	  if (section->segment_mark == FALSE)
	    goto rewrite;
	  else
	    section->segment_mark = FALSE;
	}
      return copy_elf_program_header (ibfd, obfd);
    }
rewrite:
  return rewrite_elf_program_header (ibfd, obfd);
}
static bfd_boolean copy_private_bfd_data ( bfd * ibfd , bfd * obfd ) { if ( bfd_get_flavour ( ibfd ) != bfd_target_elf_flavour || bfd_get_flavour ( obfd ) != bfd_target_elf_flavour ) return TRUE ; if ( elf_tdata ( ibfd ) -> phdr == NULL ) return TRUE ; if ( ibfd -> xvec == obfd -> xvec ) { Elf_Internal_Phdr * segment ; asection * section , * osec ; unsigned int i , num_segments ; Elf_Internal_Shdr * this_hdr ; for ( section = obfd -> sections ; section != NULL ; section = section -> next ) section -> segment_mark = FALSE ; num_segments = elf_elfheader ( ibfd ) -> e_phnum ; for ( i = 0 , segment = elf_tdata ( ibfd ) -> phdr ; i < num_segments ; i ++ , segment ++ ) { if ( segment -> p_paddr == 0 && segment -> p_memsz == 0 && ( segment -> p_type == PT_INTERP || segment -> p_type == PT_DYNAMIC ) ) goto rewrite ; for ( section = ibfd -> sections ; section != NULL ; section = section -> next ) { osec = section -> output_section ; if ( osec ) osec -> segment_mark = TRUE ; this_hdr = & ( elf_section_data ( section ) -> this_hdr ) ; if ( ELF_IS_SECTION_IN_SEGMENT_FILE ( this_hdr , segment ) ) { if ( osec == NULL || section -> flags != osec -> flags || section -> lma != osec -> lma || section -> vma != osec -> vma || section -> size != osec -> size || section -> rawsize != osec -> rawsize || section -> alignment_power != osec -> alignment_power ) goto rewrite ; } } } for ( section = obfd -> sections ; section != NULL ; section = section -> next ) { if ( section -> segment_mark == FALSE ) goto rewrite ; else section -> segment_mark = FALSE ; } return copy_elf_program_header ( ibfd , obfd ) ; } rewrite : return rewrite_elf_program_header ( ibfd , obfd ) ; }
Copy private BFD data.
Copy private BFD data .
/* Check to see if any sections in the input BFD
	 covered by ELF program header have changed.  */ /* Initialize the segment mark field.  */ /* PR binutils/3535.  The Solaris linker always sets the p_paddr
	     and p_memsz fields of special segments (DYNAMIC, INTERP) to 0
	     which severly confuses things, so always regenerate the segment
	     map in this case.  */ /* We mark the output section so that we know it comes
		 from the input BFD.  */ /* Check if this section is covered by the segment.  */ /* FIXME: Check if its output section is changed or
		     removed.  What else do we need to check?  */ /* Check to see if any output section do not come from the
	 input BFD.  */