FreeBSD/contrib/binutils/bfd/elf.c
/* Canonicalize the dynamic relocation entries.  Note that we return the
   dynamic relocations as a single block, although they are actually
   associated with particular sections; the interface, which was
   designed for SunOS style shared libraries, expects that there is only
   one set of dynamic relocs.  Any loadable section that was actually
   installed in the BFD, and has type SHT_REL or SHT_RELA, and uses the
   dynamic symbol table, is considered to be a dynamic reloc section.  */
Canonicalize the dynamic relocation entries.  Note that we return the
dynamic relocations as a single block, although they are actually
associated with particular sections; the interface, which was
designed for SunOS style shared libraries, expects that there is only
one set of dynamic relocs.  Any loadable section that was actually
installed in the BFD, and has type SHT_REL or SHT_RELA, and uses the
dynamic symbol table, is considered to be a dynamic reloc section.
Canonicalize the dynamic relocation entries . Note that we return the dynamic relocations as a single block although they are actually associated with particular sections ; the interface which was designed for SunOS style shared libraries expects that there is only one set of dynamic relocs . Any loadable section that was actually installed in the BFD and has type SHT_REL or SHT_RELA and uses the dynamic symbol table is considered to be a dynamic reloc section .
long
_bfd_elf_canonicalize_dynamic_reloc (bfd *abfd,
				     arelent **storage,
				     asymbol **syms)
{
  bfd_boolean (*slurp_relocs) (bfd *, asection *, asymbol **, bfd_boolean);
  asection *s;
  long ret;
  if (elf_dynsymtab (abfd) == 0)
    {
      bfd_set_error (bfd_error_invalid_operation);
      return -1;
    }
  slurp_relocs = get_elf_backend_data (abfd)->s->slurp_reloc_table;
  ret = 0;
  for (s = abfd->sections; s != NULL; s = s->next)
    {
      if ((s->flags & SEC_LOAD) != 0
	  && elf_section_data (s)->this_hdr.sh_link == elf_dynsymtab (abfd)
	  && (elf_section_data (s)->this_hdr.sh_type == SHT_REL
	      || elf_section_data (s)->this_hdr.sh_type == SHT_RELA))
	{
	  arelent *p;
	  long count, i;
	  if (! (*slurp_relocs) (abfd, s, syms, TRUE))
	    return -1;
	  count = s->size / elf_section_data (s)->this_hdr.sh_entsize;
	  p = s->relocation;
	  for (i = 0; i < count; i++)
	    *storage++ = p++;
	  ret += count;
	}
    }
  *storage = NULL;
  return ret;
}
long _bfd_elf_canonicalize_dynamic_reloc ( bfd * abfd , arelent * * storage , asymbol * * syms ) { bfd_boolean ( * slurp_relocs ) ( bfd * , asection * , asymbol * * , bfd_boolean ) ; asection * s ; long ret ; if ( elf_dynsymtab ( abfd ) == 0 ) { bfd_set_error ( bfd_error_invalid_operation ) ; return -1 ; } slurp_relocs = get_elf_backend_data ( abfd ) -> s -> slurp_reloc_table ; ret = 0 ; for ( s = abfd -> sections ; s != NULL ; s = s -> next ) { if ( ( s -> flags & SEC_LOAD ) != 0 && elf_section_data ( s ) -> this_hdr . sh_link == elf_dynsymtab ( abfd ) && ( elf_section_data ( s ) -> this_hdr . sh_type == SHT_REL || elf_section_data ( s ) -> this_hdr . sh_type == SHT_RELA ) ) { arelent * p ; long count , i ; if ( ! ( * slurp_relocs ) ( abfd , s , syms , TRUE ) ) return -1 ; count = s -> size / elf_section_data ( s ) -> this_hdr . sh_entsize ; p = s -> relocation ; for ( i = 0 ; i < count ; i ++ ) * storage ++ = p ++ ; ret += count ; } } * storage = NULL ; return ret ; }
Canonicalize the dynamic relocation entries.
Canonicalize the dynamic relocation entries .