bfd/elf.c : bfd_seek to 0 valid ?

jeroen dobbelaere jeroen.dobbelaere@acunia.com
Thu Nov 7 06:42:00 GMT 2002


on ARM, I'm seeing that in

bfd/elf.c :
_bfd_elf_set_section_contents

Sometimes, the section content is written to seek position 0 :

boolean
_bfd_elf_set_section_contents (abfd, section, location, offset, count)
      bfd *abfd;
      sec_ptr section;
      PTR location;
      file_ptr offset;
      bfd_size_type count;
{
   Elf_Internal_Shdr *hdr;
   bfd_signed_vma pos;

   if (! abfd->output_has_begun
       && ! (_bfd_elf_compute_section_file_positions
	    (abfd, (struct bfd_link_info *) NULL)))
     return false;

   hdr = &elf_section_data (section)->this_hdr;
   pos = hdr->sh_offset + offset;               /* pos is sometimes 0 (!) */

   if (bfd_seek (abfd, pos, SEEK_SET) != 0
       || bfd_bwrite (location, count, abfd) != count)
     return false;

   return true;
}

This could explain the fact that section '.rel.dyn' disappears...
(It is section .rel.dyn that is written to fileposition 0;
this section is needed in the program so that variables in the .got
are updated)

(see <http://sources.redhat.com/ml/binutils/2002-11/msg00139.html>)

Is this a valid value for 'pos', or would this indicate a problem somewhere else ?

Greetings,
-- 
Jeroen Dobbelaere
Embedded Software Engineer

ACUNIA Embedded Solutions
http://www.acunia.com/aes




More information about the Binutils mailing list