reloc rather than just the type.
(_bfd_elf_reloc_type_class): Likewise.
* elf.c (_bfd_elf_reloc_type_class): Likewise.
* elf32-arm.h (elf32_arm_reloc_type_class): Likewise.
* elf32-cris.c (elf_cris_reloc_type_class): Likewise.
* elf32-i386.c (elf_i386_reloc_type_class): Likewise.
* elf32-m68k.c (elf32_m68k_reloc_type_class): Likewise.
* elf32-ppc.c (ppc_elf_reloc_type_class): Likewise.
* elf32-s390.c (elf_s390_reloc_type_class): Likewise.
* elf32-sh.c (sh_elf_reloc_type_class): Likewise.
* elf32-sparc.c (elf32_sparc_reloc_type_class): Likewise.
* elf64-alpha.c (elf64_alpha_reloc_type_class): Likewise.
* elf64-s390.c (elf_s390_reloc_type_class): Likewise.
* elf64-sparc.c (sparc64_elf_reloc_type_class): Likewise.
* elf64-x86-64.c (elf64_x86_64_reloc_type_class): Likewise.
* elfxx-ia64.c (elfNN_ia64_reloc_type_class): Likewise.
* elflink.h: Formatting fixes.
(elf_link_sort_relocs): Make "count" and "size" bfd_size_type.
Call bfd_zmalloc rather than calloc. Remove unnecessary cast of
o->contents to PTR. Update call to elf_backend_reloc_type_class.
+2001-09-24 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (elf_backend_reloc_type_class): Pass in the entire
+ reloc rather than just the type.
+ (_bfd_elf_reloc_type_class): Likewise.
+ * elf.c (_bfd_elf_reloc_type_class): Likewise.
+ * elf32-arm.h (elf32_arm_reloc_type_class): Likewise.
+ * elf32-cris.c (elf_cris_reloc_type_class): Likewise.
+ * elf32-i386.c (elf_i386_reloc_type_class): Likewise.
+ * elf32-m68k.c (elf32_m68k_reloc_type_class): Likewise.
+ * elf32-ppc.c (ppc_elf_reloc_type_class): Likewise.
+ * elf32-s390.c (elf_s390_reloc_type_class): Likewise.
+ * elf32-sh.c (sh_elf_reloc_type_class): Likewise.
+ * elf32-sparc.c (elf32_sparc_reloc_type_class): Likewise.
+ * elf64-alpha.c (elf64_alpha_reloc_type_class): Likewise.
+ * elf64-s390.c (elf_s390_reloc_type_class): Likewise.
+ * elf64-sparc.c (sparc64_elf_reloc_type_class): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_reloc_type_class): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_reloc_type_class): Likewise.
+ * elflink.h: Formatting fixes.
+ (elf_link_sort_relocs): Make "count" and "size" bfd_size_type.
+ Call bfd_zmalloc rather than calloc. Remove unnecessary cast of
+ o->contents to PTR. Update call to elf_backend_reloc_type_class.
+
2001-09-22 John Reiser <jreiser@BitWagon.com>
* elfcode.h (elf_object_p): Allow for no section header at all in
2001-09-20 John Reiser <jreiser@BitWagon.com>
- * elf32-i386.c (elf_i386_relocate_section): coordinate info->symbolic
- and info->allow_shlib_undefined.
- * elf32-cris.c: likewise
- * elf32-hppa.c: likewise
- * elf32-m68k.c: likewise
- * elf32-mips.c: likewise
- * elf32-ppc.c: likewise
- * elf32-s390.c: likewise
- * elf32-sh.c: likewise
- * elf32-sparc.c: likewise
- * elf64-alpha.c: likewise
- * elf64-hppa.c: likewise
- * elf64-ppc.c: likewise
- * elf64-s390.c: likewise
- * elf64-sparc.c: likewise
- * elf64-x86-64.c: likewise
- * elfxx-ia64.c: likewise
+ * elf32-i386.c (elf_i386_relocate_section): Coordinate info->symbolic
+ and info->allow_shlib_undefined.
+ * elf32-cris.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mips.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-sh.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf64-alpha.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
2001-09-18 Bruno Haible <haible@clisp.cons.org>
PARAMS ((bfd *, PTR, bfd_vma));
/* This function returns class of a reloc type. */
- enum elf_reloc_type_class (* elf_backend_reloc_type_class)
- PARAMS ((int));
+ enum elf_reloc_type_class (*elf_backend_reloc_type_class)
+ PARAMS ((const Elf_Internal_Rela *));
/* The swapping table to use when dealing with ECOFF information.
Used for the MIPS ELF .mdebug section. */
PARAMS ((bfd *, PTR, bfd_vma));
extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
extern unsigned long bfd_elf_hash
PARAMS ((const char *));
}
enum elf_reloc_type_class
-_bfd_elf_reloc_type_class (type)
- int type ATTRIBUTE_UNUSED;
+_bfd_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED;
{
return reloc_class_normal;
}
boolean bfd_elf32_arm_process_before_allocation
PARAMS ((bfd *, struct bfd_link_info *, int));
static enum elf_reloc_type_class elf32_arm_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
#define INTERWORK_FLAG(abfd) (elf_elfheader (abfd)->e_flags & EF_ARM_INTERWORK)
}
static enum elf_reloc_type_class
-elf32_arm_reloc_type_class (type)
- int type;
+elf32_arm_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_ARM_RELATIVE:
return reloc_class_relative;
static void elf_cris_hide_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static enum elf_reloc_type_class elf_cris_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
static reloc_howto_type cris_elf_howto_table [] =
{
static enum elf_reloc_type_class
-elf_cris_reloc_type_class (type)
- int type;
+elf_cris_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_CRIS_RELATIVE:
return reloc_class_relative;
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_i386_fake_sections
PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
-static enum elf_reloc_type_class elf_i386_reloc_type_class PARAMS ((int));
+static enum elf_reloc_type_class elf_i386_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
static boolean elf_i386_grok_prstatus
PARAMS ((bfd *abfd, Elf_Internal_Note *note));
static boolean elf_i386_grok_psinfo
}
static enum elf_reloc_type_class
-elf_i386_reloc_type_class (type)
- int type;
+elf_i386_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_386_RELATIVE:
return reloc_class_relative;
static boolean elf32_m68k_print_private_bfd_data
PARAMS ((bfd *, PTR));
static enum elf_reloc_type_class elf32_m68k_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
static reloc_howto_type howto_table[] = {
HOWTO(R_68K_NONE, 0, 0, 0, false,0, complain_overflow_dont, bfd_elf_generic_reloc, "R_68K_NONE", false, 0, 0x00000000,false),
}
static enum elf_reloc_type_class
-elf32_m68k_reloc_type_class (type)
- int type;
+elf32_m68k_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_68K_RELATIVE:
return reloc_class_relative;
Elf_Internal_Sym *));
static boolean ppc_elf_finish_dynamic_sections PARAMS ((bfd *, struct bfd_link_info *));
-static enum elf_reloc_type_class ppc_elf_reloc_type_class PARAMS ((int));
+static enum elf_reloc_type_class ppc_elf_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
static boolean ppc_elf_grok_prstatus
PARAMS ((bfd *abfd, Elf_Internal_Note *note));
static boolean ppc_elf_grok_psinfo
}
static enum elf_reloc_type_class
-ppc_elf_reloc_type_class (type)
- int type;
+ppc_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_PPC_RELATIVE:
return reloc_class_relative;
static boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_s390_object_p PARAMS ((bfd *));
-static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((int));
+static enum elf_reloc_type_class elf_s390_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
#define USE_RELA 1 /* We want RELA relocations, not REL. */
}
static enum elf_reloc_type_class
-elf_s390_reloc_type_class (type)
- int type;
+elf_s390_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_390_RELATIVE:
return reloc_class_relative;
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
static enum elf_reloc_type_class sh_elf_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
/* The name of the dynamic interpreter. This is put in the .interp
section. */
}
static enum elf_reloc_type_class
-sh_elf_reloc_type_class (type)
- int type;
+sh_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_SH_RELATIVE:
return reloc_class_relative;
static void elf32_sparc_final_write_processing
PARAMS ((bfd *, boolean));
static enum elf_reloc_type_class elf32_sparc_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
static asection * elf32_sparc_gc_mark_hook
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
}
static enum elf_reloc_type_class
-elf32_sparc_reloc_type_class (type)
- int type;
+elf32_sparc_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF32_R_TYPE (rela->r_info))
{
case R_SPARC_RELATIVE:
return reloc_class_relative;
static Elf_Internal_Rela * elf64_alpha_find_reloc_at_ofs
PARAMS ((Elf_Internal_Rela *, Elf_Internal_Rela *, bfd_vma, int));
static enum elf_reloc_type_class elf64_alpha_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
\f
struct alpha_elf_link_hash_entry
{
}
static enum elf_reloc_type_class
-elf64_alpha_reloc_type_class (type)
- int type;
+elf64_alpha_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF64_R_TYPE (rela->r_info))
{
case R_ALPHA_RELATIVE:
return reloc_class_relative;
static boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_s390_object_p PARAMS ((bfd *));
-static enum elf_reloc_type_class elf_s390_reloc_type_class PARAMS ((int));
+static enum elf_reloc_type_class elf_s390_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
#define USE_RELA 1 /* We want RELA relocations, not REL. */
static enum elf_reloc_type_class
-elf_s390_reloc_type_class (type)
- int type;
+elf_s390_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF64_R_TYPE (rela->r_info))
{
case R_390_RELATIVE:
return reloc_class_relative;
static long sparc64_elf_canonicalize_dynamic_reloc
PARAMS ((bfd *, arelent **, asymbol **));
static void sparc64_elf_write_relocs PARAMS ((bfd *, asection *, PTR));
-static enum elf_reloc_type_class sparc64_elf_reloc_type_class PARAMS ((int));
+static enum elf_reloc_type_class sparc64_elf_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
\f
/* The relocation "howto" table. */
}
static enum elf_reloc_type_class
-sparc64_elf_reloc_type_class (type)
- int type;
+sparc64_elf_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF64_R_TYPE (rela->r_info))
{
case R_SPARC_RELATIVE:
return reloc_class_relative;
Elf_Internal_Sym *sym));
static boolean elf64_x86_64_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
-static enum elf_reloc_type_class elf64_x86_64_reloc_type_class PARAMS ((int));
+static enum elf_reloc_type_class elf64_x86_64_reloc_type_class
+ PARAMS ((const Elf_Internal_Rela *));
/* Given a BFD reloc type, return a HOWTO structure. */
static reloc_howto_type *
}
static enum elf_reloc_type_class
-elf64_x86_64_reloc_type_class (type)
- int type;
+elf64_x86_64_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELF64_R_TYPE (rela->r_info))
{
case R_X86_64_RELATIVE:
return reloc_class_relative;
const PTR A;
const PTR B;
{
- struct elf_link_sort_rela *a = (struct elf_link_sort_rela *)A;
- struct elf_link_sort_rela *b = (struct elf_link_sort_rela *)B;
+ struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
+ struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
int relativea, relativeb;
relativea = a->type == reloc_class_relative;
const PTR A;
const PTR B;
{
- struct elf_link_sort_rela *a = (struct elf_link_sort_rela *)A;
- struct elf_link_sort_rela *b = (struct elf_link_sort_rela *)B;
+ struct elf_link_sort_rela *a = (struct elf_link_sort_rela *) A;
+ struct elf_link_sort_rela *b = (struct elf_link_sort_rela *) B;
int copya, copyb;
if (a->offset < b->offset)
bfd *dynobj = elf_hash_table (info)->dynobj;
asection *reldyn, *o;
boolean rel = false;
- size_t count, size, i, j, ret;
+ bfd_size_type count, size;
+ size_t i, j, ret;
struct elf_link_sort_rela *rela;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
if (size != reldyn->_raw_size)
return 0;
- rela = (struct elf_link_sort_rela *) calloc (sizeof (*rela), count);
+ rela = (struct elf_link_sort_rela *) bfd_zmalloc (sizeof (*rela) * count);
if (rela == NULL)
{
(*info->callbacks->warning)
struct elf_link_sort_rela *s;
erel = (Elf_External_Rel *) o->contents;
- erelend = (Elf_External_Rel *) ((PTR) o->contents + o->_raw_size);
+ erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
s = rela + o->output_offset / sizeof (Elf_External_Rel);
for (; erel < erelend; erel++, s++)
{
else
elf_swap_reloc_in (abfd, erel, &s->u.rel);
- s->type = ((*bed->elf_backend_reloc_type_class)
- ((int) ELF_R_TYPE (s->u.rel.r_info)));
+ s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
}
}
else
struct elf_link_sort_rela *s;
erela = (Elf_External_Rela *) o->contents;
- erelaend = (Elf_External_Rela *) ((PTR) o->contents + o->_raw_size);
+ erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
s = rela + o->output_offset / sizeof (Elf_External_Rela);
for (; erela < erelaend; erela++, s++)
{
else
elf_swap_reloca_in (dynobj, erela, &s->u.rela);
- s->type = ((*bed->elf_backend_reloc_type_class)
- ((int) ELF_R_TYPE (s->u.rel.r_info)));
+ s->type = (*bed->elf_backend_reloc_type_class) (&s->u.rela);
}
}
}
static boolean elfNN_ia64_print_private_bfd_data
PARAMS ((bfd *abfd, PTR ptr));
static enum elf_reloc_type_class elfNN_ia64_reloc_type_class
- PARAMS ((int));
+ PARAMS ((const Elf_Internal_Rela *));
\f
/* ia64-specific relocation */
}
static enum elf_reloc_type_class
-elfNN_ia64_reloc_type_class (type)
- int type;
+elfNN_ia64_reloc_type_class (rela)
+ const Elf_Internal_Rela *rela;
{
- switch (type)
+ switch ((int) ELFNN_R_TYPE (rela->r_info))
{
case R_IA64_REL32MSB:
case R_IA64_REL32LSB: