aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.h
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2001-08-24 11:17:30 +0000
committerJakub Jelinek <jakub@redhat.com>2001-08-24 11:17:30 +0000
commitfcfbdf319eec497df624afdc1188f29f9ba8159d (patch)
tree697adc594533de3754aa2f4b36737b37228e96f7 /bfd/elflink.h
parent275f450c27ed529e2197c1ec97151740c2e65d8e (diff)
downloadgdb-fcfbdf319eec497df624afdc1188f29f9ba8159d.zip
gdb-fcfbdf319eec497df624afdc1188f29f9ba8159d.tar.gz
gdb-fcfbdf319eec497df624afdc1188f29f9ba8159d.tar.bz2
* elflink.h (elf_link_sort_cmp1): Sort RELATIVE relocs first, not
last. (elf_link_sort_relocs): Adjust accordingly. * elf64-alpha.c (struct alpha_elf_link_hash_entry): Add reltext flag. (elf64_alpha_check_relocs): Set it if section this reloc is against is read-only. Set DF_TEXTREL if a RELATIVE reloc is needed against read-only section. (elf64_alpha_calc_dynrel_sizes): Set DF_TEXTREL flag if relocation is is against read-only section. (elf64_alpha_size_dynamic_sections): Use DF_TEXTREL flag, don't check section names. (elf64_alpha_reloc_type_class): New. (elf_backend_reloc_type_class): Define.
Diffstat (limited to 'bfd/elflink.h')
-rw-r--r--bfd/elflink.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/bfd/elflink.h b/bfd/elflink.h
index 4428767..8af57e8 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -4300,9 +4300,9 @@ elf_link_sort_cmp1 (A, B)
relativeb = b->type == reloc_class_relative;
if (relativea < relativeb)
- return -1;
- if (relativea > relativeb)
return 1;
+ if (relativea > relativeb)
+ return -1;
if (ELF_R_SYM (a->u.rel.r_info) < ELF_R_SYM (b->u.rel.r_info))
return -1;
if (ELF_R_SYM (a->u.rel.r_info) > ELF_R_SYM (b->u.rel.r_info))
@@ -4429,14 +4429,15 @@ elf_link_sort_relocs (abfd, info, psec)
}
qsort (rela, count, sizeof (*rela), elf_link_sort_cmp1);
- for (i = 0, j = 0; i < count && rela[i].type != reloc_class_relative; i++)
+ for (ret = 0; ret < count && rela[ret].type == reloc_class_relative; ret++)
+ ;
+ for (i = ret, j = ret; i < count; i++)
{
if (ELF_R_SYM (rela[i].u.rel.r_info) != ELF_R_SYM (rela[j].u.rel.r_info))
j = i;
rela[i].offset = rela[j].u.rel.r_offset;
}
- ret = count - i;
- qsort (rela, i, sizeof (*rela), elf_link_sort_cmp2);
+ qsort (rela + ret, count - ret, sizeof (*rela), elf_link_sort_cmp2);
for (o = dynobj->sections; o != NULL; o = o->next)
if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))