/* Generic symbol-table support for the BFD library.
- Copyright (C) 1990-2019 Free Software Foundation, Inc.
+ Copyright (C) 1990-2020 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
char *directory_name;
char *file_name;
char *function_name;
+ int idx;
};
/* Compare two indexentry structures. This is called via qsort. */
if (contestantA->val < contestantB->val)
return -1;
- else if (contestantA->val > contestantB->val)
+ if (contestantA->val > contestantB->val)
return 1;
- else
- return 0;
+ return contestantA->idx - contestantB->idx;
}
/* A pointer to this structure is stored in *pinfo. */
arelent *r;
unsigned long val;
asymbol *sym;
+ bfd_size_type octets;
r = *pr;
/* Ignore R_*_NONE relocs. */
if (r->howto->dst_mask == 0)
continue;
+ octets = r->address * bfd_octets_per_byte (abfd, NULL);
if (r->howto->rightshift != 0
|| r->howto->size != 2
|| r->howto->bitsize != 32
|| r->howto->pc_relative
|| r->howto->bitpos != 0
|| r->howto->dst_mask != 0xffffffff
- || r->address * bfd_octets_per_byte (abfd) + 4 > stabsize)
+ || octets + 4 > stabsize)
{
_bfd_error_handler
(_("unsupported .stab relocation"));
return FALSE;
}
- val = bfd_get_32 (abfd, info->stabs
- + r->address * bfd_octets_per_byte (abfd));
+ val = bfd_get_32 (abfd, info->stabs + octets);
val &= r->howto->src_mask;
sym = *r->sym_ptr_ptr;
val += sym->value + sym->section->vma + r->addend;
- bfd_put_32 (abfd, (bfd_vma) val, info->stabs
- + r->address * bfd_octets_per_byte (abfd));
+ bfd_put_32 (abfd, (bfd_vma) val, info->stabs + octets);
}
}
info->indextable[i].directory_name = directory_name;
info->indextable[i].file_name = file_name;
info->indextable[i].function_name = NULL;
+ info->indextable[i].idx = i;
++i;
}
info->indextable[i].directory_name = directory_name;
info->indextable[i].file_name = file_name;
info->indextable[i].function_name = function_name;
+ info->indextable[i].idx = i;
++i;
break;
}
info->indextable[i].directory_name = directory_name;
info->indextable[i].file_name = file_name;
info->indextable[i].function_name = NULL;
+ info->indextable[i].idx = i;
++i;
}
info->indextable[i].directory_name = NULL;
info->indextable[i].file_name = NULL;
info->indextable[i].function_name = NULL;
+ info->indextable[i].idx = i;
++i;
info->indextablesize = i;