diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-03-07 17:25:07 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-03-07 17:25:07 +0000 |
commit | d211786089fb029fbc7f7e5680be793dbac84879 (patch) | |
tree | c3ac6cc2e1e99bb5ef1d18b649fe5137016b6bdf /bfd/elfcode.h | |
parent | cc60ad636d07f0f6c082a0eb1579797f16812092 (diff) | |
download | gdb-d211786089fb029fbc7f7e5680be793dbac84879.zip gdb-d211786089fb029fbc7f7e5680be793dbac84879.tar.gz gdb-d211786089fb029fbc7f7e5680be793dbac84879.tar.bz2 |
* elfcode.h (elf_sort_hdrs): Check SHT_NOBITS before checking
sh_size.
Diffstat (limited to 'bfd/elfcode.h')
-rw-r--r-- | bfd/elfcode.h | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 72908ca..1766909 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -2261,28 +2261,24 @@ elf_sort_hdrs (arg1, arg2) if ((hdr1->sh_flags & SHF_ALLOC) != 0) { + int ret; + if ((hdr2->sh_flags & SHF_ALLOC) == 0) return -1; if (hdr1->sh_addr < hdr2->sh_addr) return -1; else if (hdr1->sh_addr > hdr2->sh_addr) return 1; + /* Put !SHT_NOBITS sections before SHT_NOBITS ones. + The main loop in map_program_segments requires this. */ + ret = (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS); + if (ret != 0) + return ret; if (hdr1->sh_size == 0) - { - if (hdr2->sh_size == 0) - { - /* Put !SHT_NOBITS sections before SHT_NOBITS ones. - The main loop in map_program_segments requires this. */ - return (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS); - } - else - return -1; - } + return -1; else if (hdr2->sh_size == 0) return 1; - /* Put !SHT_NOBITS sections before SHT_NOBITS ones. - The main loop in map_program_segments requires this. */ - return (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS); + return 0; } else { |