mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
2000-07-09 Koundinya K <kk@ddeorg.soft.net>
* elf32-mips.c (sort_dynamic_relocs): New Function. (_bfd_mips_elf_finish_dynamic_sections): Call sort_dynamic_relocs via qsort to sort the dynamic relocations in increasing r_symndx value.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2000-07-09 Koundinya K <kk@ddeorg.soft.net>
|
||||||
|
|
||||||
|
* elf32-mips.c (sort_dynamic_relocs): New Function.
|
||||||
|
(_bfd_mips_elf_finish_dynamic_sections): Call sort_dynamic_relocs
|
||||||
|
via qsort to sort the dynamic relocations in increasing r_symndx
|
||||||
|
value.
|
||||||
|
|
||||||
2000-07-09 Alan Modra <alan@linuxcare.com.au>
|
2000-07-09 Alan Modra <alan@linuxcare.com.au>
|
||||||
|
|
||||||
* elf64-hppa.c (elf64_hppa_dyn_hash_table_init): Add
|
* elf64-hppa.c (elf64_hppa_dyn_hash_table_init): Add
|
||||||
|
@ -195,6 +195,8 @@ static void mips_elf_allocate_dynamic_relocations
|
|||||||
PARAMS ((bfd *, unsigned int));
|
PARAMS ((bfd *, unsigned int));
|
||||||
static boolean mips_elf_stub_section_p
|
static boolean mips_elf_stub_section_p
|
||||||
PARAMS ((bfd *, asection *));
|
PARAMS ((bfd *, asection *));
|
||||||
|
static int sort_dynamic_relocs
|
||||||
|
PARAMS ((const void *, const void *));
|
||||||
|
|
||||||
/* The level of IRIX compatibility we're striving for. */
|
/* The level of IRIX compatibility we're striving for. */
|
||||||
|
|
||||||
@ -204,6 +206,9 @@ typedef enum {
|
|||||||
ict_irix6
|
ict_irix6
|
||||||
} irix_compat_t;
|
} irix_compat_t;
|
||||||
|
|
||||||
|
/* This will be used when we sort the dynamic relocation records. */
|
||||||
|
static bfd *reldyn_sorting_bfd;
|
||||||
|
|
||||||
/* Nonzero if ABFD is using the N32 ABI. */
|
/* Nonzero if ABFD is using the N32 ABI. */
|
||||||
|
|
||||||
#define ABI_N32_P(abfd) \
|
#define ABI_N32_P(abfd) \
|
||||||
@ -5141,6 +5146,26 @@ _bfd_mips_elf_final_link (abfd, info)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* This function is called via qsort() to sort the dynamic relocation
|
||||||
|
entries by increasing r_symndx value. */
|
||||||
|
|
||||||
|
static int
|
||||||
|
sort_dynamic_relocs (arg1,arg2)
|
||||||
|
const PTR arg1;
|
||||||
|
const PTR arg2;
|
||||||
|
{
|
||||||
|
const Elf32_External_Rel *ext_reloc1 = (const Elf32_External_Rel *) arg1;
|
||||||
|
const Elf32_External_Rel *ext_reloc2 = (const Elf32_External_Rel *) arg2;
|
||||||
|
|
||||||
|
Elf_Internal_Rel int_reloc1;
|
||||||
|
Elf_Internal_Rel int_reloc2;
|
||||||
|
|
||||||
|
bfd_elf32_swap_reloc_in(reldyn_sorting_bfd, ext_reloc1, &int_reloc1);
|
||||||
|
bfd_elf32_swap_reloc_in(reldyn_sorting_bfd, ext_reloc2, &int_reloc2);
|
||||||
|
|
||||||
|
return (ELF32_R_SYM(int_reloc1.r_info) - ELF32_R_SYM(int_reloc2.r_info));
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns the GOT section for ABFD. */
|
/* Returns the GOT section for ABFD. */
|
||||||
|
|
||||||
static asection *
|
static asection *
|
||||||
@ -8837,6 +8862,23 @@ _bfd_mips_elf_finish_dynamic_sections (output_bfd, info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We need to sort the entries of the dynamic relocation section. */
|
||||||
|
|
||||||
|
if (!ABI_64_P (output_bfd))
|
||||||
|
{
|
||||||
|
asection *reldyn;
|
||||||
|
|
||||||
|
reldyn = bfd_get_section_by_name (dynobj,
|
||||||
|
MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
|
||||||
|
if (reldyn != NULL && reldyn->reloc_count > 2)
|
||||||
|
{
|
||||||
|
reldyn_sorting_bfd = output_bfd;
|
||||||
|
qsort ((Elf32_External_Rel *) reldyn->contents + 1,
|
||||||
|
(size_t) reldyn->reloc_count - 1,
|
||||||
|
sizeof (Elf32_External_Rel), sort_dynamic_relocs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Clean up a first relocation in .rel.dyn. */
|
/* Clean up a first relocation in .rel.dyn. */
|
||||||
s = bfd_get_section_by_name (dynobj,
|
s = bfd_get_section_by_name (dynobj,
|
||||||
MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
|
MIPS_ELF_REL_DYN_SECTION_NAME (dynobj));
|
||||||
|
Reference in New Issue
Block a user