diff options
author | Alan Modra <amodra@gmail.com> | 2002-01-17 13:02:40 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-01-17 13:02:40 +0000 |
commit | af746e92cb01c5f1a2d0bdb194716a0542a86762 (patch) | |
tree | fd3becbca4116ca29eec1bc34dfcaec0c9fc5922 /bfd/elf.c | |
parent | 06f030db350108824d2a06fec35992ba084d92ca (diff) | |
download | gdb-af746e92cb01c5f1a2d0bdb194716a0542a86762.zip gdb-af746e92cb01c5f1a2d0bdb194716a0542a86762.tar.gz gdb-af746e92cb01c5f1a2d0bdb194716a0542a86762.tar.bz2 |
* elf-bfd.h (elf_backend_data <elf_backend_section_from_bfd_section>):
Remove "Elf_Internal_Shdr *" param.
(_bfd_mips_elf_section_from_bfd_section): Ditto.
* elf32-mips.c (_bfd_mips_elf_section_from_bfd_section): Ditto.
* elf32-m32r.c (_bfd_m32r_elf_section_from_bfd_section): Ditto.
* elf32-v850.c (v850_elf_section_from_bfd_section): Ditto.
* elf64-mmix.c (mmix_elf_section_from_bfd_section): Ditto.
* elfxx-ia64.c (elfNN_hpux_backend_section_from_bfd_section): Ditto.
* elf.c (_bfd_elf_section_from_bfd_section): Allow backend
function to override special sections. Remove hdr arg from
backend call, and don't loop.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r-- | bfd/elf.c | 53 |
1 files changed, 25 insertions, 28 deletions
@@ -4050,50 +4050,47 @@ _bfd_elf_section_from_bfd_section (abfd, asect) bfd *abfd; struct sec *asect; { - struct elf_backend_data *bed = get_elf_backend_data (abfd); - Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd); + struct elf_backend_data *bed; int index; - Elf_Internal_Shdr *hdr; - int maxindex = elf_numsections (abfd); if (elf_section_data (asect) != NULL && elf_section_data (asect)->this_idx != 0) return elf_section_data (asect)->this_idx; if (bfd_is_abs_section (asect)) - return SHN_ABS; - if (bfd_is_com_section (asect)) - return SHN_COMMON; - if (bfd_is_und_section (asect)) - return SHN_UNDEF; - - for (index = 1; index < maxindex; index++) + index = SHN_ABS; + else if (bfd_is_com_section (asect)) + index = SHN_COMMON; + else if (bfd_is_und_section (asect)) + index = SHN_UNDEF; + else { - hdr = i_shdrp[index]; - if (hdr != NULL && hdr->bfd_section == asect) - return index; + Elf_Internal_Shdr **i_shdrp = elf_elfsections (abfd); + int maxindex = elf_numsections (abfd); + + for (index = 1; index < maxindex; index++) + { + Elf_Internal_Shdr *hdr = i_shdrp[index]; + + if (hdr != NULL && hdr->bfd_section == asect) + return index; + } + index = -1; } + bed = get_elf_backend_data (abfd); if (bed->elf_backend_section_from_bfd_section) { - for (index = 0; index < maxindex; index++) - { - int retval; + int retval = index; - hdr = i_shdrp[index]; - if (hdr == NULL) - continue; - - retval = index; - if ((*bed->elf_backend_section_from_bfd_section) - (abfd, hdr, asect, &retval)) - return retval; - } + if ((*bed->elf_backend_section_from_bfd_section) (abfd, asect, &retval)) + return retval; } - bfd_set_error (bfd_error_nonrepresentable_section); + if (index == -1) + bfd_set_error (bfd_error_nonrepresentable_section); - return SHN_BAD; + return index; } /* Given a BFD symbol, return the index in the ELF symbol table, or -1 |