aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-12-21 01:09:13 +1030
committerAlan Modra <amodra@gmail.com>2021-12-28 23:00:01 +1030
commit443aa5f05edb58fc1774f926e9259b7c5a180926 (patch)
treeebc72377ef825f1da276fa3080f91fb49a143341 /bfd
parent4748764aaba89b8515cbf8918dc0ada840cdfab7 (diff)
downloadbinutils-443aa5f05edb58fc1774f926e9259b7c5a180926.zip
binutils-443aa5f05edb58fc1774f926e9259b7c5a180926.tar.gz
binutils-443aa5f05edb58fc1774f926e9259b7c5a180926.tar.bz2
gas reloc sorting
In some cases, eg. riscv_pre_output_hook, gas generates out-of-order relocations. Various places in the linker assume relocs are sorted by increasing r_offset, which is normally the case. Provide GAS_SORT_RELOCS to handle unsorted relocs. bfd/ PR 28709 * elf32-nds32.c (nds32_insertion_sort): Make static. * elf32-nds32.h (nds32_insertion_sort): Delete declaration. gas/ PR 28709 * write.c (write_relocs): Implement reloc sorting by r_offset when GAS_SORT_RELOCS. * config/tc-nds32.c (compar_relent, nds32_set_section_relocs): Delete. * config/tc-nds32.h (nds32_set_section_relocs): Don't declare. (SET_SECTION_RELOCS): Don't define. (GAS_SORT_RELOCS): Define. * config/tc-riscv.h (GAS_SORT_RELOCS): Define.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf32-nds32.c2
-rw-r--r--bfd/elf32-nds32.h2
2 files changed, 1 insertions, 3 deletions
diff --git a/bfd/elf32-nds32.c b/bfd/elf32-nds32.c
index 5b43ca9..56d1d39 100644
--- a/bfd/elf32-nds32.c
+++ b/bfd/elf32-nds32.c
@@ -2522,7 +2522,7 @@ nds32_put_trampoline (void *contents, const unsigned long *template,
/* nds32_insertion_sort sorts an array with nmemb elements of size size.
This prototype is the same as qsort (). */
-void
+static void
nds32_insertion_sort (void *base, size_t nmemb, size_t size,
int (*compar) (const void *lhs, const void *rhs))
{
diff --git a/bfd/elf32-nds32.h b/bfd/elf32-nds32.h
index 0f49636..0bf1697 100644
--- a/bfd/elf32-nds32.h
+++ b/bfd/elf32-nds32.h
@@ -95,8 +95,6 @@ extern int elf32_nds32_check_relax_group (bfd *, asection *);
extern int elf32_nds32_unify_relax_group (bfd *, asection *);
extern int nds32_elf_unify_tls_model (bfd *, asection *, bfd_byte *,
struct bfd_link_info *);
-extern void nds32_insertion_sort
-(void *, size_t, size_t, int (*) (const void *, const void *));
extern int nds32_convert_32_to_16 (bfd *, uint32_t, uint16_t *, int *);
extern int nds32_convert_16_to_32 (bfd *, uint16_t, uint32_t *);