aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorJiong Wang <jiong.wang@arm.com>2014-11-24 13:43:39 +0000
committerJiong Wang <jiong.wang@arm.com>2014-11-24 13:43:39 +0000
commit520c7b56ac91e91120c59d7a85466ec9394277cf (patch)
tree8bb95fc76d83e53952dbf055f50b84dfc5a75de7 /bfd
parenta441dfbc4e339198cf9d27d21579fd04ff8c6e2c (diff)
downloadgdb-520c7b56ac91e91120c59d7a85466ec9394277cf.zip
gdb-520c7b56ac91e91120c59d7a85466ec9394277cf.tar.gz
gdb-520c7b56ac91e91120c59d7a85466ec9394277cf.tar.bz2
[AArch64] Cortex-A53 Erratum 835769 -- sort maps
2014-11-24 Tejas Belagod <tejas.belagod@arm.com> bfd/ * elfnn-aarch64.c (elf_aarch64_compare_mapping): New. (erratum_835769_scan): Sort map list.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elfnn-aarch64.c27
2 files changed, 32 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 4472daf..aed2b2c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-24 Tejas Belagod <tejas.belagod@arm.com>
+
+ * elfnn-aarch64.c (elf_aarch64_compare_mapping): New.
+ (erratum_835769_scan): Sort map list.
+
2014-11-24 Alan Modra <amodra@gmail.com>
* elf64-ppc.c (plt_stub_pad): Correct.
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 19ad4d2..0879db9 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -2937,6 +2937,29 @@ aarch64_erratum_sequence (uint32_t insn_1, uint32_t insn_2)
return FALSE;
}
+/* Used to order a list of mapping symbols by address. */
+
+static int
+elf_aarch64_compare_mapping (const void *a, const void *b)
+{
+ const elf_aarch64_section_map *amap = (const elf_aarch64_section_map *) a;
+ const elf_aarch64_section_map *bmap = (const elf_aarch64_section_map *) b;
+
+ if (amap->vma > bmap->vma)
+ return 1;
+ else if (amap->vma < bmap->vma)
+ return -1;
+ else if (amap->type > bmap->type)
+ /* Ensure results do not depend on the host qsort for objects with
+ multiple mapping symbols at the same address by sorting on type
+ after vma. */
+ return 1;
+ else if (amap->type < bmap->type)
+ return -1;
+ else
+ return 0;
+}
+
static bfd_boolean
erratum_835769_scan (bfd *input_bfd,
struct bfd_link_info *info,
@@ -2974,6 +2997,10 @@ erratum_835769_scan (bfd *input_bfd,
return TRUE;
sec_data = elf_aarch64_section_data (section);
+
+ qsort (sec_data->map, sec_data->mapcount,
+ sizeof (elf_aarch64_section_map), elf_aarch64_compare_mapping);
+
for (span = 0; span < sec_data->mapcount; span++)
{
unsigned int span_start = sec_data->map[span].vma;