+2010-06-20 Roland McGrath <roland@redhat.com>
+
+ * alpha_init.c: Replace reloc_simple_type with reloc_simple_types.
+ * arm_init.c: Likewise.
+ * i386_init.c: Likewise.
+ * ia64_init.c: Likewise.
+ * PPC64_init.c: Likewise.
+ * ppc_init.c: Likewise.
+ * s390_init.c: Likewise.
+ * sh_init.c: Likewise.
+ * sparc_init.c: Likewise.
+ * x86_64_init.c: Likewise.
+ * alpha_symbol.c: Likewise.
+ * arm_symbol.c: Likewise.
+ * i386_symbol.c: Likewise.
+ * ia64_symbol.c: Likewise.
+ * ppc64_symbol.c: Likewise.
+ * ppc_symbol.c: Likewise.
+ * s390_symbol.c: Likewise.
+ * sh_symbol.c: Likewise.
+ * sparc_symbol.c: Likewise.
+ * x86_64_symbol.c: Likewise.
+
2010-04-10 Matt Fleming <matt@console-pimps.org>
* sh_corenote.c: New file.
alpha_init_reloc (eh);
HOOK (eh, dynamic_tag_name);
HOOK (eh, dynamic_tag_check);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, return_value_location);
HOOK (eh, machine_section_flag_check);
HOOK (eh, check_special_section);
/* Alpha specific symbolic name handling.
- Copyright (C) 2002,2005,2007,2008 Red Hat, Inc.
+ Copyright (C) 2002-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
}
/* Check for the simple reloc types. */
-Elf_Type
-alpha_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+alpha_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_ALPHA_REFLONG:
- return ELF_T_WORD;
- case R_ALPHA_REFQUAD:
- return ELF_T_XWORD;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { R_ALPHA_REFQUAD, 0 };
+ static const int rel4[] = { R_ALPHA_REFLONG, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
HOOK (eh, segment_type_name);
HOOK (eh, section_type_name);
HOOK (eh, machine_flag_check);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, register_info);
HOOK (eh, core_note);
HOOK (eh, auxv_info);
/* Arm specific symbolic name handling.
- Copyright (C) 2002-2009 Red Hat, Inc.
+ Copyright (C) 2002-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
}
/* Check for the simple reloc types. */
-Elf_Type
-arm_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+arm_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_ARM_ABS32:
- return ELF_T_WORD;
- case R_ARM_ABS16:
- return ELF_T_HALF;
- case R_ARM_ABS8:
- return ELF_T_BYTE;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { 0 };
+ static const int rel4[] = { R_ARM_ABS32, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
/* We handle it. */
eh->name = "Intel 80386";
i386_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, gotpc_reloc_check);
HOOK (eh, core_note);
generic_debugscn_p = eh->debugscn_p;
/* i386 specific symbolic name handling.
- Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc.
+ Copyright (C) 2000-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
}
/* Check for the simple reloc types. */
-Elf_Type
-i386_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+i386_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_386_32:
- return ELF_T_SWORD;
- case R_386_16:
- return ELF_T_HALF;
- case R_386_8:
- return ELF_T_BYTE;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { 0 };
+ static const int rel4[] = { R_386_32, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
/* Check section name for being that of a debug information section. */
/* We handle it. */
eh->name = "Intel IA-64";
ia64_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, segment_type_name);
HOOK (eh, section_type_name);
HOOK (eh, dynamic_tag_name);
/* IA-64 specific symbolic name handling.
- Copyright (C) 2002-2009 Red Hat, Inc.
+ Copyright (C) 2002-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2002.
return NULL;
}
+
/* Check for the simple reloc types. */
-Elf_Type
-ia64_reloc_simple_type (Ebl *ebl, int type)
+int
+ia64_reloc_simple_types (Ebl *ebl,
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
+ /* The SECREL types when used with non-allocated sections
+ like .debug_* are the same as direct absolute relocs
+ applied to those sections, since a 0 section address is assumed.
+ So we treat them the same here. */
+
+ if (ebl->data == ELFDATA2MSB)
{
- /* The SECREL types when used with non-allocated sections
- like .debug_* are the same as direct absolute relocs
- applied to those sections, since a 0 section address is assumed.
- So we treat them the same here. */
-
- case R_IA64_SECREL32MSB:
- case R_IA64_DIR32MSB:
- if (ebl->data == ELFDATA2MSB)
- return ELF_T_WORD;
- break;
- case R_IA64_SECREL32LSB:
- case R_IA64_DIR32LSB:
- if (ebl->data == ELFDATA2LSB)
- return ELF_T_WORD;
- break;
- case R_IA64_DIR64MSB:
- case R_IA64_SECREL64MSB:
- if (ebl->data == ELFDATA2MSB)
- return ELF_T_XWORD;
- break;
- case R_IA64_SECREL64LSB:
- case R_IA64_DIR64LSB:
- if (ebl->data == ELFDATA2LSB)
- return ELF_T_XWORD;
- break;
+ static const int rel8msb[] = { R_IA64_DIR64MSB, R_IA64_SECREL64MSB, 0 };
+ static const int rel4msb[] = { R_IA64_DIR32MSB, R_IA64_SECREL32MSB, 0 };
+ *rel8_types = rel8msb;
+ *rel4_types = rel4msb;
}
-
- return ELF_T_NUM;
+ else
+ {
+ static const int rel8lsb[] = { R_IA64_DIR64LSB, R_IA64_SECREL64LSB, 0 };
+ static const int rel4lsb[] = { R_IA64_DIR32LSB, R_IA64_SECREL32LSB, 0 };
+ *rel8_types = rel8lsb;
+ *rel4_types = rel4lsb;
+ }
+ return 0;
}
/* We handle it. */
eh->name = "PowerPC 64-bit";
ppc64_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, dynamic_tag_name);
HOOK (eh, dynamic_tag_check);
HOOK (eh, copy_reloc_p);
/* PPC64 specific symbolic name handling.
- Copyright (C) 2004, 2005 Red Hat, Inc.
+ Copyright (C) 2004-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
/* Check for the simple reloc types. */
-Elf_Type
-ppc64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+ppc64_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_PPC64_ADDR64:
- case R_PPC64_UADDR64:
- return ELF_T_XWORD;
- case R_PPC64_ADDR32:
- case R_PPC64_UADDR32:
- return ELF_T_WORD;
- case R_PPC64_UADDR16:
- return ELF_T_HALF;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { R_PPC64_ADDR64, R_PPC64_UADDR64, 0 };
+ static const int rel4[] = { R_PPC64_ADDR32, R_PPC64_UADDR32, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
-
const char *
ppc64_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
size_t len __attribute__ ((unused)))
/* We handle it. */
eh->name = "PowerPC";
ppc_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, dynamic_tag_name);
HOOK (eh, dynamic_tag_check);
HOOK (eh, check_special_symbol);
/* PPC specific symbolic name handling.
- Copyright (C) 2004, 2005, 2007 Red Hat, Inc.
+ Copyright (C) 2004-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2004.
/* Check for the simple reloc types. */
-Elf_Type
-ppc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+ppc_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_PPC_ADDR32:
- case R_PPC_UADDR32:
- return ELF_T_WORD;
- case R_PPC_UADDR16:
- return ELF_T_HALF;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { 0 };
+ static const int rel4[] = { R_PPC_ADDR32, R_PPC_UADDR32, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
+
const char *
ppc_dynamic_tag_name (int64_t tag, char *buf __attribute__ ((unused)),
size_t len __attribute__ ((unused)))
/* We handle it. */
eh->name = "IBM S/390";
s390_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, register_info);
HOOK (eh, return_value_location);
/* S/390-specific symbolic name handling.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2005-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
#include "libebl_CPU.h"
/* Check for the simple reloc types. */
-Elf_Type
-s390_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+s390_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_390_64:
- return ELF_T_SXWORD;
- case R_390_32:
- return ELF_T_SWORD;
- case R_390_16:
- return ELF_T_HALF;
- case R_390_8:
- return ELF_T_BYTE;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { R_390_64, 0 };
+ static const int rel4[] = { R_390_32, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
/* We handle it. */
eh->name = "Hitachi SH";
sh_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, gotpc_reloc_check);
HOOK (eh, machine_flag_check);
HOOK (eh, core_note);
/* SH specific relocation handling.
- Copyright (C) 2000, 2001, 2002, 2005 Red Hat, Inc.
+ Copyright (C) 2000-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2000.
}
/* Check for the simple reloc types. */
-Elf_Type
-sh_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+sh_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_SH_DIR32:
- return ELF_T_WORD;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { 0 };
+ static const int rel4[] = { R_SH_DIR32, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
/* Check whether machine flags are valid. */
else
eh->name = "SPARC";
sparc_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, machine_flag_check);
HOOK (eh, check_special_section);
HOOK (eh, symbol_type_name);
/* SPARC specific symbolic name handling.
- Copyright (C) 2002, 2003, 2005, 2007, 2008 Red Hat, Inc.
+ Copyright (C) 2002-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Jakub Jelinek <jakub@redhat.com>, 2002.
#include "libebl_CPU.h"
/* Check for the simple reloc types. */
-Elf_Type
-sparc_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+sparc_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_SPARC_8:
- return ELF_T_BYTE;
- case R_SPARC_16:
- case R_SPARC_UA16:
- return ELF_T_HALF;
- case R_SPARC_32:
- case R_SPARC_UA32:
- return ELF_T_WORD;
- case R_SPARC_64:
- case R_SPARC_UA64:
- return ELF_T_XWORD;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { R_SPARC_64, R_SPARC_UA64, 0 };
+ static const int rel4[] = { R_SPARC_32, R_SPARC_UA32, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
/* Check whether machine flags are valid. */
/* We handle it. */
eh->name = "AMD x86-64";
x86_64_init_reloc (eh);
- HOOK (eh, reloc_simple_type);
+ HOOK (eh, reloc_simple_types);
HOOK (eh, core_note);
HOOK (eh, return_value_location);
HOOK (eh, register_info);
/* x86_64 specific symbolic name handling.
- Copyright (C) 2002, 2005 Red Hat, Inc.
+ Copyright (C) 2002-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
- Written by Ulrich Drepper <drepper@redhat.com>, 2002.
Red Hat elfutils is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by the
#define BACKEND x86_64_
#include "libebl_CPU.h"
+
/* Check for the simple reloc types. */
-Elf_Type
-x86_64_reloc_simple_type (Ebl *ebl __attribute__ ((unused)), int type)
+int
+x86_64_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- switch (type)
- {
- case R_X86_64_64:
- return ELF_T_XWORD;
- case R_X86_64_32:
- return ELF_T_WORD;
- case R_X86_64_32S:
- return ELF_T_SWORD;
- case R_X86_64_16:
- return ELF_T_HALF;
- case R_X86_64_8:
- return ELF_T_BYTE;
- default:
- return ELF_T_NUM;
- }
+ static const int rel8[] = { R_X86_64_64, 0 };
+ static const int rel4[] = { R_X86_64_32, R_X86_64_32S, 0 };
+ *rel8_types = rel8;
+ *rel4_types = rel4;
+ return 0;
}
2010-06-20 Roland McGrath <roland@redhat.com>
+ * cfi.h (BYTE_ORDER_DUMMY): Macro moved ...
+ * memory-access.h: ... here.
+
* libdw_findcu.c (__libdw_findcu): Take new flag argument,
to search TUs instead of CUs.
* libdwP.h: Update decl.
__nonnull_attribute__ (1, 2, 4) internal_function;
-/* Dummy struct for memory-access.h macros. */
-#define BYTE_ORDER_DUMMY(var, e_ident) \
- const struct { bool other_byte_order; } var = \
- { ((BYTE_ORDER == LITTLE_ENDIAN && e_ident[EI_DATA] == ELFDATA2MSB) \
- || (BYTE_ORDER == BIG_ENDIAN && e_ident[EI_DATA] == ELFDATA2LSB)) }
-
-
INTDECL (dwarf_next_cfi)
INTDECL (dwarf_getcfi)
INTDECL (dwarf_getcfi_elf)
/* Unaligned memory access functionality.
- Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2009 Red Hat, Inc.
+ Copyright (C) 2000-2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Written by Ulrich Drepper <drepper@redhat.com>, 2001.
: (Nbytes) == 4 ? read_4sbyte_unaligned_inc (Dbg, Addr) \
: read_8sbyte_unaligned_inc (Dbg, Addr))
+/* Dummy struct for memory-access.h macros. */
+#define BYTE_ORDER_DUMMY(var, e_ident) \
+ const struct { bool other_byte_order; } var = \
+ { ((BYTE_ORDER == LITTLE_ENDIAN && e_ident[EI_DATA] == ELFDATA2MSB) \
+ || (BYTE_ORDER == BIG_ENDIAN && e_ident[EI_DATA] == ELFDATA2LSB)) }
+
#endif /* memory-access.h */
+2010-06-20 Roland McGrath <roland@redhat.com>
+
+ * relocate.c (struct reloc_symtab_cache): New members
+ rel8_types and rel4_types.
+ (relocate_section): Use ebl_reloc_simple_types instead of old
+ ebl_reloc_simple_type. Handle only 4 and 8 byte quantities,
+ and don't use gelf_xlatetom.
+
2010-06-16 Roland McGrath <roland@redhat.com>
* cu.c (cudie_offset): Use DIE_OFFSET_FROM_CU_OFFSET macro.
/* Cache used by relocate_getsym. */
struct reloc_symtab_cache
{
+ const int *rel8_types;
+ const int *rel4_types;
Elf *symelf;
Elf_Data *symdata;
Elf_Data *symxndxdata;
};
#define RELOC_SYMTAB_CACHE(cache) \
struct reloc_symtab_cache cache = \
- { NULL, NULL, NULL, NULL, SHN_UNDEF, SHN_UNDEF }
+ { NULL, NULL, NULL, NULL, NULL, NULL, SHN_UNDEF, SHN_UNDEF }
/* This is just doing dwfl_module_getsym, except that we must always use
the symbol table in RELOCATED itself when it has one, not MOD->symfile. */
if (tdata == NULL)
return DWFL_E_LIBELF;
+ if (reloc_symtab->rel8_types == NULL)
+ {
+ ebl_reloc_simple_types (mod->ebl,
+ &reloc_symtab->rel8_types,
+ &reloc_symtab->rel4_types);
+ assert (reloc_symtab->rel8_types != NULL);
+ assert (reloc_symtab->rel4_types != NULL);
+ }
+
/* Apply one relocation. Returns true for any invalid data. */
Dwfl_Error relocate (GElf_Addr offset, const GElf_Sxword *addend,
int rtype, int symndx)
So we just pretend it's OK without further relocation. */
return DWFL_E_NOERROR;
- Elf_Type type = ebl_reloc_simple_type (mod->ebl, rtype);
- if (unlikely (type == ELF_T_NUM))
- return DWFL_E_BADRELTYPE;
-
/* First, resolve the symbol to an absolute value. */
GElf_Addr value;
}
/* These are the types we can relocate. */
-#define TYPES DO_TYPE (BYTE, Byte); DO_TYPE (HALF, Half); \
- DO_TYPE (WORD, Word); DO_TYPE (SWORD, Sword); \
- DO_TYPE (XWORD, Xword); DO_TYPE (SXWORD, Sxword)
- size_t size;
- switch (type)
+ size_t size = 4;
+ for (const int *tp = reloc_symtab->rel8_types; *tp != 0; ++tp)
+ if (*tp == rtype)
+ {
+ size = 8;
+ break;
+ }
+ if (size == 4)
{
-#define DO_TYPE(NAME, Name) \
- case ELF_T_##NAME: \
- size = sizeof (GElf_##Name); \
- break
- TYPES;
-#undef DO_TYPE
- default:
- return DWFL_E_BADRELTYPE;
+ const int *tp = reloc_symtab->rel4_types;
+ while (*tp != 0 && *tp != rtype)
+ ++tp;
+ if (unlikely (*tp == 0))
+ return DWFL_E_BADRELTYPE;
}
if (offset + size > tdata->d_size)
return DWFL_E_BADRELOFF;
-#define DO_TYPE(NAME, Name) GElf_##Name Name;
- union { TYPES; } tmpbuf;
-#undef DO_TYPE
- Elf_Data tmpdata =
- {
- .d_type = type,
- .d_buf = &tmpbuf,
- .d_size = size,
- .d_version = EV_CURRENT,
- };
- Elf_Data rdata =
- {
- .d_type = type,
- .d_buf = tdata->d_buf + offset,
- .d_size = size,
- .d_version = EV_CURRENT,
- };
+ BYTE_ORDER_DUMMY (bo, ehdr->e_ident);
/* XXX check for overflow? */
if (addend)
+ /* For the addend form, we have the value already. */
+ value += *addend;
+ else if (size == 8)
+ value += read_8ubyte_unaligned (&bo, tdata->d_buf + offset);
+ else
+ value += read_4ubyte_unaligned (&bo, tdata->d_buf + offset);
+
+ if (size == 8)
{
- /* For the addend form, we have the value already. */
- value += *addend;
- switch (type)
- {
-#define DO_TYPE(NAME, Name) \
- case ELF_T_##NAME: \
- tmpbuf.Name = value; \
- break
- TYPES;
-#undef DO_TYPE
- default:
- abort ();
- }
+ uint64_t v = bo.other_byte_order ? bswap_64 (value) : value;
+ memcpy (tdata->d_buf + offset, &v, sizeof v);
}
else
{
- /* Extract the original value and apply the reloc. */
- Elf_Data *d = gelf_xlatetom (relocated, &tmpdata, &rdata,
- ehdr->e_ident[EI_DATA]);
- if (d == NULL)
- return DWFL_E_LIBELF;
- assert (d == &tmpdata);
- switch (type)
- {
-#define DO_TYPE(NAME, Name) \
- case ELF_T_##NAME: \
- tmpbuf.Name += (GElf_##Name) value; \
- break
- TYPES;
-#undef DO_TYPE
- default:
- abort ();
- }
+ uint32_t v = bo.other_byte_order ? bswap_32 (value) : value;
+ memcpy (tdata->d_buf + offset, &v, sizeof v);
}
- /* Now convert the relocated datum back to the target
- format. This will write into rdata.d_buf, which
- points into the raw section data being relocated. */
- Elf_Data *s = gelf_xlatetof (relocated, &rdata, &tmpdata,
- ehdr->e_ident[EI_DATA]);
- if (s == NULL)
- return DWFL_E_LIBELF;
- assert (s == &rdata);
-
/* We have applied this relocation! */
return DWFL_E_NOERROR;
}
+2010-06-20 Roland McGrath <roland@redhat.com>
+
+ * ebl-hooks.h: Replace reloc_simple_type with reloc_simple_types.
+ * libebl.h: Likewise.
+ * eblrelocsimpletypes.c: New file.
+ * eblrelocsimpletype.c: File removed.
+ * Makefile.am (gen_SOURCES): Updated.
+ * eblopenbackend.c (default_reloc_simple_types): New function.
+ (default_reloc_simple_type): Removed.
+ (fill_defaults): Update initializer.
+
2010-02-15 Roland McGrath <roland@redhat.com>
* Makefile.am: Use config/eu.am for common stuff.
eblbackendname.c eblshflagscombine.c eblwstrtab.c \
eblgstrtab.c eblosabiname.c \
eblmachineflagcheck.c eblmachinesectionflagcheck.c \
- eblreloctypecheck.c eblrelocvaliduse.c eblrelocsimpletype.c \
+ eblreloctypecheck.c eblrelocvaliduse.c eblrelocsimpletypes.c \
ebldynamictagcheck.c eblcorenotetypename.c eblobjnotetypename.c \
eblcorenote.c eblobjnote.c ebldebugscnp.c \
eblgotpcreloccheck.c eblcopyrelocp.c eblsectionstripp.c \
/* Check relocation type. */
bool EBLHOOK(reloc_type_check) (int);
-/* Check if relocation type is for simple absolute relocations. */
-Elf_Type EBLHOOK(reloc_simple_type) (Ebl *, int);
+/* Return list of relocation types for simple absolute relocations. */
+int EBLHOOK(reloc_simple_types) (Ebl *, const int **rel8_types,
+ const int **rel4_types);
/* Check relocation type use. */
bool EBLHOOK(reloc_valid_use) (Elf *, int);
static const char *default_reloc_type_name (int ignore, char *buf, size_t len);
static bool default_reloc_type_check (int ignore);
static bool default_reloc_valid_use (Elf *elf, int ignore);
-static Elf_Type default_reloc_simple_type (Ebl *ebl, int ignore);
+static int default_reloc_simple_types (Ebl *ebl,
+ const int **rel8_types,
+ const int **rel4_types);
static bool default_gotpc_reloc_check (Elf *elf, int ignore);
static const char *default_segment_type_name (int ignore, char *buf,
size_t len);
result->reloc_type_name = default_reloc_type_name;
result->reloc_type_check = default_reloc_type_check;
result->reloc_valid_use = default_reloc_valid_use;
- result->reloc_simple_type = default_reloc_simple_type;
+ result->reloc_simple_types = default_reloc_simple_types;
result->gotpc_reloc_check = default_gotpc_reloc_check;
result->segment_type_name = default_segment_type_name;
result->section_type_name = default_section_type_name;
return false;
}
-static Elf_Type
-default_reloc_simple_type (Ebl *eh __attribute__ ((unused)),
- int ignore __attribute__ ((unused)))
+static int
+default_reloc_simple_types (Ebl *ebl __attribute__ ((unused)),
+ const int **rel8_types, const int **rel4_types)
{
- return ELF_T_NUM;
+ static const int norel[] = { 0 };
+ *rel8_types = *rel4_types = norel;
+ return 0;
}
static bool
/* Check relocation type for simple types.
- Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2010 Red Hat, Inc.
This file is part of Red Hat elfutils.
Red Hat elfutils is free software; you can redistribute it and/or modify
#include <libeblP.h>
-Elf_Type
-ebl_reloc_simple_type (ebl, reloc)
+int
+ebl_reloc_simple_types (ebl, rel8_types, rel4_types)
Ebl *ebl;
- int reloc;
+ const int **rel8_types;
+ const int **rel4_types;
{
- return ebl != NULL ? ebl->reloc_simple_type (ebl, reloc) : ELF_T_NUM;
+ return ebl == NULL ? -1
+ : ebl->reloc_simple_types (ebl, rel8_types, rel4_types);
}
/* Check relocation type use. */
extern bool ebl_reloc_valid_use (Ebl *ebl, int reloc);
-/* Check if relocation type is for simple absolute relocations.
- Return ELF_T_{BYTE,HALF,SWORD,SXWORD} for a simple type, else ELF_T_NUM. */
-extern Elf_Type ebl_reloc_simple_type (Ebl *ebl, int reloc);
+/* Return lists of the relocation types for simple absolute relocations.
+ Each list is terminated by a 0 element. */
+extern int ebl_reloc_simple_types (Ebl *ebl,
+ const int **rel8_types,
+ const int **rel4_types)
+ __nonnull_attribute__ (2, 3);
/* Return true if the symbol type is that referencing the GOT. E.g.,
R_386_GOTPC. */