* elf-hppa.h (elf_hppa_fake_sections): Compute section indices
authorJeff Law <law@redhat.com>
Fri, 20 Aug 1999 23:03:04 +0000 (23:03 +0000)
committerJeff Law <law@redhat.com>
Fri, 20 Aug 1999 23:03:04 +0000 (23:03 +0000)
        here instead of using elf_section_data...

bfd/ChangeLog
bfd/elf-hppa.h

index 40916d9..dfcaaef 100644 (file)
@@ -1,3 +1,8 @@
+Fri Aug 20 17:01:23 1999  Jeffrey A Law  (law@cygnus.com)
+
+       * elf-hppa.h (elf_hppa_fake_sections): Compute section indices
+       here instead of using elf_section_data...
+
 1999-08-19  Nick Clifton  <nickc@cygnus.com>
 
        * coff-mcore.c (mcore_emit_base_file_entry): New function:  Emit
index 413b371..f3099b8 100644 (file)
@@ -636,15 +636,27 @@ elf_hppa_fake_sections (abfd, hdr, sec)
 
   if (strcmp (name, ".PARISC.unwind") == 0)
     {
+      int indx;
       asection *sec;
       hdr->sh_type = SHT_LOPROC + 1;
       /* ?!? How are unwinds supposed to work for symbols in arbitrary
         sections?  Or what if we have multiple .text sections in a single
-        .o file?  HP really messed up on this one.  */
-      sec = bfd_get_section_by_name (abfd, ".text");
-      if (sec != NULL)
-       hdr->sh_info = elf_section_data (sec)->this_idx;
+        .o file?  HP really messed up on this one. 
 
+        Ugh.  We can not use elf_section_data (sec)->this_idx at this
+        point because it is not initialized yet.
+
+        So we (gasp) recompute it here.  Hopefully nobody ever changes the
+        way sections are numbered in elf.c!  */
+      for (sec = abfd->sections, indx = 1; sec; sec = sec->next, indx++)
+       {
+         if (sec->name && strcmp (sec->name, ".text") == 0)
+           {
+             hdr->sh_info = indx;
+             break;
+           }
+       }
+      
       /* I have no idea if this is really necessary or what it means.  */
       hdr->sh_entsize = 4;
     }