* elfcode.h (elf_sort_hdrs): Rewrite to be symmetrical.
This commit is contained in:
parent
3b1f83adad
commit
d1ec549d7b
2 changed files with 19 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Fri Jun 9 12:20:28 1995 Steve Chamberlain <sac@rtl.cygnus.com>
|
||||||
|
|
||||||
|
* elfcode.h (elf_sort_hdrs): Rewrite to be symmetrical.
|
||||||
|
|
||||||
Fri Jun 9 12:49:00 1995 Jeff Law (law@snake.cs.utah.edu)
|
Fri Jun 9 12:49:00 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||||
|
|
||||||
* bfd-in.h: (TRUE_FALSE_ALREADY_DEFINED): Define this if
|
* bfd-in.h: (TRUE_FALSE_ALREADY_DEFINED): Define this if
|
||||||
|
|
|
@ -2251,20 +2251,27 @@ assign_file_positions_except_relocs (abfd, dosyms)
|
||||||
/* Sort the ELF headers by VMA. We sort headers which are not
|
/* Sort the ELF headers by VMA. We sort headers which are not
|
||||||
SHF_ALLOC to the end. */
|
SHF_ALLOC to the end. */
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
elf_sort_hdrs (arg1, arg2)
|
elf_sort_hdrs (arg1, arg2)
|
||||||
const PTR arg1;
|
const PTR arg1;
|
||||||
const PTR arg2;
|
const PTR arg2;
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
const Elf_Internal_Shdr *hdr1 = *(const Elf_Internal_Shdr **) arg1;
|
const Elf_Internal_Shdr *hdr1 = *(const Elf_Internal_Shdr **) arg1;
|
||||||
const Elf_Internal_Shdr *hdr2 = *(const Elf_Internal_Shdr **) arg2;
|
const Elf_Internal_Shdr *hdr2 = *(const Elf_Internal_Shdr **) arg2;
|
||||||
|
|
||||||
if ((hdr1->sh_flags & SHF_ALLOC) != 0)
|
#define TOEND(x) (((x)->sh_flags & SHF_ALLOC)==0)
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if ((hdr2->sh_flags & SHF_ALLOC) == 0)
|
if (TOEND(hdr1))
|
||||||
|
if (TOEND(hdr2))
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (TOEND(hdr2))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (hdr1->sh_addr < hdr2->sh_addr)
|
if (hdr1->sh_addr < hdr2->sh_addr)
|
||||||
return -1;
|
return -1;
|
||||||
else if (hdr1->sh_addr > hdr2->sh_addr)
|
else if (hdr1->sh_addr > hdr2->sh_addr)
|
||||||
|
@ -2274,19 +2281,14 @@ elf_sort_hdrs (arg1, arg2)
|
||||||
ret = (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS);
|
ret = (hdr1->sh_type == SHT_NOBITS) - (hdr2->sh_type == SHT_NOBITS);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (hdr1->sh_size == 0)
|
if (hdr1->sh_size < hdr2->sh_size)
|
||||||
return -1;
|
return -1;
|
||||||
else if (hdr2->sh_size == 0)
|
if (hdr1->sh_size > hdr2->sh_size)
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((hdr2->sh_flags & SHF_ALLOC) != 0)
|
|
||||||
return 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
prep_headers (abfd)
|
prep_headers (abfd)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue