From 1ca740621c86aba48d3201f0efd5fe584137f409 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 20 Aug 1999 23:03:04 +0000 Subject: [PATCH] * elf-hppa.h (elf_hppa_fake_sections): Compute section indices here instead of using elf_section_data... --- bfd/ChangeLog | 5 +++++ bfd/elf-hppa.h | 20 ++++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 40916d95796..dfcaaef098b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -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 * coff-mcore.c (mcore_emit_base_file_entry): New function: Emit diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h index 413b371bacd..f3099b8f8c2 100644 --- a/bfd/elf-hppa.h +++ b/bfd/elf-hppa.h @@ -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; } -- 2.30.2