+2002-11-28 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h: Replace occurrences of Elf32_Internal_* and
+ Elf64_Internal_* with Elf_Internal_*. Replace Elf_Internal_Rel
+ with Elf_Internal_Rela.
+ * elf-hppa.h, elf-m10200.c, elf-m10300.c, elf32-arc.c, elf32-arm.h,
+ elf32-avr.c, elf32-cris.c, elf32-d10v.c, elf32-d30v.c, elf32-dlx.c,
+ elf32-fr30.c, elf32-frv.c, elf32-gen.c, elf32-h8300.c, elf32-hppa.c,
+ elf32-i370.c, elf32-i386.c, elf32-i860.c, elf32-i960.c, elf32-ip2k.c,
+ elf32-m32r.c, elf32-m68hc11.c, elf32-m68hc12.c, elf32-m68k.c,
+ elf32-mcore.c, elf32-mips.c, elf32-openrisc.c, elf32-or32.c,
+ elf32-ppc.c, elf32-s390.c, elf32-sh.c, elf32-v850.c, elf32-vax.c,
+ elf32-xstormy16.c, elf64-alpha.c, elf64-gen.c, elf64-hppa.c,
+ elf64-mips.c, elf64-mmix.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
+ elf64-sparc.c, elf64-x86-64.c, elfarm-nabi.c, elfarm-oabi.c,
+ elfcode.h, elflink.h, elfn32-mips.c, elfxx-ia64.c, elfxx-mips.c: Ditto.
+ * elf-hppa.h (elf_hppa_internal_shdr): Delete. Use Elf_Internal_Shdr
+ throughout instead.
+ * elf.c (_bfd_elf_no_info_to_howto_rel): Delete.
+ * elfcode.h (elf_swap_reloca_in): Pass source operand as a bfd_byte *.
+ Remove INLINE keyword.
+ (elf_swap_reloc_in): Likewise. Also clear r_addend.
+ (elf_swap_reloc_out, elf_swap_reloca_out): Pass destination operand
+ as a bfd_byte *.
+ (elf_write_relocs): Consolidate REL and RELA code.
+ (elf_slurp_reloc_table_from_section): Simplify REL code.
+ (NAME(_bfd_elf,size_info)): Populate reloc swap entries.
+ * elf-bfd.h (MAX_INT_RELS_PER_EXT_REL): Define.
+ * elflink.h (elf_link_read_relocs_from_section): Consolidate REL and
+ RELA code.
+ (elf_link_adjust_relocs): Likewise. Don't malloc space for temp
+ reloc array, use a fixed size of MAX_INT_RELS_PER_EXT_REL.
+ (elf_link_output_relocs): Likewise.
+ (elf_reloc_link_order): Likewise.
+ (elf_finish_pointer_linker_section): Likewise.
+ (struct elf_link_sort_rela): Remove union.
+ (elf_link_sort_cmp1): Update to suit.
+ (elf_link_sort_cmp2): Here too.
+ (elf_link_sort_relocs): Consolidate REL and RELA code. Fix memory
+ over-allocation for int_rels_per_ext_rel != 1 case.
+ * elf32-arm.h: Update all bfd_elf32_swap_reloc_out calls.
+ * elf32-i386.c: Likewise.
+ * elf32-cris.c: Likewise for bfd_elf32_swap_reloca_out.
+ * elf32-hppa.c, elf32-i370.c, elf32-m68k.c, elf32-ppc.c, elf32-s390.c,
+ elf32-sh.c, elf32-vax.c, elfxx-mips.c: Likewise.
+ * elf64-alpha.c: Likewise for bfd_elf64_swap_reloca_out.
+ * elf64-hppa.c, elf64-mips.c, elf64-ppc.c, elf64-s390.c, elf64-sh64.c,
+ elf64-sparc.c, elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise for bfd_elfNN_swap_reloca_out.
+ * elfxx-mips.c (sort_dynamic_relocs): Likewise for
+ bfd_elf32_swap_reloc_in.
+
+ * elf32-arm.h: Update elf32_arm_info_to_howto calls.
+ * elf32-mips.c: Likewise for mips_info_to_howto_rel.
+ (mips_elf64_swap_reloc_in): Zero r_addend.
+ (mips_elf64_be_swap_reloc_in): Likewise.
+ (mips_elf64_slurp_one_reloc_table): Simplify.
+
+ * elf64-alpha.c (alpha_elf_size_info): Populate reloc swap entries.
+ * elf64-hppa.c (hppa64_elf_size_info): Likewise.
+ * elf64-sparc.c (sparc64_elf_size_info): Likewise.
+
2002-11-28 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* elf32-sh.c (sh_elf_relocate_section): Don't complain about
/* The number of internal relocations to allocate per external
relocation entry. */
unsigned char int_rels_per_ext_rel;
+ /* We use some fixed size arrays. This should be large enough to
+ handle all back-ends. */
+#define MAX_INT_RELS_PER_EXT_REL 3
unsigned char arch_size, file_align;
unsigned char elfclass, ev_current;
void (*swap_dyn_out)
PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
- /* This function, if defined, is called to swap in a REL
- relocation. If an external relocation corresponds to more than
- one internal relocation, then all relocations are swapped in at
- once. */
+ /* This function is called to swap in a REL relocation. If an
+ external relocation corresponds to more than one internal
+ relocation, then all relocations are swapped in at once. */
void (*swap_reloc_in)
- PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
- /* This function, if defined, is called to swap out a REL
- relocation. */
+ /* This function is called to swap out a REL relocation. */
void (*swap_reloc_out)
- PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
+ PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
- /* This function, if defined, is called to swap in a RELA
- relocation. If an external relocation corresponds to more than
- one internal relocation, then all relocations are swapped in at
- once. */
+ /* This function is called to swap in a RELA relocation. If an
+ external relocation corresponds to more than one internal
+ relocation, then all relocations are swapped in at once. */
void (*swap_reloca_in)
PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
- /* This function, if defined, is called to swap out a RELA
- relocation. */
+ /* This function is called to swap out a RELA relocation. */
void (*swap_reloca_out)
PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
-
};
#define elf_symbol_from(ABFD,S) \
/* A function to translate an ELF REL relocation to a BFD arelent
structure. */
void (*elf_info_to_howto_rel)
- PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
/* A function to determine whether a symbol is global when
partitioning the symbol table into local and global symbols.
type fields for some sections, or to actually write out data for
unusual sections. */
boolean (*elf_backend_section_processing)
- PARAMS ((bfd *, Elf32_Internal_Shdr *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *));
/* A function to handle unusual section types when creating BFD
sections from ELF sections. */
boolean (*elf_backend_section_from_shdr)
- PARAMS ((bfd *, Elf32_Internal_Shdr *, const char *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
/* A function to convert machine dependent section header flags to
BFD internal section header flags. */
boolean (*elf_backend_section_flags)
- PARAMS ((flagword *, Elf32_Internal_Shdr *));
+ PARAMS ((flagword *, Elf_Internal_Shdr *));
/* A function to handle unusual program segment types when creating BFD
sections from ELF program segments. */
boolean (*elf_backend_section_from_phdr)
- PARAMS ((bfd *, Elf32_Internal_Phdr *, int));
+ PARAMS ((bfd *, Elf_Internal_Phdr *, int));
/* A function to set up the ELF section header for a BFD section in
preparation for writing it out. This is where the flags and type
fields are set for unusual sections. */
boolean (*elf_backend_fake_sections)
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
/* A function to get the ELF section index for a BFD section. If
this returns true, the section was found. If it is a normal ELF
extern boolean bfd_elf32_create_pointer_linker_section
PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
- struct elf_link_hash_entry *, const Elf32_Internal_Rela *));
+ struct elf_link_hash_entry *, const Elf_Internal_Rela *));
extern bfd_vma bfd_elf32_finish_pointer_linker_section
PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
struct elf_link_hash_entry *, bfd_vma,
- const Elf32_Internal_Rela *, int));
+ const Elf_Internal_Rela *, int));
extern boolean bfd_elf64_create_pointer_linker_section
PARAMS ((bfd *, struct bfd_link_info *, elf_linker_section_t *,
- struct elf_link_hash_entry *, const Elf64_Internal_Rela *));
+ struct elf_link_hash_entry *, const Elf_Internal_Rela *));
extern bfd_vma bfd_elf64_finish_pointer_linker_section
PARAMS ((bfd *, bfd *, struct bfd_link_info *, elf_linker_section_t *,
struct elf_link_hash_entry *, bfd_vma,
- const Elf64_Internal_Rela *, int));
+ const Elf_Internal_Rela *, int));
extern boolean _bfd_elf_make_linker_section_rela
PARAMS ((bfd *, elf_linker_section_t *, int));
extern void bfd_elf32_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf32_swap_reloc_in
- PARAMS ((bfd *, const Elf32_External_Rel *, Elf_Internal_Rel *));
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
extern void bfd_elf32_swap_reloc_out
- PARAMS ((bfd *, const Elf_Internal_Rel *, Elf32_External_Rel *));
+ PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
extern void bfd_elf32_swap_reloca_in
- PARAMS ((bfd *, const Elf32_External_Rela *, Elf_Internal_Rela *));
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
extern void bfd_elf32_swap_reloca_out
- PARAMS ((bfd *, const Elf_Internal_Rela *, Elf32_External_Rela *));
+ PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
extern void bfd_elf32_swap_phdr_in
PARAMS ((bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *));
extern void bfd_elf32_swap_phdr_out
extern void bfd_elf64_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf64_swap_reloc_in
- PARAMS ((bfd *, const Elf64_External_Rel *, Elf_Internal_Rel *));
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
extern void bfd_elf64_swap_reloc_out
- PARAMS ((bfd *, const Elf_Internal_Rel *, Elf64_External_Rel *));
+ PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
extern void bfd_elf64_swap_reloca_in
- PARAMS ((bfd *, const Elf64_External_Rela *, Elf_Internal_Rela *));
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
extern void bfd_elf64_swap_reloca_out
- PARAMS ((bfd *, const Elf_Internal_Rela *, Elf64_External_Rela *));
+ PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
extern void bfd_elf64_swap_phdr_in
PARAMS ((bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *));
extern void bfd_elf64_swap_phdr_out
#if ARCH_SIZE == 64
#define ELF_R_TYPE(X) ELF64_R_TYPE(X)
#define ELF_R_SYM(X) ELF64_R_SYM(X)
-#define elf_hppa_internal_shdr Elf64_Internal_Shdr
#define elf_hppa_reloc_final_type elf64_hppa_reloc_final_type
#define _bfd_elf_hppa_gen_reloc_type _bfd_elf64_hppa_gen_reloc_type
#define elf_hppa_relocate_section elf64_hppa_relocate_section
#if ARCH_SIZE == 32
#define ELF_R_TYPE(X) ELF32_R_TYPE(X)
#define ELF_R_SYM(X) ELF32_R_SYM(X)
-#define elf_hppa_internal_shdr Elf32_Internal_Shdr
#define elf_hppa_reloc_final_type elf32_hppa_reloc_final_type
#define _bfd_elf_hppa_gen_reloc_type _bfd_elf32_hppa_gen_reloc_type
#define elf_hppa_relocate_section elf32_hppa_relocate_section
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf_hppa_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static reloc_howto_type * elf_hppa_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
PARAMS ((bfd *, const char *));
static boolean elf_hppa_fake_sections
- PARAMS ((bfd *abfd, elf_hppa_internal_shdr *, asection *));
+ PARAMS ((bfd *abfd, Elf_Internal_Shdr *, asection *));
static void elf_hppa_final_write_processing
PARAMS ((bfd *, boolean));
elf_hppa_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf_Internal_Rel *elf_reloc;
+ Elf_Internal_Rela *elf_reloc;
{
BFD_ASSERT (ELF_R_TYPE(elf_reloc->r_info)
< (unsigned int) R_PARISC_UNIMPLEMENTED);
static boolean
elf_hppa_fake_sections (abfd, hdr, sec)
bfd *abfd;
- elf_hppa_internal_shdr *hdr;
+ Elf_Internal_Shdr *hdr;
asection *sec;
{
register const char *name;
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void mn10200_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean mn10200_elf_relax_delete_bytes
PARAMS ((bfd *, asection *, bfd_vma, int));
static boolean mn10200_elf_symbol_address_p
mn10200_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void mn10300_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean mn10300_elf_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
mn10300_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
abort ();
}
-#if 0
-void
-_bfd_elf_no_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd *abfd;
- arelent *cache_ptr;
- Elf_Internal_Rel *dst;
-{
- abort ();
-}
-#endif
-
/* Try to convert a non-ELF reloc into an ELF one. */
boolean
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void arc_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean arc_elf_object_p
PARAMS ((bfd *));
static void arc_elf_final_write_processing
arc_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
{
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
if (sreloc == NULL)
}
}
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- (((Elf32_External_Rel *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do not want to
fiddle with the addend. Otherwise, we need to include the symbol
if (info->shared)
{
asection * srelgot;
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
srelgot = bfd_get_section_by_name (dynobj, ".rel.got");
BFD_ASSERT (srelgot != NULL);
+ sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_ARM_RELATIVE);
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- (((Elf32_External_Rel *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
local_got_offsets[r_symndx] |= 1;
|| r_type == R_ARM_GNU_VTINHERIT)
continue;
-#if USE_REL
- elf32_arm_info_to_howto (input_bfd, & bfd_reloc,
- (Elf_Internal_Rel *) rel);
-#else
elf32_arm_info_to_howto (input_bfd, & bfd_reloc, rel);
-#endif
howto = bfd_reloc.howto;
#if USE_REL
asection * srel;
bfd_vma plt_index;
bfd_vma got_offset;
- Elf_Internal_Rel rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
+ sgot->output_offset
+ got_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_JUMP_SLOT);
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) srel->contents
- + plt_index));
+ loc = srel->contents + plt_index * sizeof (Elf32_External_Rel);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
{
asection * sgot;
asection * srel;
- Elf_Internal_Rel rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_GLOB_DAT);
}
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) srel->contents
- + srel->reloc_count));
- ++srel->reloc_count;
+ loc = srel->contents + srel->reloc_count++ * sizeof (Elf32_External_Rel);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
asection * s;
- Elf_Internal_Rel rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
BFD_ASSERT (h->dynindx != -1
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_ARM_COPY);
- bfd_elf32_swap_reloc_out (output_bfd, &rel,
- ((Elf32_External_Rel *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rel);
+ bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void avr_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static asection *elf32_avr_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
avr_info_to_howto_rela (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void cris_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean cris_elf_grok_prstatus
PARAMS ((bfd *abfd, Elf_Internal_Note *note));
cris_info_to_howto_rela (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr;
- Elf32_Internal_Rela * dst;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type;
if (info->shared)
{
- asection *srelgot;
+ asection *s;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
+ s = bfd_get_section_by_name (dynobj, ".rela.got");
+ BFD_ASSERT (s != NULL);
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_CRIS_RELATIVE);
outrel.r_addend = relocation;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
local_got_offsets[r_symndx] |= 1;
& ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
}
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
/* This reloc will be computed at runtime, so there's no
need to do anything now, except for R_CRIS_32 relocations
bfd_vma gotplt_offset
= ((struct elf_cris_link_hash_entry *) h)->gotplt_offset;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
boolean has_gotplt = gotplt_offset != 0;
/* Get the index in the procedure linkage table which
+ got_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_JUMP_SLOT);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + gotplt_index));
+ loc = srela->contents + gotplt_index * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
bfd_byte *where;
/* This symbol has an entry in the global offset table. Set it up. */
rela.r_addend = 0;
}
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
+ loc = srela->contents;
+ loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
asection *s;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_CRIS_COPY);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void d10v_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static asection * elf32_d10v_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
d10v_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void d30v_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void d30v_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_reloc_status_type bfd_elf_d30v_reloc PARAMS ((
bfd *abfd,
arelent *reloc_entry,
d30v_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
d30v_info_to_howto_rela (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static boolean elf32_dlx_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *));
static void elf32_dlx_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf32_dlx_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_reloc_status_type elf32_dlx_relocate16
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_reloc_status_type elf32_dlx_relocate26
elf32_dlx_info_to_howto (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr ATTRIBUTE_UNUSED;
- Elf32_Internal_Rela * dst ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela * dst ATTRIBUTE_UNUSED;
{
abort ();
}
elf32_dlx_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type * fr30_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void fr30_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean fr30_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
fr30_info_to_howto_rela (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr;
- Elf32_Internal_Rela * dst;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type;
static reloc_howto_type *frv_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void frv_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean elf32_frv_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static boolean elf32_frv_add_symbol_hook
frv_info_to_howto_rela (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr;
- Elf32_Internal_Rela * dst;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type;
false); /* pcrel_offset */
static void elf_generic_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf_generic_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean elf32_generic_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf32_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf32_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
static void elf32_h8_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf32_h8_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static unsigned long elf32_h8_mach
PARAMS ((flagword));
static void elf32_h8_final_write_processing
elf32_h8_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf32_Internal_Rela *elf_reloc;
+ Elf_Internal_Rela *elf_reloc;
{
unsigned int r;
unsigned int i;
elf32_h8_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf32_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
unsigned int r;
In this case it is relative to the base of the
object because the symbol index is zero. */
Elf_Internal_Rela outrel;
- asection *srelgot = htab->srelgot;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
+ asection *s = htab->srelgot;
outrel.r_offset = (off
+ htab->sgot->output_offset
+ htab->sgot->output_section->vma);
outrel.r_info = ELF32_R_INFO (0, R_PARISC_DIR32);
outrel.r_addend = relocation;
- loc = (Elf32_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
else
/* Output a dynamic IPLT relocation for this
PLT entry. */
Elf_Internal_Rela outrel;
- asection *srelplt = htab->srelplt;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
+ asection *s = htab->srelplt;
outrel.r_offset = (off
+ htab->splt->output_offset
+ htab->splt->output_section->vma);
outrel.r_info = ELF32_R_INFO (0, R_PARISC_IPLT);
outrel.r_addend = relocation;
- loc = (Elf32_External_Rela *) srelplt->contents;
- loc += srelplt->reloc_count++;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
else
Elf_Internal_Rela outrel;
boolean skip;
asection *sreloc;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
break;
if (! ((struct elf32_hppa_link_hash_entry *) h)->pic_call)
{
Elf_Internal_Rela rel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* Create a dynamic IPLT relocation for this entry. */
rel.r_offset = (h->plt.offset
rel.r_addend = value;
}
- loc = (Elf32_External_Rela *) htab->srelplt->contents;
- loc += htab->srelplt->reloc_count++;
+ loc = htab->srelplt->contents;
+ loc += htab->srelplt->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (htab->splt->output_section->owner,
&rel, loc);
}
if (h->got.offset != (bfd_vma) -1)
{
Elf_Internal_Rela rel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rel.r_addend = 0;
}
- loc = (Elf32_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
}
{
asection *s;
Elf_Internal_Rela rel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_section->vma);
rel.r_addend = 0;
rel.r_info = ELF32_R_INFO (h->dynindx, R_PARISC_COPY);
- loc = (Elf32_External_Rela *) s->contents + s->reloc_count++;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
}
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void i370_elf_info_to_howto PARAMS ((bfd *abfd, arelent *cache_ptr,
- Elf32_Internal_Rela *dst));
+ Elf_Internal_Rela *dst));
static boolean i370_elf_set_private_flags PARAMS ((bfd *, flagword));
\f
/* Initialize the i370_elf_howto_table, so that linear accesses can be done. */
struct bfd_link_info *));
static boolean i370_elf_section_from_shdr PARAMS ((bfd *,
- Elf32_Internal_Shdr *,
+ Elf_Internal_Shdr *,
const char *));
static boolean i370_elf_fake_sections PARAMS ((bfd *,
- Elf32_Internal_Shdr *,
+ Elf_Internal_Shdr *,
asection *));
#if 0
static elf_linker_section_t *i370_elf_create_linker_section
i370_elf_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
if (!i370_elf_howto_table[ R_I370_ADDR31 ]) /* Initialize howto table */
i370_elf_howto_init ();
static boolean
i370_elf_section_from_shdr (abfd, hdr, name)
bfd *abfd;
- Elf32_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
const char *name;
{
asection *newsect;
static boolean
i370_elf_fake_sections (abfd, shdr, asect)
bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *shdr;
+ Elf_Internal_Shdr *shdr;
asection *asect;
{
if ((asect->flags & SEC_EXCLUDE) != 0)
&& r_symndx != 0)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
int skip;
#ifdef DEBUG
}
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
/* This reloc will be computed at runtime, so there's no
need to do anything now, unless this is a RELATIVE
static reloc_howto_type *elf_i386_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf_i386_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf_i386_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean elf_i386_is_local_label_name
PARAMS ((bfd *, const char *));
static boolean elf_i386_grok_prstatus
static boolean readonly_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR));
static boolean elf_i386_fake_sections
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
static boolean elf_i386_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static bfd_vma dtpoff_base
static void
elf_i386_info_to_howto (abfd, cache_ptr, dst)
- bfd *abfd ATTRIBUTE_UNUSED;
- arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf32_Internal_Rela *dst ATTRIBUTE_UNUSED;
+ bfd *abfd ATTRIBUTE_UNUSED;
+ arelent *cache_ptr ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *dst ATTRIBUTE_UNUSED;
{
abort ();
}
elf_i386_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type = ELF32_R_TYPE (dst->r_info);
unsigned int indx;
static boolean
elf_i386_fake_sections (abfd, hdr, sec)
bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
asection *sec;
{
register const char *name;
if (info->shared)
{
- asection *srelgot;
- Elf_Internal_Rel outrel;
- Elf32_External_Rel *loc;
+ asection *s;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = htab->srelgot;
- if (srelgot == NULL)
+ s = htab->srelgot;
+ if (s == NULL)
abort ();
outrel.r_offset = (htab->sgot->output_section->vma
+ htab->sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_386_RELATIVE);
- loc = (Elf32_External_Rel *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
{
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
asection *sreloc;
- Elf32_External_Rel *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rel *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do
case R_386_TLS_IE:
if (info->shared)
{
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
asection *sreloc;
- Elf32_External_Rel *loc;
outrel.r_offset = rel->r_offset
+ input_section->output_section->vma
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rel *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
/* Fall through */
off &= ~1;
else
{
- Elf_Internal_Rel outrel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
int dr_type, indx;
if (htab->srelgot == NULL)
bfd_put_32 (output_bfd, 0,
htab->sgot->contents + off);
outrel.r_info = ELF32_R_INFO (indx, dr_type);
- loc = (Elf32_External_Rel *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
if (r_type == R_386_TLS_GD)
R_386_TLS_DTPOFF32);
outrel.r_offset += 4;
htab->srelgot->reloc_count++;
- loc++;
- bfd_elf32_swap_reloc_out (output_bfd, &outrel,
- loc);
+ loc += sizeof (Elf32_External_Rel);
+ bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
}
else if (tls_type == GOT_TLS_IE_BOTH)
outrel.r_info = ELF32_R_INFO (indx, R_386_TLS_TPOFF);
outrel.r_offset += 4;
htab->srelgot->reloc_count++;
- loc++;
+ loc += sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
}
off &= ~1;
else
{
- Elf_Internal_Rel outrel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (htab->srelgot == NULL)
abort ();
bfd_put_32 (output_bfd, 0,
htab->sgot->contents + off + 4);
outrel.r_info = ELF32_R_INFO (0, R_386_TLS_DTPMOD32);
- loc = (Elf32_External_Rel *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
htab->tls_ldm_got.offset |= 1;
}
case R_386_TLS_LE:
if (info->shared)
{
- Elf_Internal_Rel outrel;
+ Elf_Internal_Rela outrel;
asection *sreloc;
- Elf32_External_Rel *loc;
+ bfd_byte *loc;
int indx;
outrel.r_offset = rel->r_offset
sreloc = elf_section_data (input_section)->sreloc;
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rel *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &outrel, loc);
if (indx)
continue;
{
bfd_vma plt_index;
bfd_vma got_offset;
- Elf_Internal_Rel rel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
+ htab->sgotplt->output_offset
+ got_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_JUMP_SLOT);
- loc = (Elf32_External_Rel *) htab->srelplt->contents + plt_index;
+ loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
&& elf_i386_hash_entry(h)->tls_type != GOT_TLS_GD
&& (elf_i386_hash_entry(h)->tls_type & GOT_TLS_IE) == 0)
{
- Elf_Internal_Rel rel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_GLOB_DAT);
}
- loc = (Elf32_External_Rel *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
- Elf_Internal_Rel rel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_386_COPY);
- loc = (Elf32_External_Rel *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rel);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
}
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void elf32_i860_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_reloc_status_type elf32_i860_relocate_splitn
PARAMS ((bfd *, Elf_Internal_Rela *, bfd_byte *, bfd_vma));
elf32_i860_info_to_howto_rela (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf64_Internal_Rela *elf_reloc;
+ Elf_Internal_Rela *elf_reloc;
{
bfd_reloc->howto
= lookup_howto ((unsigned) ELF32_R_TYPE (elf_reloc->r_info));
static reloc_howto_type *elf32_i960_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf32_i960_info_to_howto
- PARAMS ((bfd *, arelent *cache_ptr, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *cache_ptr, Elf_Internal_Rela *));
static void elf32_i960_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
#define USE_REL 1
elf32_i960_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf32_Internal_Rela *dst ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *dst ATTRIBUTE_UNUSED;
{
abort ();
}
elf32_i960_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
enum elf_i960_reloc_type type;
/* Prototypes. */
static reloc_howto_type * ip2k_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void ip2k_info_to_howto_rela PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static void ip2k_info_to_howto_rela PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static asection * ip2k_elf_gc_mark_hook PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *, struct elf_link_hash_entry *, Elf_Internal_Sym *));
static boolean ip2k_elf_gc_sweep_hook PARAMS ((bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *));
-static bfd_vma symbol_value PARAMS ((bfd *, Elf_Internal_Shdr *, Elf32_Internal_Sym *, Elf_Internal_Rela *));
+static bfd_vma symbol_value PARAMS ((bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, Elf_Internal_Rela *));
static void adjust_all_relocations PARAMS ((bfd *, asection *, bfd_vma, bfd_vma, int, int));
static boolean ip2k_elf_relax_delete_bytes PARAMS ((bfd *, asection *, bfd_vma, int));
static boolean ip2k_elf_relax_add_bytes PARAMS ((bfd *, asection *, bfd_vma, const bfd_byte *, int, int));
symbol_value (abfd, symtab_hdr, isymbuf, irel)
bfd *abfd;
Elf_Internal_Shdr *symtab_hdr;
- Elf32_Internal_Sym *isymbuf;
+ Elf_Internal_Sym *isymbuf;
Elf_Internal_Rela *irel;
{
if (ELF32_R_SYM (irel->r_info) < symtab_hdr->sh_info)
unsigned int symcount;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
- isymbuf = (Elf32_Internal_Sym *) symtab_hdr->contents;
+ isymbuf = (Elf_Internal_Sym *) symtab_hdr->contents;
shndx = _bfd_elf_section_from_bfd_section (abfd, sec);
return false;
else
{
- Elf32_Internal_Rela * jrel = irel - 1;
+ Elf_Internal_Rela * jrel = irel - 1;
/* Add relocation for PAGE insn added. */
if (ELF32_R_TYPE (jrel->r_info) != R_IP2K_NONE)
ip2k_info_to_howto_rela (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr;
- Elf32_Internal_Rela * dst;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type;
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void m32r_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
boolean _bfd_m32r_elf_section_from_bfd_section
PARAMS ((bfd *, asection *, int *));
void _bfd_m32r_elf_symbol_processing
m32r_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void m68hc11_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_reloc_status_type m68hc11_elf_ignore_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
m68hc11_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void m68hc11_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_reloc_status_type m68hc11_elf_ignore_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
m68hc11_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void rtype_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static struct bfd_hash_entry *elf_m68k_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table *elf_m68k_link_hash_table_create
if (info->shared)
{
- asection *srelgot;
+ asection *s;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
+ s = bfd_get_section_by_name (dynobj, ".rela.got");
+ BFD_ASSERT (s != NULL);
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
+ off);
outrel.r_info = ELF32_R_INFO (0, R_68K_RELATIVE);
outrel.r_addend = relocation;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
local_got_offsets[r_symndx] |= 1;
& ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
}
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
/* This reloc will be computed at runtime, so there's no
need to do anything now, except for R_68K_32
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
+ got_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_JMP_SLOT);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + plt_index));
+ loc = srela->contents + plt_index * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rela.r_addend = 0;
}
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
+ loc = srela->contents;
+ loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
asection *s;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_68K_COPY);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
static reloc_howto_type * mcore_elf_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void mcore_elf_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean mcore_elf_set_private_flags
PARAMS ((bfd *, flagword));
static boolean mcore_elf_merge_private_bfd_data
mcore_elf_info_to_howto (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr;
- Elf32_Internal_Rela * dst;
+ Elf_Internal_Rela * dst;
{
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */
mcore_elf_howto_init ();
static reloc_howto_type *mips_elf32_rtype_to_howto
PARAMS ((unsigned int, boolean));
static void mips_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void mips_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
static boolean mips_elf32_object_p PARAMS ((bfd *));
static boolean mips_elf_is_local_label_name
}
}
-/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */
+/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
mips_elf32_rtype_to_howto (r_type, rela_p)
}
}
-/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */
+/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static void
mips_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
cache_ptr->addend = elf_gp (abfd);
}
-/* Given a MIPS Elf32_Internal_Rela, fill in an arelent structure. */
+/* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
static void
mips_info_to_howto_rela (abfd, cache_ptr, dst)
bfd *abfd;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
- /* Since an Elf32_Internal_Rel is an initial prefix of an
- Elf32_Internal_Rela, we can just use mips_info_to_howto_rel
- above. */
- mips_info_to_howto_rel (abfd, cache_ptr, (Elf32_Internal_Rel *) dst);
+ mips_info_to_howto_rel (abfd, cache_ptr, dst);
/* If we ever need to do any extra processing with dst->r_addend
- (the field omitted in an Elf32_Internal_Rel) we can do it here. */
+ (the field omitted in an Elf_Internal_Rel) we can do it here. */
}
\f
/* Determine whether a symbol is global for the purposes of splitting
static reloc_howto_type *openrisc_reloc_type_lookup
PARAMS ((bfd * , bfd_reloc_code_real_type));
static void openrisc_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean openrisc_elf_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
openrisc_info_to_howto_rela (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr;
- Elf32_Internal_Rela * dst;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type;
#include "libiberty.h"
static reloc_howto_type * bfd_elf32_bfd_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
-static void or32_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+static void or32_info_to_howto_rel PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean or32_elf_object_p PARAMS ((bfd *));
static void or32_elf_final_write_processing PARAMS ((bfd *, boolean));
static bfd_reloc_status_type or32_elf_32_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
or32_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *ppc_elf_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void ppc_elf_info_to_howto
- PARAMS ((bfd *abfd, arelent *cache_ptr, Elf32_Internal_Rela *dst));
+ PARAMS ((bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst));
static void ppc_elf_howto_init PARAMS ((void));
static int ppc_elf_sort_rela PARAMS ((const PTR, const PTR));
static boolean ppc_elf_relax_section
PARAMS ((bfd *, struct bfd_link_info *));
static boolean ppc_elf_section_from_shdr PARAMS ((bfd *,
- Elf32_Internal_Shdr *,
+ Elf_Internal_Shdr *,
const char *));
static boolean ppc_elf_fake_sections
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
static elf_linker_section_t *ppc_elf_create_linker_section
PARAMS ((bfd *abfd,
ppc_elf_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
if (!ppc_elf_howto_table[R_PPC_ADDR32])
/* Initialize howto table if needed. */
static boolean
ppc_elf_section_from_shdr (abfd, hdr, name)
bfd *abfd;
- Elf32_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
const char *name;
{
asection *newsect;
static boolean
ppc_elf_fake_sections (abfd, shdr, asect)
bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *shdr;
+ Elf_Internal_Shdr *shdr;
asection *asect;
{
if ((asect->flags & SEC_EXCLUDE) != 0)
asection *splt;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
bfd_vma reloc_index;
#ifdef DEBUG
reloc_index = (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_SLOT_SIZE;
if (reloc_index > PLT_NUM_SINGLE_ENTRIES)
reloc_index -= (reloc_index - PLT_NUM_SINGLE_ENTRIES) / 2;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + reloc_index));
+ loc = srela->contents + reloc_index * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
}
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
+ loc = srela->contents;
+ loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
asection *s;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbols needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_PPC_COPY);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
#ifdef DEBUG
if (info->shared && r_symndx != 0)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
int skip;
#ifdef DEBUG
}
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
if (skip == -1)
continue;
{
asection *srelgot;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
/* We need to generate a R_PPC_RELATIVE reloc
for the dynamic linker. */
+ off);
outrel.r_info = ELF32_R_INFO (0, R_PPC_RELATIVE);
outrel.r_addend = relocation;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
relocation = 0;
}
{
asection *srelgot;
Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
srelgot = htab->srelgot;
if (srelgot == NULL)
+ off);
outrel.r_info = ELF32_R_INFO (0, R_390_RELATIVE);
outrel.r_addend = relocation;
- loc = (Elf32_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
Elf_Internal_Rela outrel;
boolean skip, relocate;
asection *sreloc;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
if (sreloc == NULL)
abort ();
- loc = (Elf32_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rela;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
bfd_vma relative_offset;
/* This symbol has an entry in the procedure linkage table. Set
+ got_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_JMP_SLOT);
rela.r_addend = 0;
- loc = (Elf32_External_Rela *) htab->srelplt->contents + plt_index;
+ loc = htab->srelplt->contents + plt_index * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
if (h->got.offset != (bfd_vma) -1)
{
Elf_Internal_Rela rela;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rela.r_addend = 0;
}
- loc = (Elf32_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* This symbols needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
- loc = (Elf32_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
}
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do
not want to fiddle with the addend. Otherwise, we
if (info->shared)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (srelgot == NULL)
{
+ off);
outrel.r_info = ELF32_R_INFO (0, R_SH_RELATIVE);
outrel.r_addend = relocation;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
#ifdef INCLUDE_SHMEDIA
unsigned short insn;
int indx;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_GD_32)
{
outrel.r_addend = relocation - dtpoff_base (info);
else
outrel.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
continue;
}
else
{
Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
int dr_type, indx;
if (srelgot == NULL)
else
outrel.r_addend = 0;
outrel.r_info = ELF32_R_INFO (indx, dr_type);
- loc = (Elf32_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
if (r_type == R_SH_TLS_GD_32)
outrel.r_offset += 4;
outrel.r_addend = 0;
srelgot->reloc_count++;
- loc++;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- loc);
+ loc += sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
}
}
else
{
Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
srelgot = htab->srelgot;
if (srelgot == NULL)
+ sgot->output_offset + off);
outrel.r_addend = 0;
outrel.r_info = ELF32_R_INFO (0, R_SH_TLS_DTPMOD32);
- loc = (Elf32_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf32_External_Rela);
bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
htab->tls_ldm_got.offset |= 1;
}
{
int indx;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (sreloc == NULL)
{
outrel.r_addend = relocation - dtpoff_base (info);
else
outrel.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
continue;
}
else
{
int indx;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (sreloc == NULL)
{
outrel.r_addend = relocation - dtpoff_base (info);
else
outrel.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
continue;
}
}
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
#ifdef GOT_BIAS
rel.r_addend = GOT_BIAS;
#endif
- bfd_elf32_swap_reloca_out (output_bfd, &rel,
- ((Elf32_External_Rela *) srel->contents
- + plt_index));
+ loc = srel->contents + plt_index * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
asection *sgot;
asection *srel;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rel.r_addend = 0;
}
- bfd_elf32_swap_reloca_out (output_bfd, &rel,
- ((Elf32_External_Rela *) srel->contents
- + srel->reloc_count));
- ++srel->reloc_count;
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
}
#ifdef INCLUDE_SHMEDIA
asection *sgot;
asection *srel;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has a datalabel entry in the global offset table.
Set it up. */
rel.r_addend = 0;
}
- bfd_elf32_swap_reloca_out (output_bfd, &rel,
- ((Elf32_External_Rela *) srel->contents
- + srel->reloc_count));
- ++srel->reloc_count;
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
}
}
#endif
{
asection *s;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rel.r_info = ELF32_R_INFO (h->dynindx, R_SH_COPY);
rel.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rel,
- ((Elf32_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rel, loc);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
static reloc_howto_type *v850_elf_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void v850_elf_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void v850_elf_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_reloc_status_type v850_elf_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static boolean v850_elf_is_local_label_name
static boolean v850_elf_object_p
PARAMS ((bfd *));
static boolean v850_elf_fake_sections
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
static void v850_elf_final_write_processing
PARAMS ((bfd *, boolean));
static boolean v850_elf_set_private_flags
static void
v850_elf_info_to_howto_rel (abfd, cache_ptr, dst)
- bfd * abfd ATTRIBUTE_UNUSED;
- arelent * cache_ptr;
- Elf32_Internal_Rel * dst;
+ bfd * abfd ATTRIBUTE_UNUSED;
+ arelent * cache_ptr;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type;
/* Set the howto pointer for a V850 ELF reloc (type RELA). */
static void
v850_elf_info_to_howto_rela (abfd, cache_ptr, dst)
- bfd * abfd ATTRIBUTE_UNUSED;
- arelent * cache_ptr;
- Elf32_Internal_Rela *dst;
+ bfd * abfd ATTRIBUTE_UNUSED;
+ arelent * cache_ptr;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type;
static boolean
v850_elf_fake_sections (abfd, hdr, sec)
- bfd * abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr * hdr;
- asection * sec;
+ bfd * abfd ATTRIBUTE_UNUSED;
+ Elf_Internal_Shdr * hdr;
+ asection * sec;
{
register const char * name;
static reloc_howto_type *reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void rtype_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static struct bfd_hash_entry *elf_vax_link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table *elf_vax_link_hash_table_create
& ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
outrel.r_addend,
bfd_get_section_name (input_bfd, input_section));
}
- bfd_elf32_swap_reloca_out (output_bfd, &outrel,
- (((Elf32_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &outrel, loc);
/* This reloc will be computed at runtime, so there's no
need to do anything now, except for R_VAX_32
bfd_vma got_offset;
bfd_vma addend;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
+ got_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_JMP_SLOT);
rela.r_addend = addend;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + plt_index));
+ loc = srela->contents + plt_index * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
(sgot->contents
+ (h->got.offset & ~1)));
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
+ loc = srela->contents;
+ loc += srela->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
asection *s;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF32_R_INFO (h->dynindx, R_VAX_COPY);
rela.r_addend = 0;
- bfd_elf32_swap_reloca_out (output_bfd, &rela,
- ((Elf32_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf32_External_Rela);
+ bfd_elf32_swap_reloca_out (output_bfd, &rela, loc);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
static reloc_howto_type * xstormy16_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void xstormy16_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_reloc_status_type xstormy16_elf_24_reloc
PARAMS ((bfd *abfd, arelent *reloc_entry, asymbol *symbol,
PTR data, asection *input_section, bfd *output_bfd,
xstormy16_info_to_howto_rela (abfd, cache_ptr, dst)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * cache_ptr;
- Elf32_Internal_Rela * dst;
+ Elf_Internal_Rela * dst;
{
unsigned int r_type = ELF32_R_TYPE (dst->r_info);
static reloc_howto_type * elf64_alpha_bfd_reloc_type_lookup
PARAMS((bfd *, bfd_reloc_code_real_type));
static void elf64_alpha_info_to_howto
- PARAMS((bfd *, arelent *, Elf64_Internal_Rela *));
+ PARAMS((bfd *, arelent *, Elf_Internal_Rela *));
static boolean elf64_alpha_mkobject
PARAMS((bfd *));
static boolean elf64_alpha_object_p
PARAMS((bfd *));
static boolean elf64_alpha_section_from_shdr
- PARAMS((bfd *, Elf64_Internal_Shdr *, const char *));
+ PARAMS((bfd *, Elf_Internal_Shdr *, const char *));
static boolean elf64_alpha_section_flags
- PARAMS((flagword *, Elf64_Internal_Shdr *));
+ PARAMS((flagword *, Elf_Internal_Shdr *));
static boolean elf64_alpha_fake_sections
- PARAMS((bfd *, Elf64_Internal_Shdr *, asection *));
+ PARAMS((bfd *, Elf_Internal_Shdr *, asection *));
static boolean elf64_alpha_create_got_section
PARAMS((bfd *, struct bfd_link_info *));
static boolean elf64_alpha_create_dynamic_sections
elf64_alpha_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned r_type;
static boolean
elf64_alpha_section_from_shdr (abfd, hdr, name)
bfd *abfd;
- Elf64_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
const char *name;
{
asection *newsect;
static boolean
elf64_alpha_section_flags (flags, hdr)
flagword *flags;
- Elf64_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
{
if (hdr->sh_flags & SHF_ALPHA_GPREL)
*flags |= SEC_SMALL_DATA;
static boolean
elf64_alpha_fake_sections (abfd, hdr, sec)
bfd *abfd;
- Elf64_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
asection *sec;
{
register const char *name;
if (info->shared && !dynamic_symbol_p)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
BFD_ASSERT(srelgot != NULL);
outrel.r_info = ELF64_R_INFO (0, R_ALPHA_RELATIVE);
outrel.r_addend = value;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count++);
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
BFD_ASSERT (sizeof (Elf64_External_Rela)
* srelgot->reloc_count
<= srelgot->_cooked_size);
case R_ALPHA_TPREL64:
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
/* Careful here to remember RELATIVE relocations for global
variables for symbolic shared objects. */
else
memset (&outrel, 0, sizeof outrel);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srel->contents)
- + srel->reloc_count++);
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
<= srel->_cooked_size);
}
if (info->shared && !dynamic_symbol_p)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
BFD_ASSERT(srelgot != NULL);
outrel.r_info = ELF64_R_INFO (0, R_ALPHA_DTPMOD64);
outrel.r_addend = 0;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count++);
+ loc = srelgot->contents;
+ loc += srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
BFD_ASSERT (sizeof (Elf64_External_Rela)
* srelgot->reloc_count
<= srelgot->_cooked_size);
/* Fill in the .plt entry for this symbol. */
asection *splt, *sgot, *srel;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
bfd_vma got_addr, plt_addr;
bfd_vma plt_index;
struct alpha_elf_got_entry *gotent;
outrel.r_info = ELF64_R_INFO(h->dynindx, R_ALPHA_JMP_SLOT);
outrel.r_addend = 0;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)srel->contents
- + plt_index));
+ loc = srel->contents + plt_index * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
if (!(h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{
outrel.r_info = ELF64_R_INFO(0, R_ALPHA_RELATIVE);
outrel.r_addend = plt_addr;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)
- srel->contents)
- + srel->reloc_count++);
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
<= srel->_cooked_size);
}
/* Fill in the dynamic relocations for this symbol's .got entries. */
asection *srel;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
struct alpha_elf_got_entry *gotent;
srel = bfd_get_section_by_name (dynobj, ".rela.got");
outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
outrel.r_addend = gotent->addend;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)srel->contents
- + srel->reloc_count++));
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
if (gotent->reloc_type == R_ALPHA_TLSGD)
{
outrel.r_offset += 8;
outrel.r_info = ELF64_R_INFO (h->dynindx, R_ALPHA_DTPREL64);
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- ((Elf64_External_Rela *)srel->contents
- + srel->reloc_count++));
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
BFD_ASSERT (sizeof (Elf64_External_Rela) * srel->reloc_count
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ bfd_elf64_swap_reloc_in,
+ bfd_elf64_swap_reloc_out,
+ bfd_elf64_swap_reloca_in,
+ bfd_elf64_swap_reloca_out
};
#define TARGET_LITTLE_SYM bfd_elf64_alpha_vec
false); /* pcrel_offset */
static void elf_generic_info_to_howto
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void elf_generic_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean elf64_generic_link_add_symbols
PARAMS ((bfd *, struct bfd_link_info *));
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf64_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf64_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
{
bfd_reloc->howto = &dummy;
}
PARAMS ((bfd *));
static boolean elf64_hppa_section_from_shdr
- PARAMS ((bfd *, Elf64_Internal_Shdr *, const char *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
static void elf64_hppa_post_process_headers
PARAMS ((bfd *, struct bfd_link_info *));
static boolean
elf64_hppa_section_from_shdr (abfd, hdr, name)
bfd *abfd;
- Elf64_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
const char *name;
{
asection *newsect;
{
bfd_vma value;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
BFD_ASSERT (splt != NULL && spltrel != NULL)
rel.r_info = ELF64_R_INFO (h->dynindx, R_PARISC_IPLT);
rel.r_addend = 0;
- bfd_elf64_swap_reloca_out (splt->output_section->owner, &rel,
- (((Elf64_External_Rela *)
- spltrel->contents)
- + spltrel->reloc_count));
- spltrel->reloc_count++;
+ loc = spltrel->contents;
+ loc += spltrel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (splt->output_section->owner, &rel, loc);
}
/* Initialize an external call stub entry if requested. */
had their address taken). */
if (info->shared && dyn_h && dyn_h->want_opd)
{
- Elf64_Internal_Rela rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
int dynindx;
/* We may need to do a relocation against a local symbol, in
rel.r_addend = 0;
rel.r_info = ELF64_R_INFO (dynindx, R_PARISC_EPLT);
- bfd_elf64_swap_reloca_out (sopd->output_section->owner, &rel,
- (((Elf64_External_Rela *)
- sopdrel->contents)
- + sopdrel->reloc_count));
- sopdrel->reloc_count++;
+ loc = sopdrel->contents;
+ loc += sopdrel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (sopd->output_section->owner, &rel, loc);
}
return true;
}
if (dyn_h->want_dlt
&& (elf64_hppa_dynamic_symbol_p (dyn_h->h, info) || info->shared))
{
- Elf64_Internal_Rela rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
int dynindx;
/* We may need to do a relocation against a local symbol, in
rel.r_info = ELF64_R_INFO (dynindx, R_PARISC_DIR64);
rel.r_addend = 0;
- bfd_elf64_swap_reloca_out (sdlt->output_section->owner, &rel,
- (((Elf64_External_Rela *)
- sdltrel->contents)
- + sdltrel->reloc_count));
- sdltrel->reloc_count++;
+ loc = sdltrel->contents;
+ loc += sdltrel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (sdlt->output_section->owner, &rel, loc);
}
return true;
}
for (rent = dyn_h->reloc_entries; rent; rent = rent->next)
{
- Elf64_Internal_Rela rel;
+ Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* Allocate one iff we are building a shared library, the relocation
isn't a R_PARISC_FPTR64, or we don't want an opd entry. */
rel.r_info = ELF64_R_INFO (dynindx, rent->type);
+ loc = hppa_info->other_rel_sec->contents;
+ loc += (hppa_info->other_rel_sec->reloc_count++
+ * sizeof (Elf64_External_Rela));
bfd_elf64_swap_reloca_out (hppa_info->other_rel_sec->output_section->owner,
- &rel,
- (((Elf64_External_Rela *)
- hppa_info->other_rel_sec->contents)
- + hppa_info->other_rel_sec->reloc_count));
- hppa_info->other_rel_sec->reloc_count++;
+ &rel, loc);
}
}
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ bfd_elf64_swap_reloc_in,
+ bfd_elf64_swap_reloc_out,
+ bfd_elf64_swap_reloca_in,
+ bfd_elf64_swap_reloca_out
};
#define TARGET_BIG_SYM bfd_elf64_hppa_vec
static void mips_elf64_swap_reloc_in
PARAMS ((bfd *, const Elf64_Mips_External_Rel *,
- Elf64_Mips_Internal_Rel *));
+ Elf64_Mips_Internal_Rela *));
static void mips_elf64_swap_reloca_in
PARAMS ((bfd *, const Elf64_Mips_External_Rela *,
Elf64_Mips_Internal_Rela *));
static void mips_elf64_swap_reloc_out
- PARAMS ((bfd *, const Elf64_Mips_Internal_Rel *,
+ PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *,
Elf64_Mips_External_Rel *));
static void mips_elf64_swap_reloca_out
PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *,
Elf64_Mips_External_Rela *));
static void mips_elf64_be_swap_reloc_in
- PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
+ PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
static void mips_elf64_be_swap_reloc_out
- PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
+ PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
static void mips_elf64_be_swap_reloca_in
PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
static void mips_elf64_be_swap_reloca_out
static reloc_howto_type *mips_elf64_rtype_to_howto
PARAMS ((unsigned int, boolean));
static void mips_elf64_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void mips_elf64_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *));
static boolean mips_elf64_slurp_one_reloc_table
PARAMS ((bfd *, asection *, asymbol **, const Elf_Internal_Shdr *));
mips_elf64_swap_reloc_in (abfd, src, dst)
bfd *abfd;
const Elf64_Mips_External_Rel *src;
- Elf64_Mips_Internal_Rel *dst;
+ Elf64_Mips_Internal_Rela *dst;
{
dst->r_offset = H_GET_64 (abfd, src->r_offset);
dst->r_sym = H_GET_32 (abfd, src->r_sym);
dst->r_type3 = H_GET_8 (abfd, src->r_type3);
dst->r_type2 = H_GET_8 (abfd, src->r_type2);
dst->r_type = H_GET_8 (abfd, src->r_type);
+ dst->r_addend = 0;
}
/* Swap in a MIPS 64-bit Rela reloc. */
static void
mips_elf64_swap_reloc_out (abfd, src, dst)
bfd *abfd;
- const Elf64_Mips_Internal_Rel *src;
+ const Elf64_Mips_Internal_Rela *src;
Elf64_Mips_External_Rel *dst;
{
H_PUT_64 (abfd, src->r_offset, dst->r_offset);
mips_elf64_be_swap_reloc_in (abfd, src, dst)
bfd *abfd;
const bfd_byte *src;
- Elf_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
- Elf64_Mips_Internal_Rel mirel;
+ Elf64_Mips_Internal_Rela mirel;
mips_elf64_swap_reloc_in (abfd,
(const Elf64_Mips_External_Rel *) src,
dst[0].r_offset = mirel.r_offset;
dst[0].r_info = ELF64_R_INFO (mirel.r_sym, mirel.r_type);
+ dst[0].r_addend = 0;
dst[1].r_offset = mirel.r_offset;
dst[1].r_info = ELF64_R_INFO (mirel.r_ssym, mirel.r_type2);
+ dst[1].r_addend = 0;
dst[2].r_offset = mirel.r_offset;
dst[2].r_info = ELF64_R_INFO (STN_UNDEF, mirel.r_type3);
+ dst[2].r_addend = 0;
}
/* Swap in a MIPS 64-bit Rela reloc. */
static void
mips_elf64_be_swap_reloc_out (abfd, src, dst)
bfd *abfd;
- const Elf_Internal_Rel *src;
+ const Elf_Internal_Rela *src;
bfd_byte *dst;
{
- Elf64_Mips_Internal_Rel mirel;
+ Elf64_Mips_Internal_Rela mirel;
mirel.r_offset = src[0].r_offset;
BFD_ASSERT(src[0].r_offset == src[1].r_offset);
}
}
-/* Given a MIPS Elf64_Internal_Rel, fill in an arelent structure. */
+/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
mips_elf64_rtype_to_howto (r_type, rela_p)
mips_elf64_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf64_Internal_Rel *dst ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *dst ATTRIBUTE_UNUSED;
{
BFD_ASSERT (0);
}
mips_elf64_info_to_howto_rela (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr ATTRIBUTE_UNUSED;
- Elf64_Internal_Rela *dst ATTRIBUTE_UNUSED;
+ Elf_Internal_Rela *dst ATTRIBUTE_UNUSED;
{
BFD_ASSERT (0);
}
(Elf64_Mips_External_Rela *) native_relocs,
&rela);
else
- {
- Elf64_Mips_Internal_Rel rel;
-
- mips_elf64_swap_reloc_in (abfd,
- (Elf64_Mips_External_Rel *) native_relocs,
- &rel);
- rela.r_offset = rel.r_offset;
- rela.r_sym = rel.r_sym;
- rela.r_ssym = rel.r_ssym;
- rela.r_type3 = rel.r_type3;
- rela.r_type2 = rel.r_type2;
- rela.r_type = rel.r_type;
- rela.r_addend = 0;
- }
+ mips_elf64_swap_reloc_in (abfd,
+ (Elf64_Mips_External_Rel *) native_relocs,
+ &rela);
/* Each entry represents exactly three actual relocations. */
for (idx = 0; idx < sec->reloc_count; idx++, ext_rel++)
{
arelent *ptr;
- Elf64_Mips_Internal_Rel int_rel;
+ Elf64_Mips_Internal_Rela int_rel;
asymbol *sym;
int n;
unsigned int i;
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void mmix_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static int mmix_elf_sort_relocs PARAMS ((const PTR, const PTR));
mmix_info_to_howto_rela (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *ppc64_elf_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
static void ppc64_elf_info_to_howto
- PARAMS ((bfd *abfd, arelent *cache_ptr, Elf64_Internal_Rela *dst));
+ PARAMS ((bfd *abfd, arelent *cache_ptr, Elf_Internal_Rela *dst));
static bfd_reloc_status_type ppc64_elf_ha_reloc
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
static bfd_reloc_status_type ppc64_elf_brtaken_reloc
ppc64_elf_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int type;
{
/* Create a reloc for the branch lookup table entry. */
Elf_Internal_Rela rela;
- Elf64_External_Rela *r;
+ bfd_byte *loc;
rela.r_offset = (br_entry->offset
+ htab->sbrlt->output_offset
rela.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
rela.r_addend = off;
- r = (Elf64_External_Rela *) htab->srelbrlt->contents;
- r += htab->srelbrlt->reloc_count++;
- bfd_elf64_swap_reloca_out (htab->srelbrlt->owner, &rela, r);
+ loc = htab->srelbrlt->contents;
+ loc += htab->srelbrlt->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (htab->srelbrlt->owner, &rela, loc);
}
off = (br_entry->offset
if (info->shared)
{
Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* We need to generate a R_PPC64_RELATIVE reloc
for the dynamic linker. */
+ off);
outrel.r_info = ELF64_R_INFO (0, R_PPC64_RELATIVE);
outrel.r_addend = relocation;
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += (htab->srelgot->reloc_count++
+ * sizeof (Elf64_External_Rela));
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
Elf_Internal_Rela outrel;
boolean skip, relocate;
asection *sreloc;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* When generating a dynamic object, these relocations
are copied into the output file to be resolved at run
if (sreloc == NULL)
abort ();
- loc = (Elf64_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, it will
&& ((struct ppc_link_hash_entry *) h)->is_func_descriptor)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_JMP_SLOT);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelplt->contents;
- loc += (h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE;
+ loc = htab->srelplt->contents;
+ loc += ((h->plt.offset - PLT_INITIAL_ENTRY_SIZE) / PLT_ENTRY_SIZE
+ * sizeof (Elf64_External_Rela));
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
if (h->got.offset != (bfd_vma) -1)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rela.r_addend = 0;
}
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_PPC64_COPY);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
switch (ELF64_R_TYPE (rel->r_info))
{
case R_390_GOT12:
- case R_390_GOT16:
+ case R_390_GOT16:
case R_390_GOT32:
case R_390_GOT64:
case R_390_GOTENT:
}
break;
- case R_390_PLT16DBL:
+ case R_390_PLT16DBL:
case R_390_PLT32:
case R_390_PLT32DBL:
case R_390_PLT64:
/* This symbol requires a procedure linkage table entry. We
- actually build the entry in adjust_dynamic_symbol,
- because this might be a case of linking PIC code which is
- never referenced by a dynamic object, in which case we
- don't need to generate a procedure linkage table entry
- after all. */
+ actually build the entry in adjust_dynamic_symbol,
+ because this might be a case of linking PIC code which is
+ never referenced by a dynamic object, in which case we
+ don't need to generate a procedure linkage table entry
+ after all. */
/* If this is a local symbol, we resolve it directly without
- creating a procedure linkage table entry. */
+ creating a procedure linkage table entry. */
if (h == NULL)
continue;
h->plt.refcount += 1;
break;
- case R_390_8:
- case R_390_16:
+ case R_390_8:
+ case R_390_16:
case R_390_32:
case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
+ case R_390_PC16:
+ case R_390_PC16DBL:
case R_390_PC32:
case R_390_PC32DBL:
case R_390_PC64:
/* This relocation describes the C++ object vtable hierarchy.
Reconstruct it for later use during GC. */
- case R_390_GNU_VTINHERIT:
- if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
- return false;
- break;
+ case R_390_GNU_VTINHERIT:
+ if (!_bfd_elf64_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
+ return false;
+ break;
/* This relocation describes which C++ vtable entries are actually
used. Record for later use during GC. */
- case R_390_GNU_VTENTRY:
- if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
- return false;
- break;
+ case R_390_GNU_VTENTRY:
+ if (!_bfd_elf64_gc_record_vtentry (abfd, sec, h, rel->r_addend))
+ return false;
+ break;
default:
break;
&& h->root.type != bfd_link_hash_undefined))
{
/* This case can occur if we saw a PLT32 reloc in an input
- file, but the symbol was never referred to by a dynamic
- object, or if all references were garbage collected. In
+ file, but the symbol was never referred to by a dynamic
+ object, or if all references were garbage collected. In
such a case, we don't actually need to build a procedure
linkage table, and we can just do a PC32 reloc instead. */
h->plt.offset = (bfd_vma) -1;
}
if (relocs)
- {
- if (!add_dynamic_entry (DT_RELA, 0)
- || !add_dynamic_entry (DT_RELASZ, 0)
- || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
+ {
+ if (!add_dynamic_entry (DT_RELA, 0)
+ || !add_dynamic_entry (DT_RELASZ, 0)
+ || !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
return false;
/* If any dynamic relocs apply to a read-only section,
r_type = ELF64_R_TYPE (rel->r_info);
if (r_type == (int) R_390_GNU_VTINHERIT
- || r_type == (int) R_390_GNU_VTENTRY)
- continue;
+ || r_type == (int) R_390_GNU_VTENTRY)
+ continue;
if (r_type < 0 || r_type >= (int) R_390_max)
{
bfd_set_error (bfd_error_bad_value);
{
if (! ((*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
- input_section, rel->r_offset,
+ input_section, rel->r_offset,
(!info->shared || info->no_undefined
|| ELF_ST_VISIBILITY (h->other)))))
return false;
switch (r_type)
{
- case R_390_GOT12:
- case R_390_GOT16:
- case R_390_GOT32:
- case R_390_GOT64:
- case R_390_GOTENT:
- /* Relocation is to the entry for this symbol in the global
- offset table. */
+ case R_390_GOT12:
+ case R_390_GOT16:
+ case R_390_GOT32:
+ case R_390_GOT64:
+ case R_390_GOTENT:
+ /* Relocation is to the entry for this symbol in the global
+ offset table. */
if (htab->sgot == NULL)
abort ();
- if (h != NULL)
- {
+ if (h != NULL)
+ {
boolean dyn;
- off = h->got.offset;
+ off = h->got.offset;
dyn = htab->elf.dynamic_sections_created;
- if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
- || (info->shared
- && (info->symbolic
+ if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)
+ || (info->shared
+ && (info->symbolic
|| h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
- && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
- {
- /* This is actually a static link, or it is a
- -Bsymbolic link and the symbol is defined
- locally, or the symbol was forced to be local
- because of a version file. We must initialize
- this entry in the global offset table. Since the
- offset must always be a multiple of 2, we use the
- least significant bit to record whether we have
- initialized it already.
-
- When doing a dynamic link, we create a .rel.got
- relocation entry to initialize the value. This
- is done in the finish_dynamic_symbol routine. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
+ && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR)))
+ {
+ /* This is actually a static link, or it is a
+ -Bsymbolic link and the symbol is defined
+ locally, or the symbol was forced to be local
+ because of a version file. We must initialize
+ this entry in the global offset table. Since the
+ offset must always be a multiple of 2, we use the
+ least significant bit to record whether we have
+ initialized it already.
+
+ When doing a dynamic link, we create a .rel.got
+ relocation entry to initialize the value. This
+ is done in the finish_dynamic_symbol routine. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
bfd_put_64 (output_bfd, relocation,
htab->sgot->contents + off);
- h->got.offset |= 1;
- }
- }
+ h->got.offset |= 1;
+ }
+ }
else
unresolved_reloc = false;
- }
- else
- {
+ }
+ else
+ {
if (local_got_offsets == NULL)
abort ();
- off = local_got_offsets[r_symndx];
+ off = local_got_offsets[r_symndx];
- /* The offset must always be a multiple of 8. We use
- the least significant bit to record whether we have
- already generated the necessary reloc. */
- if ((off & 1) != 0)
- off &= ~1;
- else
- {
- bfd_put_64 (output_bfd, relocation,
+ /* The offset must always be a multiple of 8. We use
+ the least significant bit to record whether we have
+ already generated the necessary reloc. */
+ if ((off & 1) != 0)
+ off &= ~1;
+ else
+ {
+ bfd_put_64 (output_bfd, relocation,
htab->sgot->contents + off);
- if (info->shared)
- {
- asection *srelgot;
- Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ if (info->shared)
+ {
+ asection *s;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = htab->srelgot;
- if (srelgot == NULL)
+ s = htab->srelgot;
+ if (s == NULL)
abort ();
- outrel.r_offset = (htab->sgot->output_section->vma
- + htab->sgot->output_offset
- + off);
- outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
+ outrel.r_offset = (htab->sgot->output_section->vma
+ + htab->sgot->output_offset
+ + off);
+ outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
outrel.r_addend = relocation;
- loc = (Elf64_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- }
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ }
- local_got_offsets[r_symndx] |= 1;
- }
- }
+ local_got_offsets[r_symndx] |= 1;
+ }
+ }
if (off >= (bfd_vma) -2)
abort ();
if (r_type == R_390_GOTENT)
relocation += htab->sgot->output_section->vma;
- break;
+ break;
- case R_390_GOTOFF:
- /* Relocation is relative to the start of the global offset
- table. */
+ case R_390_GOTOFF:
+ /* Relocation is relative to the start of the global offset
+ table. */
- /* Note that sgot->output_offset is not involved in this
- calculation. We always want the start of .got. If we
- defined _GLOBAL_OFFSET_TABLE in a different way, as is
- permitted by the ABI, we might have to change this
- calculation. */
- relocation -= htab->sgot->output_section->vma;
+ /* Note that sgot->output_offset is not involved in this
+ calculation. We always want the start of .got. If we
+ defined _GLOBAL_OFFSET_TABLE in a different way, as is
+ permitted by the ABI, we might have to change this
+ calculation. */
+ relocation -= htab->sgot->output_section->vma;
- break;
+ break;
- case R_390_GOTPC:
+ case R_390_GOTPC:
case R_390_GOTPCDBL:
- /* Use global offset table as symbol value. */
- relocation = htab->sgot->output_section->vma;
+ /* Use global offset table as symbol value. */
+ relocation = htab->sgot->output_section->vma;
unresolved_reloc = false;
- break;
+ break;
- case R_390_PLT16DBL:
- case R_390_PLT32:
- case R_390_PLT32DBL:
- case R_390_PLT64:
- /* Relocation is to the entry for this symbol in the
- procedure linkage table. */
+ case R_390_PLT16DBL:
+ case R_390_PLT32:
+ case R_390_PLT32DBL:
+ case R_390_PLT64:
+ /* Relocation is to the entry for this symbol in the
+ procedure linkage table. */
- /* Resolve a PLT32 reloc against a local symbol directly,
- without using the procedure linkage table. */
- if (h == NULL)
- break;
+ /* Resolve a PLT32 reloc against a local symbol directly,
+ without using the procedure linkage table. */
+ if (h == NULL)
+ break;
- if (h->plt.offset == (bfd_vma) -1
+ if (h->plt.offset == (bfd_vma) -1
|| htab->splt == NULL)
- {
- /* We didn't make a PLT entry for this symbol. This
- happens when statically linking PIC code, or when
- using -Bsymbolic. */
- break;
- }
-
- relocation = (htab->splt->output_section->vma
- + htab->splt->output_offset
- + h->plt.offset);
+ {
+ /* We didn't make a PLT entry for this symbol. This
+ happens when statically linking PIC code, or when
+ using -Bsymbolic. */
+ break;
+ }
+
+ relocation = (htab->splt->output_section->vma
+ + htab->splt->output_offset
+ + h->plt.offset);
unresolved_reloc = false;
- break;
-
- case R_390_8:
- case R_390_16:
- case R_390_32:
- case R_390_64:
- case R_390_PC16:
- case R_390_PC16DBL:
- case R_390_PC32:
+ break;
+
+ case R_390_8:
+ case R_390_16:
+ case R_390_32:
+ case R_390_64:
+ case R_390_PC16:
+ case R_390_PC16DBL:
+ case R_390_PC32:
case R_390_PC32DBL:
- case R_390_PC64:
+ case R_390_PC64:
/* r_symndx will be zero only for relocs against symbols
from removed linkonce sections, or sections discarded by
a linker script. */
- if (r_symndx == 0
- || (input_section->flags & SEC_ALLOC) == 0)
+ if (r_symndx == 0
+ || (input_section->flags & SEC_ALLOC) == 0)
break;
- if ((info->shared
+ if ((info->shared
&& ((r_type != R_390_PC16
&& r_type != R_390_PC16DBL
&& r_type != R_390_PC32
& ELF_LINK_HASH_DEF_REGULAR) == 0)
|| h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))
- {
- Elf_Internal_Rela outrel;
- boolean skip, relocate;
+ {
+ Elf_Internal_Rela outrel;
+ boolean skip, relocate;
asection *sreloc;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
- /* When generating a shared object, these relocations
- are copied into the output file to be resolved at run
- time. */
+ /* When generating a shared object, these relocations
+ are copied into the output file to be resolved at run
+ time. */
- skip = false;
- relocate = false;
+ skip = false;
+ relocate = false;
outrel.r_offset =
_bfd_elf_section_offset (output_bfd, info, input_section,
else if (outrel.r_offset == (bfd_vma) -2)
skip = true, relocate = true;
- outrel.r_offset += (input_section->output_section->vma
- + input_section->output_offset);
+ outrel.r_offset += (input_section->output_section->vma
+ + input_section->output_offset);
- if (skip)
+ if (skip)
memset (&outrel, 0, sizeof outrel);
- else if (h != NULL
+ else if (h != NULL
&& h->dynindx != -1
&& (r_type == R_390_PC16
|| r_type == R_390_PC16DBL
|| !info->symbolic
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))
- {
- outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
+ {
+ outrel.r_info = ELF64_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
- }
- else
- {
+ }
+ else
+ {
/* This symbol is local, or marked to become local. */
relocate = true;
outrel.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
if (sreloc == NULL)
abort ();
- loc = (Elf64_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
- /* If this reloc is against an external symbol, we do
- not want to fiddle with the addend. Otherwise, we
- need to include the symbol value so that it becomes
- an addend for the dynamic reloc. */
- if (! relocate)
- continue;
- }
+ /* If this reloc is against an external symbol, we do
+ not want to fiddle with the addend. Otherwise, we
+ need to include the symbol value so that it becomes
+ an addend for the dynamic reloc. */
+ if (! relocate)
+ continue;
+ }
- break;
+ break;
- default:
- break;
- }
+ default:
+ break;
+ }
/* Dynamic relocs are not propagated for SEC_DEBUGGING sections
because such sections are not SEC_ALLOC and thus ld.so will
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
- it up. */
+ it up. */
if (h->dynindx == -1
|| htab->splt == NULL
abort ();
/* Calc. index no.
- Current offset - size first entry / entry size. */
+ Current offset - size first entry / entry size. */
plt_index = (h->plt.offset - PLT_FIRST_ENTRY_SIZE) / PLT_ENTRY_SIZE;
/* Offset in GOT is PLT index plus GOT headers(3) times 8,
- addr & GOT addr. */
+ addr & GOT addr. */
got_offset = (plt_index + 3) * GOT_ENTRY_SIZE;
/* Fill in the blueprint of a PLT. */
htab->splt->contents + h->plt.offset + 28);
/* Fill in the entry in the global offset table.
- Points to instruction after GOT offset. */
+ Points to instruction after GOT offset. */
bfd_put_64 (output_bfd,
(htab->splt->output_section->vma
+ htab->splt->output_offset
+ got_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_JMP_SLOT);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelplt->contents + plt_index;
+ loc = htab->srelplt->contents + plt_index * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
if (h->got.offset != (bfd_vma) -1)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
- up. */
+ up. */
if (htab->sgot == NULL || htab->srelgot == NULL)
abort ();
|| h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
- {
+ {
BFD_ASSERT((h->got.offset & 1) != 0);
- rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
- rela.r_addend = (h->root.u.def.value
- + h->root.u.def.section->output_section->vma
- + h->root.u.def.section->output_offset);
- }
+ rela.r_info = ELF64_R_INFO (0, R_390_RELATIVE);
+ rela.r_addend = (h->root.u.def.value
+ + h->root.u.def.section->output_section->vma
+ + h->root.u.def.section->output_offset);
+ }
else
{
BFD_ASSERT((h->got.offset & 1) == 0);
bfd_put_64 (output_bfd, (bfd_vma) 0, htab->sgot->contents + h->got.offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_GLOB_DAT);
- rela.r_addend = 0;
- }
+ rela.r_addend = 0;
+ }
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbols needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_390_COPY);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
sizeof (Elf64_External_Sym),
sizeof (Elf64_External_Dyn),
sizeof (Elf_External_Note),
- 8, /* hash-table entry size */
- 1, /* internal relocations per external relocations */
+ 8, /* hash-table entry size */
+ 1, /* internal relocations per external relocations */
64, /* arch_size */
8, /* file_align */
ELFCLASS64, EV_CURRENT,
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ bfd_elf64_swap_reloc_in,
+ bfd_elf64_swap_reloc_out,
+ bfd_elf64_swap_reloca_in,
+ bfd_elf64_swap_reloca_out
};
#define TARGET_BIG_SYM bfd_elf64_s390_vec
#define elf_backend_size_dynamic_sections elf_s390_size_dynamic_sections
#define elf_backend_reloc_type_class elf_s390_reloc_type_class
-#define elf_backend_object_p elf_s390_object_p
+#define elf_backend_object_p elf_s390_object_p
#include "elf64-target.h"
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
}
}
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- (((Elf64_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do
not want to fiddle with the addend. Otherwise, we
if (info->shared)
{
- asection *srelgot;
+ asection *s;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
- srelgot = bfd_get_section_by_name (dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
+ s = bfd_get_section_by_name (dynobj, ".rela.got");
+ BFD_ASSERT (s != NULL);
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
+ off);
outrel.r_info = ELF64_R_INFO (0, R_SH_RELATIVE64);
outrel.r_addend = relocation;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- (((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
if (rel->r_addend)
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_JMP_SLOT64);
rel.r_addend = 0;
rel.r_addend = GOT_BIAS;
- bfd_elf64_swap_reloca_out (output_bfd, &rel,
- ((Elf64_External_Rela *) srel->contents
- + plt_index));
+ loc = srel->contents + plt_index * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &rel, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
asection *sgot;
asection *srel;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rel.r_addend = 0;
}
- bfd_elf64_swap_reloca_out (output_bfd, &rel,
- ((Elf64_External_Rela *) srel->contents
- + srel->reloc_count));
- ++srel->reloc_count;
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &rel, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
asection *s;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rel.r_info = ELF64_R_INFO (h->dynindx, R_SH_COPY64);
rel.r_addend = 0;
- bfd_elf64_swap_reloca_out (output_bfd, &rel,
- ((Elf64_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &rel, loc);
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
PARAMS ((bfd *, bfd *));
static boolean sparc64_elf_fake_sections
- PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
static const char *sparc64_elf_print_symbol_all
PARAMS ((bfd *, PTR, asymbol *));
sparc64_elf_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
BFD_ASSERT (ELF64_R_TYPE_ID (dst->r_info) < (unsigned int) R_SPARC_max_std);
cache_ptr->howto = &sparc64_elf_howto_table[ELF64_R_TYPE_ID (dst->r_info)];
{
Elf_Internal_Rela rela;
- bfd_elf64_swap_reloca_in (abfd, (Elf64_External_Rela *) native_relocs, &rela);
+ bfd_elf64_swap_reloca_in (abfd, native_relocs, &rela);
/* The address of an ELF reloc is section relative for an object
file, and absolute for an executable file or shared library.
dst_rela.r_info = ELF64_R_INFO (n, ptr->howto->type);
dst_rela.r_addend = ptr->addend;
- bfd_elf64_swap_reloca_out (abfd, &dst_rela, src_rela);
+ bfd_elf64_swap_reloca_out (abfd, &dst_rela, (bfd_byte *) src_rela);
++src_rela;
}
}
case R_SPARC_UA16:
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
if (sreloc == NULL)
}
}
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- (((Elf64_External_Rela *)
- sreloc->contents)
- + sreloc->reloc_count));
- ++sreloc->reloc_count;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
/* This reloc will be computed at runtime, so there's no
need to do anything now. */
if (info->shared)
{
- asection *srelgot;
+ asection *s;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
/* The Solaris 2.7 64-bit linker adds the contents
of the location to the value of the reloc.
/* We need to generate a R_SPARC_RELATIVE reloc
for the dynamic linker. */
- srelgot = bfd_get_section_by_name(dynobj, ".rela.got");
- BFD_ASSERT (srelgot != NULL);
+ s = bfd_get_section_by_name(dynobj, ".rela.got");
+ BFD_ASSERT (s != NULL);
outrel.r_offset = (sgot->output_section->vma
+ sgot->output_offset
+ off);
outrel.r_info = ELF64_R_INFO (0, R_SPARC_RELATIVE);
outrel.r_addend = relocation;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- (((Elf64_External_Rela *)
- srelgot->contents)
- + srelgot->reloc_count));
- ++srelgot->reloc_count;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
else
bfd_put_64 (output_bfd, relocation, sgot->contents + off);
asection *splt;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the PLT. Set it up. */
Sun forgot to read their own ABI and copied elf32-sparc behaviour,
thus .plt[4] has corresponding .rela.plt[0] and so on. */
- bfd_elf64_swap_reloca_out (output_bfd, &rela,
- ((Elf64_External_Rela *) srela->contents
- + (h->plt.offset - 4)));
+ loc = srela->contents;
+ loc += (h->plt.offset - 4) * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
{
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the GOT. Set it up. */
bfd_put_64 (output_bfd, (bfd_vma) 0,
sgot->contents + (h->got.offset &~ (bfd_vma) 1));
- bfd_elf64_swap_reloca_out (output_bfd, &rela,
- ((Elf64_External_Rela *) srela->contents
- + srela->reloc_count));
- ++srela->reloc_count;
+ loc = srela->contents;
+ loc += srela->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
asection *s;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbols needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_SPARC_COPY);
rela.r_addend = 0;
- bfd_elf64_swap_reloca_out (output_bfd, &rela,
- ((Elf64_External_Rela *) s->contents
- + s->reloc_count));
- ++s->reloc_count;
+ loc = s->contents + s->reloc_count++ * sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
/* Mark some specially defined symbols as absolute. */
static boolean
sparc64_elf_fake_sections (abfd, hdr, sec)
bfd *abfd ATTRIBUTE_UNUSED;
- Elf32_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
+ Elf_Internal_Shdr *hdr ATTRIBUTE_UNUSED;
asection *sec;
{
const char *name;
bfd_elf64_slurp_symbol_table,
bfd_elf64_swap_dyn_in,
bfd_elf64_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ bfd_elf64_swap_reloc_in,
+ bfd_elf64_swap_reloc_out,
+ bfd_elf64_swap_reloca_in,
+ bfd_elf64_swap_reloca_out
};
#define TARGET_BIG_SYM bfd_elf64_sparc_vec
static reloc_howto_type *elf64_x86_64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf64_x86_64_info_to_howto
- PARAMS ((bfd *, arelent *, Elf64_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean elf64_x86_64_grok_prstatus
PARAMS ((bfd *, Elf_Internal_Note *));
static boolean elf64_x86_64_grok_psinfo
elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf64_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned r_type, i;
if (info->shared)
{
- asection *srelgot;
+ asection *s;
Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* We need to generate a R_X86_64_RELATIVE reloc
for the dynamic linker. */
- srelgot = htab->srelgot;
- if (srelgot == NULL)
+ s = htab->srelgot;
+ if (s == NULL)
abort ();
outrel.r_offset = (htab->sgot->output_section->vma
+ off);
outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
outrel.r_addend = relocation;
- loc = (Elf64_External_Rela *) srelgot->contents;
- loc += srelgot->reloc_count++;
+ loc = s->contents;
+ loc += s->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
|| h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
asection *sreloc;
- Elf64_External_Rela *loc;
/* When generating a shared object, these relocations
are copied into the output file to be resolved at run
if (sreloc == NULL)
abort ();
- loc = (Elf64_External_Rela *) sreloc->contents;
- loc += sreloc->reloc_count++;
+ loc = sreloc->contents;
+ loc += sreloc->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
/* If this reloc is against an external symbol, we do
else
{
Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
int dr_type, indx;
if (htab->srelgot == NULL)
outrel.r_addend = relocation - dtpoff_base (info);
outrel.r_info = ELF64_R_INFO (indx, dr_type);
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
if (r_type == R_X86_64_TLSGD)
R_X86_64_DTPOFF64);
outrel.r_offset += GOT_ENTRY_SIZE;
htab->srelgot->reloc_count++;
- loc++;
- bfd_elf64_swap_reloca_out (output_bfd, &outrel,
- loc);
+ loc += sizeof (Elf64_External_Rela);
+ bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
}
}
else
{
Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
if (htab->srelgot == NULL)
abort ();
htab->sgot->contents + off + GOT_ENTRY_SIZE);
outrel.r_info = ELF64_R_INFO (0, R_X86_64_DTPMOD64);
outrel.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &outrel, loc);
htab->tls_ld_got.offset |= 1;
}
bfd_vma plt_index;
bfd_vma got_offset;
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the procedure linkage table. Set
it up. */
+ got_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_JUMP_SLOT);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelplt->contents + plt_index;
+ loc = htab->srelplt->contents + plt_index * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
&& elf64_x86_64_hash_entry (h)->tls_type != GOT_TLS_IE)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
rela.r_addend = 0;
}
- loc = (Elf64_External_Rela *) htab->srelgot->contents;
- loc += htab->srelgot->reloc_count++;
+ loc = htab->srelgot->contents;
+ loc += htab->srelgot->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
if ((h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_COPY) != 0)
{
Elf_Internal_Rela rela;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
+ h->root.u.def.section->output_offset);
rela.r_info = ELF64_R_INFO (h->dynindx, R_X86_64_COPY);
rela.r_addend = 0;
- loc = (Elf64_External_Rela *) htab->srelbss->contents;
- loc += htab->srelbss->reloc_count++;
+ loc = htab->srelbss->contents;
+ loc += htab->srelbss->reloc_count++ * sizeof (Elf64_External_Rela);
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
true); /* pcrel_offset */
static void elf32_arm_info_to_howto
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd * abfd ATTRIBUTE_UNUSED;
arelent * bfd_reloc;
- Elf32_Internal_Rel * elf_reloc;
+ Elf_Internal_Rela * elf_reloc;
{
unsigned int r_type;
#define ARM_ELF_OS_ABI_VERSION 0
static reloc_howto_type * find_howto PARAMS ((unsigned int));
-static void elf32_arm_info_to_howto PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+static void elf32_arm_info_to_howto PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static reloc_howto_type * elf32_arm_reloc_type_lookup PARAMS ((bfd *, bfd_reloc_code_real_type));
static reloc_howto_type elf32_arm_howto_table[] =
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- Elf32_Internal_Rela *elf_reloc;
+ Elf_Internal_Rela *elf_reloc;
{
unsigned int r_type;
}
/* Translate an ELF reloc from external format to internal format. */
-INLINE void
-elf_swap_reloc_in (abfd, src, dst)
+void
+elf_swap_reloc_in (abfd, s, dst)
bfd *abfd;
- const Elf_External_Rel *src;
- Elf_Internal_Rel *dst;
+ const bfd_byte *s;
+ Elf_Internal_Rela *dst;
{
+ const Elf_External_Rel *src = (const Elf_External_Rel *) s;
dst->r_offset = H_GET_WORD (abfd, src->r_offset);
dst->r_info = H_GET_WORD (abfd, src->r_info);
+ dst->r_addend = 0;
}
-INLINE void
-elf_swap_reloca_in (abfd, src, dst)
+void
+elf_swap_reloca_in (abfd, s, dst)
bfd *abfd;
- const Elf_External_Rela *src;
+ const bfd_byte *s;
Elf_Internal_Rela *dst;
{
+ const Elf_External_Rela *src = (const Elf_External_Rela *) s;
dst->r_offset = H_GET_WORD (abfd, src->r_offset);
dst->r_info = H_GET_WORD (abfd, src->r_info);
dst->r_addend = H_GET_SIGNED_WORD (abfd, src->r_addend);
}
/* Translate an ELF reloc from internal format to external format. */
-INLINE void
-elf_swap_reloc_out (abfd, src, dst)
+void
+elf_swap_reloc_out (abfd, src, d)
bfd *abfd;
- const Elf_Internal_Rel *src;
- Elf_External_Rel *dst;
+ const Elf_Internal_Rela *src;
+ bfd_byte *d;
{
+ Elf_External_Rel *dst = (Elf_External_Rel *) d;
H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
H_PUT_WORD (abfd, src->r_info, dst->r_info);
}
-INLINE void
-elf_swap_reloca_out (abfd, src, dst)
+void
+elf_swap_reloca_out (abfd, src, d)
bfd *abfd;
const Elf_Internal_Rela *src;
- Elf_External_Rela *dst;
+ bfd_byte *d;
{
+ Elf_External_Rela *dst = (Elf_External_Rela *) d;
H_PUT_WORD (abfd, src->r_offset, dst->r_offset);
H_PUT_WORD (abfd, src->r_info, dst->r_info);
H_PUT_SIGNED_WORD (abfd, src->r_addend, dst->r_addend);
{
boolean *failedp = (boolean *) data;
Elf_Internal_Shdr *rela_hdr;
- Elf_External_Rela *outbound_relocas;
- Elf_External_Rel *outbound_relocs;
+ bfd_vma addr_offset;
+ void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
+ size_t extsize;
+ bfd_byte *dst_rela;
unsigned int idx;
- int use_rela_p;
- asymbol *last_sym = 0;
- int last_sym_idx = 0;
+ asymbol *last_sym;
+ int last_sym_idx;
/* If we have already failed, don't do anything. */
if (*failedp)
/* Figure out whether the relocations are RELA or REL relocations. */
if (rela_hdr->sh_type == SHT_RELA)
- use_rela_p = true;
+ {
+ swap_out = elf_swap_reloca_out;
+ extsize = sizeof (Elf_External_Rela);
+ }
else if (rela_hdr->sh_type == SHT_REL)
- use_rela_p = false;
+ {
+ swap_out = elf_swap_reloc_out;
+ extsize = sizeof (Elf_External_Rel);
+ }
else
/* Every relocation section should be either an SHT_RELA or an
SHT_REL section. */
abort ();
+ /* The address of an ELF reloc is section relative for an object
+ file, and absolute for an executable file or shared library.
+ The address of a BFD reloc is always section relative. */
+ addr_offset = 0;
+ if ((abfd->flags & (EXEC_P | DYNAMIC)) != 0)
+ addr_offset = sec->vma;
+
/* orelocation has the data, reloc_count has the count... */
- if (use_rela_p)
- {
- outbound_relocas = (Elf_External_Rela *) rela_hdr->contents;
+ last_sym = 0;
+ last_sym_idx = 0;
+ dst_rela = rela_hdr->contents;
- for (idx = 0; idx < sec->reloc_count; idx++)
+ for (idx = 0; idx < sec->reloc_count; idx++, dst_rela += extsize)
+ {
+ Elf_Internal_Rela src_rela;
+ arelent *ptr;
+ asymbol *sym;
+ int n;
+
+ ptr = sec->orelocation[idx];
+ sym = *ptr->sym_ptr_ptr;
+ if (sym == last_sym)
+ n = last_sym_idx;
+ else if (bfd_is_abs_section (sym->section) && sym->value == 0)
+ n = STN_UNDEF;
+ else
{
- Elf_Internal_Rela dst_rela;
- Elf_External_Rela *src_rela;
- arelent *ptr;
- asymbol *sym;
- int n;
-
- ptr = sec->orelocation[idx];
- src_rela = outbound_relocas + idx;
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a BFD reloc is always section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- dst_rela.r_offset = ptr->address;
- else
- dst_rela.r_offset = ptr->address + sec->vma;
-
- sym = *ptr->sym_ptr_ptr;
- if (sym == last_sym)
- n = last_sym_idx;
- else if (bfd_is_abs_section (sym->section) && sym->value == 0)
- n = STN_UNDEF;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = true;
- return;
- }
- last_sym_idx = n;
- }
-
- if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
- && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
+ last_sym = sym;
+ n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
+ if (n < 0)
{
*failedp = true;
return;
}
-
- dst_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
-
- dst_rela.r_addend = ptr->addend;
- elf_swap_reloca_out (abfd, &dst_rela, src_rela);
+ last_sym_idx = n;
}
- }
- else
- /* REL relocations */
- {
- outbound_relocs = (Elf_External_Rel *) rela_hdr->contents;
- for (idx = 0; idx < sec->reloc_count; idx++)
+ if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
+ && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
+ && ! _bfd_elf_validate_reloc (abfd, ptr))
{
- Elf_Internal_Rel dst_rel;
- Elf_External_Rel *src_rel;
- arelent *ptr;
- int n;
- asymbol *sym;
-
- ptr = sec->orelocation[idx];
- sym = *ptr->sym_ptr_ptr;
- src_rel = outbound_relocs + idx;
-
- /* The address of an ELF reloc is section relative for an object
- file, and absolute for an executable file or shared library.
- The address of a BFD reloc is always section relative. */
- if ((abfd->flags & (EXEC_P | DYNAMIC)) == 0)
- dst_rel.r_offset = ptr->address;
- else
- dst_rel.r_offset = ptr->address + sec->vma;
-
- if (sym == last_sym)
- n = last_sym_idx;
- else if (bfd_is_abs_section (sym->section) && sym->value == 0)
- n = STN_UNDEF;
- else
- {
- last_sym = sym;
- n = _bfd_elf_symbol_from_bfd_symbol (abfd, &sym);
- if (n < 0)
- {
- *failedp = true;
- return;
- }
- last_sym_idx = n;
- }
-
- if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
- && (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
- && ! _bfd_elf_validate_reloc (abfd, ptr))
- {
- *failedp = true;
- return;
- }
-
- dst_rel.r_info = ELF_R_INFO (n, ptr->howto->type);
-
- elf_swap_reloc_out (abfd, &dst_rel, src_rel);
+ *failedp = true;
+ return;
}
+
+ src_rela.r_offset = ptr->address + addr_offset;
+ src_rela.r_info = ELF_R_INFO (n, ptr->howto->type);
+ src_rela.r_addend = ptr->addend;
+ (*swap_out) (abfd, &src_rela, dst_rela);
}
}
i++, relent++, native_relocs += entsize)
{
Elf_Internal_Rela rela;
- Elf_Internal_Rel rel;
if (entsize == sizeof (Elf_External_Rela))
- elf_swap_reloca_in (abfd, (Elf_External_Rela *) native_relocs, &rela);
+ elf_swap_reloca_in (abfd, native_relocs, &rela);
else
- {
- elf_swap_reloc_in (abfd, (Elf_External_Rel *) native_relocs, &rel);
- rela.r_offset = rel.r_offset;
- rela.r_info = rel.r_info;
- rela.r_addend = 0;
- }
+ elf_swap_reloc_in (abfd, native_relocs, &rela);
/* The address of an ELF reloc is section relative for an object
file, and absolute for an executable file or shared library.
if (entsize == sizeof (Elf_External_Rela))
(*ebd->elf_info_to_howto) (abfd, relent, &rela);
else
- (*ebd->elf_info_to_howto_rel) (abfd, relent, &rel);
+ (*ebd->elf_info_to_howto_rel) (abfd, relent, &rela);
}
if (allocated != NULL)
elf_slurp_symbol_table,
elf_swap_dyn_in,
elf_swap_dyn_out,
- NULL,
- NULL,
- NULL,
- NULL
+ elf_swap_reloc_in,
+ elf_swap_reloc_out,
+ elf_swap_reloca_in,
+ elf_swap_reloca_out
};
Elf_Internal_Rela *internal_relocs;
{
struct elf_backend_data *bed;
- bfd_size_type amt;
+ void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+ const bfd_byte *erela;
+ const bfd_byte *erelaend;
+ Elf_Internal_Rela *irela;
/* If there aren't any relocations, that's OK. */
if (!shdr)
/* Convert the external relocations to the internal format. */
if (shdr->sh_entsize == sizeof (Elf_External_Rel))
- {
- Elf_External_Rel *erel;
- Elf_External_Rel *erelend;
- Elf_Internal_Rela *irela;
- Elf_Internal_Rel *irel;
-
- erel = (Elf_External_Rel *) external_relocs;
- erelend = erel + NUM_SHDR_ENTRIES (shdr);
- irela = internal_relocs;
- amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
- irel = bfd_alloc (abfd, amt);
- for (; erel < erelend; erel++, irela += bed->s->int_rels_per_ext_rel)
- {
- unsigned int i;
-
- if (bed->s->swap_reloc_in)
- (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
- else
- elf_swap_reloc_in (abfd, erel, irel);
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; ++i)
- {
- irela[i].r_offset = irel[i].r_offset;
- irela[i].r_info = irel[i].r_info;
- irela[i].r_addend = 0;
- }
- }
- }
+ swap_in = bed->s->swap_reloc_in;
+ else if (shdr->sh_entsize == sizeof (Elf_External_Rela))
+ swap_in = bed->s->swap_reloca_in;
else
- {
- Elf_External_Rela *erela;
- Elf_External_Rela *erelaend;
- Elf_Internal_Rela *irela;
-
- BFD_ASSERT (shdr->sh_entsize == sizeof (Elf_External_Rela));
+ abort ();
- erela = (Elf_External_Rela *) external_relocs;
- erelaend = erela + NUM_SHDR_ENTRIES (shdr);
- irela = internal_relocs;
- for (; erela < erelaend; erela++, irela += bed->s->int_rels_per_ext_rel)
- {
- if (bed->s->swap_reloca_in)
- (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
- else
- elf_swap_reloca_in (abfd, erela, irela);
- }
+ erela = external_relocs;
+ erelaend = erela + NUM_SHDR_ENTRIES (shdr) * shdr->sh_entsize;
+ irela = internal_relocs;
+ while (erela < erelaend)
+ {
+ (*swap_in) (abfd, erela, irela);
+ irela += bed->s->int_rels_per_ext_rel;
+ erela += shdr->sh_entsize;
}
return true;
{
unsigned int i;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
- Elf_Internal_Rel *irel;
- Elf_Internal_Rela *irela;
- bfd_size_type amt = sizeof (Elf_Internal_Rel) * bed->s->int_rels_per_ext_rel;
+ bfd_byte *erela;
+ void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+ void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
- irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
- if (irel == NULL)
+ if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
{
- (*_bfd_error_handler) (_("Error: out of memory"));
- abort ();
+ swap_in = bed->s->swap_reloc_in;
+ swap_out = bed->s->swap_reloc_out;
}
-
- amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
- irela = (Elf_Internal_Rela *) bfd_zmalloc (amt);
- if (irela == NULL)
+ else if (rel_hdr->sh_entsize == sizeof (Elf_External_Rela))
{
- (*_bfd_error_handler) (_("Error: out of memory"));
- abort ();
+ swap_in = bed->s->swap_reloca_in;
+ swap_out = bed->s->swap_reloca_out;
}
+ else
+ abort ();
- for (i = 0; i < count; i++, rel_hash++)
+ if (bed->s->int_rels_per_ext_rel > MAX_INT_RELS_PER_EXT_REL)
+ abort ();
+
+ erela = rel_hdr->contents;
+ for (i = 0; i < count; i++, rel_hash++, erela += rel_hdr->sh_entsize)
{
+ Elf_Internal_Rela irela[MAX_INT_RELS_PER_EXT_REL];
+ unsigned int j;
+
if (*rel_hash == NULL)
continue;
BFD_ASSERT ((*rel_hash)->indx >= 0);
- if (rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
- {
- Elf_External_Rel *erel;
- unsigned int j;
-
- erel = (Elf_External_Rel *) rel_hdr->contents + i;
- if (bed->s->swap_reloc_in)
- (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel, irel);
- else
- elf_swap_reloc_in (abfd, erel, irel);
-
- for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
- irel[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
- ELF_R_TYPE (irel[j].r_info));
-
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (abfd, irel, (bfd_byte *) erel);
- else
- elf_swap_reloc_out (abfd, irel, erel);
- }
- else
- {
- Elf_External_Rela *erela;
- unsigned int j;
-
- BFD_ASSERT (rel_hdr->sh_entsize
- == sizeof (Elf_External_Rela));
-
- erela = (Elf_External_Rela *) rel_hdr->contents + i;
- if (bed->s->swap_reloca_in)
- (*bed->s->swap_reloca_in) (abfd, (bfd_byte *) erela, irela);
- else
- elf_swap_reloca_in (abfd, erela, irela);
-
- for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
- irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
- ELF_R_TYPE (irela[j].r_info));
-
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (abfd, irela, (bfd_byte *) erela);
- else
- elf_swap_reloca_out (abfd, irela, erela);
- }
+ (*swap_in) (abfd, erela, irela);
+ for (j = 0; j < bed->s->int_rels_per_ext_rel; j++)
+ irela[j].r_info = ELF_R_INFO ((*rel_hash)->indx,
+ ELF_R_TYPE (irela[j].r_info));
+ (*swap_out) (abfd, irela, erela);
}
-
- free (irel);
- free (irela);
}
struct elf_link_sort_rela
{
bfd_vma offset;
enum elf_reloc_type_class type;
- union
- {
- /* We use these as arrays of size int_rels_per_ext_rel. */
- Elf_Internal_Rel rel[1];
- Elf_Internal_Rela rela[1];
- } u;
+ /* We use this as an array of size int_rels_per_ext_rel. */
+ Elf_Internal_Rela rela[1];
};
static int
return 1;
if (relativea > relativeb)
return -1;
- if (ELF_R_SYM (a->u.rel->r_info) < ELF_R_SYM (b->u.rel->r_info))
+ if (ELF_R_SYM (a->rela->r_info) < ELF_R_SYM (b->rela->r_info))
return -1;
- if (ELF_R_SYM (a->u.rel->r_info) > ELF_R_SYM (b->u.rel->r_info))
+ if (ELF_R_SYM (a->rela->r_info) > ELF_R_SYM (b->rela->r_info))
return 1;
- if (a->u.rel->r_offset < b->u.rel->r_offset)
+ if (a->rela->r_offset < b->rela->r_offset)
return -1;
- if (a->u.rel->r_offset > b->u.rel->r_offset)
+ if (a->rela->r_offset > b->rela->r_offset)
return 1;
return 0;
}
return -1;
if (copya > copyb)
return 1;
- if (a->u.rel->r_offset < b->u.rel->r_offset)
+ if (a->rela->r_offset < b->rela->r_offset)
return -1;
- if (a->u.rel->r_offset > b->u.rel->r_offset)
+ if (a->rela->r_offset > b->rela->r_offset)
return 1;
return 0;
}
{
bfd *dynobj = elf_hash_table (info)->dynobj;
asection *reldyn, *o;
- boolean rel = false;
bfd_size_type count, size;
- size_t i, j, ret;
- struct elf_link_sort_rela *rela;
+ size_t i, ret, sort_elt, ext_size;
+ bfd_byte *sort, *s_non_relative, *p;
+ struct elf_link_sort_rela *sq;
struct elf_backend_data *bed = get_elf_backend_data (abfd);
int i2e = bed->s->int_rels_per_ext_rel;
+ void (*swap_in) PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
+ void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
reldyn = bfd_get_section_by_name (abfd, ".rela.dyn");
if (reldyn == NULL || reldyn->_raw_size == 0)
reldyn = bfd_get_section_by_name (abfd, ".rel.dyn");
if (reldyn == NULL || reldyn->_raw_size == 0)
return 0;
- rel = true;
- count = reldyn->_raw_size / sizeof (Elf_External_Rel);
+ ext_size = sizeof (Elf_External_Rel);
+ swap_in = bed->s->swap_reloc_in;
+ swap_out = bed->s->swap_reloc_out;
}
else
- count = reldyn->_raw_size / sizeof (Elf_External_Rela);
+ {
+ ext_size = sizeof (Elf_External_Rela);
+ swap_in = bed->s->swap_reloca_in;
+ swap_out = bed->s->swap_reloca_out;
+ }
+ count = reldyn->_raw_size / ext_size;
size = 0;
for (o = dynobj->sections; o != NULL; o = o->next)
if (size != reldyn->_raw_size)
return 0;
- /* We waste some memory here when N = i2e is greater than 1, since
- we allocate space for N * sizeof (*rela) where sizeof (*rela) +
- (N - 1) * sizeof (Elf_Internal_Rel/Rela) would do. Also, we use
- rela[k] only when k is a multiple of N, and then we index the
- array within the union, such that rela[k].u.rel[i], i < N, is the
- (i+1)th internal relocation corresponding to the (k/N)th external
- relocation. This is done such that the relocation swap-in and
- swap-out functions can gen pointers to arrays of internal
- relocations that form a single external relocation.
-
- If C permitted arrays of structures with dynamic sizes, we could
- do better, but trying to avoid wasting space at the end of the
- chunk from rela[k] to rela[k+N-1] would require us to allocate a
- separate array of pointers and since most ports have N == 1, this
- would be more wasteful. */
- rela = (struct elf_link_sort_rela *) bfd_zmalloc
- (sizeof (*rela) * count * i2e);
- if (rela == NULL)
+ sort_elt = (sizeof (struct elf_link_sort_rela)
+ + (i2e - 1) * sizeof (Elf_Internal_Rela));
+ sort = bfd_zmalloc (sort_elt * count);
+ if (sort == NULL)
{
(*info->callbacks->warning)
(info, _("Not enough memory to sort relocations"), 0, abfd, 0,
== (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
&& o->output_section == reldyn)
{
- if (rel)
- {
- Elf_External_Rel *erel, *erelend;
- struct elf_link_sort_rela *s;
+ bfd_byte *erel, *erelend;
- erel = (Elf_External_Rel *) o->contents;
- erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
- s = rela + (o->output_offset / sizeof (Elf_External_Rel) * i2e);
- for (; erel < erelend; erel++, s += i2e)
- {
- if (bed->s->swap_reloc_in)
- (*bed->s->swap_reloc_in) (abfd, (bfd_byte *) erel,
- s->u.rel);
- else
- elf_swap_reloc_in (abfd, erel, s->u.rel);
-
- s->type = (*bed->elf_backend_reloc_type_class) (s->u.rela);
- }
- }
- else
+ erel = o->contents;
+ erelend = o->contents + o->_raw_size;
+ p = sort + o->output_offset / ext_size * sort_elt;
+ while (erel < erelend)
{
- Elf_External_Rela *erela, *erelaend;
- struct elf_link_sort_rela *s;
-
- erela = (Elf_External_Rela *) o->contents;
- erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
- s = rela + (o->output_offset / sizeof (Elf_External_Rela) * i2e);
- for (; erela < erelaend; erela++, s += i2e)
- {
- if (bed->s->swap_reloca_in)
- (*bed->s->swap_reloca_in) (dynobj, (bfd_byte *) erela,
- s->u.rela);
- else
- elf_swap_reloca_in (dynobj, erela, s->u.rela);
-
- s->type = (*bed->elf_backend_reloc_type_class) (s->u.rela);
- }
+ struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+ (*swap_in) (abfd, erel, s->rela);
+ s->type = (*bed->elf_backend_reloc_type_class) (s->rela);
+ p += sort_elt;
+ erel += ext_size;
}
}
- qsort (rela, (size_t) count, sizeof (*rela) * i2e, elf_link_sort_cmp1);
- for (ret = 0; ret < count * i2e && rela[ret].type == reloc_class_relative;
- ret += i2e)
- ;
- for (i = ret, j = ret; i < count * i2e; i += i2e)
+ qsort (sort, (size_t) count, sort_elt, elf_link_sort_cmp1);
+
+ for (i = 0, p = sort; i < count; i++, p += sort_elt)
+ {
+ struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+ if (s->type != reloc_class_relative)
+ break;
+ }
+ ret = i;
+ s_non_relative = p;
+
+ sq = (struct elf_link_sort_rela *) s_non_relative;
+ for (; i < count; i++, p += sort_elt)
{
- 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;
+ struct elf_link_sort_rela *sp = (struct elf_link_sort_rela *) p;
+ if (ELF_R_SYM (sp->rela->r_info) != ELF_R_SYM (sq->rela->r_info))
+ sq = sp;
+ sp->offset = sq->rela->r_offset;
}
- ret /= i2e;
- qsort (rela + ret, (size_t) count - ret,
- sizeof (*rela) * i2e, elf_link_sort_cmp2);
+
+ qsort (s_non_relative, (size_t) count - ret, sort_elt, elf_link_sort_cmp2);
for (o = dynobj->sections; o != NULL; o = o->next)
if ((o->flags & (SEC_HAS_CONTENTS|SEC_LINKER_CREATED))
== (SEC_HAS_CONTENTS|SEC_LINKER_CREATED)
&& o->output_section == reldyn)
{
- if (rel)
- {
- Elf_External_Rel *erel, *erelend;
- struct elf_link_sort_rela *s;
+ bfd_byte *erel, *erelend;
- erel = (Elf_External_Rel *) o->contents;
- erelend = (Elf_External_Rel *) (o->contents + o->_raw_size);
- s = rela + (o->output_offset / sizeof (Elf_External_Rel) * i2e);
- for (; erel < erelend; erel++, s += i2e)
- {
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (abfd, s->u.rel,
- (bfd_byte *) erel);
- else
- elf_swap_reloc_out (abfd, s->u.rel, erel);
- }
- }
- else
+ erel = o->contents;
+ erelend = o->contents + o->_raw_size;
+ p = sort + o->output_offset / ext_size * sort_elt;
+ while (erel < erelend)
{
- Elf_External_Rela *erela, *erelaend;
- struct elf_link_sort_rela *s;
-
- erela = (Elf_External_Rela *) o->contents;
- erelaend = (Elf_External_Rela *) (o->contents + o->_raw_size);
- s = rela + (o->output_offset / sizeof (Elf_External_Rela) * i2e);
- for (; erela < erelaend; erela++, s += i2e)
- {
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (dynobj, s->u.rela,
- (bfd_byte *) erela);
- else
- elf_swap_reloca_out (dynobj, s->u.rela, erela);
- }
+ struct elf_link_sort_rela *s = (struct elf_link_sort_rela *) p;
+ (*swap_out) (abfd, s->rela, erel);
+ p += sort_elt;
+ erel += ext_size;
}
}
- free (rela);
*psec = reldyn;
return ret;
}
{
Elf_Internal_Rela *irela;
Elf_Internal_Rela *irelaend;
+ bfd_byte *erel;
Elf_Internal_Shdr *output_rel_hdr;
asection *output_section;
unsigned int *rel_countp = NULL;
struct elf_backend_data *bed;
- bfd_size_type amt;
+ void (*swap_out) PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
output_section = input_section->output_section;
output_rel_hdr = NULL;
}
bed = get_elf_backend_data (output_bfd);
+ if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
+ swap_out = bed->s->swap_reloc_out;
+ else if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela))
+ swap_out = bed->s->swap_reloca_out;
+ else
+ abort ();
+
+ erel = output_rel_hdr->contents;
+ erel += *rel_countp * input_rel_hdr->sh_entsize;
irela = internal_relocs;
irelaend = irela + (NUM_SHDR_ENTRIES (input_rel_hdr)
* bed->s->int_rels_per_ext_rel);
-
- if (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rel))
- {
- Elf_External_Rel *erel;
- Elf_Internal_Rel *irel;
-
- amt = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
- irel = (Elf_Internal_Rel *) bfd_zmalloc (amt);
- if (irel == NULL)
- {
- (*_bfd_error_handler) (_("Error: out of memory"));
- abort ();
- }
-
- erel = ((Elf_External_Rel *) output_rel_hdr->contents + *rel_countp);
- for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erel++)
- {
- unsigned int i;
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- {
- irel[i].r_offset = irela[i].r_offset;
- irel[i].r_info = irela[i].r_info;
- BFD_ASSERT (irela[i].r_addend == 0);
- }
-
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (output_bfd, irel, (PTR) erel);
- else
- elf_swap_reloc_out (output_bfd, irel, erel);
- }
-
- free (irel);
- }
- else
+ while (irela < irelaend)
{
- Elf_External_Rela *erela;
-
- BFD_ASSERT (input_rel_hdr->sh_entsize == sizeof (Elf_External_Rela));
-
- erela = ((Elf_External_Rela *) output_rel_hdr->contents + *rel_countp);
- for (; irela < irelaend; irela += bed->s->int_rels_per_ext_rel, erela++)
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (output_bfd, irela, (PTR) erela);
- else
- elf_swap_reloca_out (output_bfd, irela, erela);
+ (*swap_out) (output_bfd, irela, erel);
+ irela += bed->s->int_rels_per_ext_rel;
+ erel += input_rel_hdr->sh_entsize;
}
/* Bump the counter, so that we know where to add the next set of
struct elf_link_hash_entry **rel_hash_ptr;
Elf_Internal_Shdr *rel_hdr;
struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
+ Elf_Internal_Rela irel[MAX_INT_RELS_PER_EXT_REL];
+ bfd_byte *erel;
+ unsigned int i;
howto = bfd_reloc_type_lookup (output_bfd, link_order->u.reloc.p->reloc);
if (howto == NULL)
if (! info->relocateable)
offset += output_section->vma;
- rel_hdr = &elf_section_data (output_section)->rel_hdr;
+ for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
+ {
+ irel[i].r_offset = offset;
+ irel[i].r_info = 0;
+ irel[i].r_addend = 0;
+ }
+ irel[0].r_info = ELF_R_INFO (indx, howto->type);
+ rel_hdr = &elf_section_data (output_section)->rel_hdr;
+ erel = rel_hdr->contents;
if (rel_hdr->sh_type == SHT_REL)
{
- bfd_size_type size;
- Elf_Internal_Rel *irel;
- Elf_External_Rel *erel;
- unsigned int i;
-
- size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rel);
- irel = (Elf_Internal_Rel *) bfd_zmalloc (size);
- if (irel == NULL)
- return false;
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- irel[i].r_offset = offset;
- irel[0].r_info = ELF_R_INFO (indx, howto->type);
-
- erel = ((Elf_External_Rel *) rel_hdr->contents
- + elf_section_data (output_section)->rel_count);
-
- if (bed->s->swap_reloc_out)
- (*bed->s->swap_reloc_out) (output_bfd, irel, (bfd_byte *) erel);
- else
- elf_swap_reloc_out (output_bfd, irel, erel);
-
- free (irel);
+ erel += (elf_section_data (output_section)->rel_count
+ * sizeof (Elf_External_Rel));
+ (*bed->s->swap_reloc_out) (output_bfd, irel, erel);
}
else
{
- bfd_size_type size;
- Elf_Internal_Rela *irela;
- Elf_External_Rela *erela;
- unsigned int i;
-
- size = bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
- irela = (Elf_Internal_Rela *) bfd_zmalloc (size);
- if (irela == NULL)
- return false;
-
- for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- irela[i].r_offset = offset;
- irela[0].r_info = ELF_R_INFO (indx, howto->type);
- irela[0].r_addend = addend;
-
- erela = ((Elf_External_Rela *) rel_hdr->contents
- + elf_section_data (output_section)->rel_count);
-
- if (bed->s->swap_reloca_out)
- (*bed->s->swap_reloca_out) (output_bfd, irela, (bfd_byte *) erela);
- else
- elf_swap_reloca_out (output_bfd, irela, erela);
+ irel[0].r_addend = addend;
+ erel += (elf_section_data (output_section)->rel_count
+ * sizeof (Elf_External_Rela));
+ (*bed->s->swap_reloca_out) (output_bfd, irel, erel);
}
++elf_section_data (output_section)->rel_count;
if (info->shared)
{
asection *srel = lsect->rel_section;
- Elf_Internal_Rela *outrel;
- Elf_External_Rela *erel;
+ Elf_Internal_Rela outrel[MAX_INT_RELS_PER_EXT_REL];
+ bfd_byte *erel;
struct elf_backend_data *bed = get_elf_backend_data (output_bfd);
unsigned int i;
- bfd_size_type amt;
-
- amt = sizeof (Elf_Internal_Rela) * bed->s->int_rels_per_ext_rel;
- outrel = (Elf_Internal_Rela *) bfd_zmalloc (amt);
- if (outrel == NULL)
- {
- (*_bfd_error_handler) (_("Error: out of memory"));
- return 0;
- }
/* We need to generate a relative reloc for the dynamic
linker. */
BFD_ASSERT (srel != NULL);
for (i = 0; i < bed->s->int_rels_per_ext_rel; i++)
- outrel[i].r_offset = (lsect->section->output_section->vma
- + lsect->section->output_offset
- + linker_section_ptr->offset);
+ {
+ outrel[i].r_offset = (lsect->section->output_section->vma
+ + lsect->section->output_offset
+ + linker_section_ptr->offset);
+ outrel[i].r_info = 0;
+ outrel[i].r_addend = 0;
+ }
outrel[0].r_info = ELF_R_INFO (0, relative_reloc);
- outrel[0].r_addend = 0;
- erel = (Elf_External_Rela *) lsect->section->contents;
- erel += elf_section_data (lsect->section)->rel_count;
+ erel = lsect->section->contents;
+ erel += (elf_section_data (lsect->section)->rel_count++
+ * sizeof (Elf_External_Rela));
elf_swap_reloca_out (output_bfd, outrel, erel);
- ++elf_section_data (lsect->section)->rel_count;
-
- free (outrel);
}
}
}
static reloc_howto_type *mips_elf_n32_rtype_to_howto
PARAMS ((unsigned int, boolean));
static void mips_info_to_howto_rel
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static void mips_info_to_howto_rela
- PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
+ PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static boolean mips_elf_sym_is_global PARAMS ((bfd *, asymbol *));
static boolean mips_elf_n32_object_p PARAMS ((bfd *));
static boolean elf32_mips_grok_prstatus
}
}
-/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */
+/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static reloc_howto_type *
mips_elf_n32_rtype_to_howto (r_type, rela_p)
}
}
-/* Given a MIPS Elf32_Internal_Rel, fill in an arelent structure. */
+/* Given a MIPS Elf_Internal_Rel, fill in an arelent structure. */
static void
mips_info_to_howto_rel (abfd, cache_ptr, dst)
bfd *abfd;
arelent *cache_ptr;
- Elf32_Internal_Rel *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
cache_ptr->addend = elf_gp (abfd);
}
-/* Given a MIPS Elf32_Internal_Rela, fill in an arelent structure. */
+/* Given a MIPS Elf_Internal_Rela, fill in an arelent structure. */
static void
mips_info_to_howto_rela (abfd, cache_ptr, dst)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
- Elf32_Internal_Rela *dst;
+ Elf_Internal_Rela *dst;
{
unsigned int r_type;
static reloc_howto_type *elfNN_ia64_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type bfd_code));
static void elfNN_ia64_info_to_howto
- PARAMS ((bfd *abfd, arelent *bfd_reloc, ElfNN_Internal_Rela *elf_reloc));
+ PARAMS ((bfd *abfd, arelent *bfd_reloc, Elf_Internal_Rela *elf_reloc));
static boolean elfNN_ia64_relax_section
PARAMS((bfd *abfd, asection *sec, struct bfd_link_info *link_info,
boolean *again));
static boolean is_unwind_section_name
PARAMS ((bfd *abfd, const char *));
static boolean elfNN_ia64_section_from_shdr
- PARAMS ((bfd *, ElfNN_Internal_Shdr *, const char *));
+ PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
static boolean elfNN_ia64_section_flags
- PARAMS ((flagword *, ElfNN_Internal_Shdr *));
+ PARAMS ((flagword *, Elf_Internal_Shdr *));
static boolean elfNN_ia64_fake_sections
- PARAMS ((bfd *abfd, ElfNN_Internal_Shdr *hdr, asection *sec));
+ PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, asection *sec));
static void elfNN_ia64_final_write_processing
PARAMS ((bfd *abfd, boolean linker));
static boolean elfNN_ia64_add_symbol_hook
elfNN_ia64_info_to_howto (abfd, bfd_reloc, elf_reloc)
bfd *abfd ATTRIBUTE_UNUSED;
arelent *bfd_reloc;
- ElfNN_Internal_Rela *elf_reloc;
+ Elf_Internal_Rela *elf_reloc;
{
bfd_reloc->howto
= lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info));
static boolean
elfNN_ia64_section_from_shdr (abfd, hdr, name)
bfd *abfd;
- ElfNN_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
const char *name;
{
asection *newsect;
static boolean
elfNN_ia64_section_flags (flags, hdr)
flagword *flags;
- ElfNN_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
{
if (hdr->sh_flags & SHF_IA_64_SHORT)
*flags |= SEC_SMALL_DATA;
static boolean
elfNN_ia64_fake_sections (abfd, hdr, sec)
bfd *abfd ATTRIBUTE_UNUSED;
- ElfNN_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
asection *sec;
{
register const char *name;
bfd_vma addend;
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
BFD_ASSERT (dynindx != -1);
outrel.r_info = ELFNN_R_INFO (dynindx, type);
else
outrel.r_offset += sec->output_section->vma + sec->output_offset;
- bfd_elfNN_swap_reloca_out (abfd, &outrel,
- ((ElfNN_External_Rela *) srel->contents
- + srel->reloc_count++));
+ loc = srel->contents;
+ loc += srel->reloc_count++ * sizeof (ElfNN_External_Rela);
+ bfd_elfNN_swap_reloca_out (abfd, &outrel, loc);
BFD_ASSERT (sizeof (ElfNN_External_Rela) * srel->reloc_count
<= srel->_cooked_size);
}
bfd_byte *loc;
asection *plt_sec;
bfd_vma plt_addr, pltoff_addr, gp_val, index;
- ElfNN_External_Rela *rel;
gp_val = _bfd_get_gp_value (output_bfd);
existing sec->reloc_count to be the base of the array of
PLT relocations. */
- rel = (ElfNN_External_Rela *)ia64_info->rel_pltoff_sec->contents;
- rel += ia64_info->rel_pltoff_sec->reloc_count;
-
- bfd_elfNN_swap_reloca_out (output_bfd, &outrel, rel + index);
+ loc = ia64_info->rel_pltoff_sec->contents;
+ loc += ((ia64_info->rel_pltoff_sec->reloc_count + index)
+ * sizeof (Elf64_External_Rela));
+ bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc);
}
/* Mark some specially defined symbols as absolute. */
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_Rela int_reloc1;
+ Elf_Internal_Rela int_reloc2;
- Elf_Internal_Rel int_reloc1;
- Elf_Internal_Rel int_reloc2;
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg1, &int_reloc1);
+ bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg2, &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));
+ return ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info);
}
/* This routine is used to write out ECOFF debugging external symbol
bfd_vma *addendp;
asection *input_section;
{
- Elf_Internal_Rel outrel[3];
+ Elf_Internal_Rela outrel[3];
boolean skip;
asection *sreloc;
bfd *dynobj;
record. Note that R_MIPS_NONE == 0, so that this call to memset
is a way of setting R_TYPE to R_MIPS_NONE. */
if (skip)
- memset (outrel, 0, sizeof (Elf_Internal_Rel) * 3);
+ memset (outrel, 0, sizeof (Elf_Internal_Rela) * 3);
else
{
long indx;
+ sreloc->reloc_count * sizeof (Elf64_Mips_External_Rel)));
}
else
- bfd_elf32_swap_reloc_out (output_bfd, &outrel[0],
- (((Elf32_External_Rel *)
- sreloc->contents)
- + sreloc->reloc_count));
+ bfd_elf32_swap_reloc_out
+ (output_bfd, &outrel[0],
+ (sreloc->contents + sreloc->reloc_count * sizeof (Elf32_External_Rel)));
/* Record the index of the first relocation referencing H. This
information is later emitted in the .msym section. */
boolean
_bfd_mips_elf_fake_sections (abfd, hdr, sec)
bfd *abfd;
- Elf32_Internal_Shdr *hdr;
+ Elf_Internal_Shdr *hdr;
asection *sec;
{
register const char *name;
+2002-11-28 Alan Modra <amodra@bigpond.net.au>
+
+ * internal.h (elf32_internal_ehdr, Elf32_Internal_Ehdr,
+ elf64_internal_ehdr, Elf64_Internal_Ehdr, elf32_internal_phdr,
+ Elf32_Internal_Phdr, elf64_internal_phdr, Elf64_Internal_Phdr,
+ elf32_internal_shdr, Elf32_Internal_Shdr, elf64_internal_shdr,
+ Elf64_Internal_Shdr, elf32_internal_sym, elf64_internal_sym,
+ Elf32_Internal_Sym, Elf64_Internal_Sym, Elf32_Internal_Note,
+ elf32_internal_note, elf32_internal_rel, Elf32_Internal_Rel,
+ elf64_internal_rel, Elf64_Internal_Rel, elf32_internal_rela,
+ elf64_internal_rela, Elf32_Internal_Rela, Elf64_Internal_Rela,
+ elf32_internal_dyn, elf64_internal_dyn, Elf32_Internal_Dyn,
+ Elf64_Internal_Dyn, elf32_internal_verdef, elf64_internal_verdef,
+ elf32_internal_verdaux, elf64_internal_verdaux, elf32_internal_verneed,
+ elf64_internal_verneed, elf32_internal_vernaux, elf64_internal_vernaux,
+ elf32_internal_versym, elf64_internal_versym, Elf32_Internal_Verdef,
+ Elf64_Internal_Verdef, Elf32_Internal_Verdaux, Elf64_Internal_Verdaux,
+ Elf32_Internal_Verneed, Elf64_Internal_Verneed, Elf32_Internal_Vernaux,
+ Elf64_Internal_Vernaux, Elf32_Internal_Versym, Elf64_Internal_Versym,
+ Elf32_Internal_Syminfo, Elf64_Internal_Syminfo): Delete.
+ (Elf_Internal_Rel): Delete.
+
2002-10-11 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sh.h: Add SH TLS relocs.
/* ELF support for BFD.
- Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001
+ Copyright 1991, 1992, 1993, 1994, 1995, 1997, 1998, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published
unsigned int e_shstrndx; /* Section header string table index */
} Elf_Internal_Ehdr;
-#define elf32_internal_ehdr elf_internal_ehdr
-#define Elf32_Internal_Ehdr Elf_Internal_Ehdr
-#define elf64_internal_ehdr elf_internal_ehdr
-#define Elf64_Internal_Ehdr Elf_Internal_Ehdr
-
/* Program header */
struct elf_internal_phdr {
};
typedef struct elf_internal_phdr Elf_Internal_Phdr;
-#define elf32_internal_phdr elf_internal_phdr
-#define Elf32_Internal_Phdr Elf_Internal_Phdr
-#define elf64_internal_phdr elf_internal_phdr
-#define Elf64_Internal_Phdr Elf_Internal_Phdr
/* Section header */
unsigned char *contents; /* Section contents. */
} Elf_Internal_Shdr;
-#define elf32_internal_shdr elf_internal_shdr
-#define Elf32_Internal_Shdr Elf_Internal_Shdr
-#define elf64_internal_shdr elf_internal_shdr
-#define Elf64_Internal_Shdr Elf_Internal_Shdr
-
/* Symbol table entry */
struct elf_internal_sym {
typedef struct elf_internal_sym Elf_Internal_Sym;
-#define elf32_internal_sym elf_internal_sym
-#define elf64_internal_sym elf_internal_sym
-#define Elf32_Internal_Sym Elf_Internal_Sym
-#define Elf64_Internal_Sym Elf_Internal_Sym
-
/* Note segments */
typedef struct elf_internal_note {
char * descdata; /* Start of the desc data */
bfd_vma descpos; /* File offset of the descdata */
} Elf_Internal_Note;
-#define Elf32_Internal_Note Elf_Internal_Note
-#define elf32_internal_note elf_internal_note
/* Relocation Entries */
-typedef struct elf_internal_rel {
- bfd_vma r_offset; /* Location at which to apply the action */
- /* This needs to support 64-bit values in elf64. */
- bfd_vma r_info; /* index and type of relocation */
-} Elf_Internal_Rel;
-
-#define elf32_internal_rel elf_internal_rel
-#define Elf32_Internal_Rel Elf_Internal_Rel
-#define elf64_internal_rel elf_internal_rel
-#define Elf64_Internal_Rel Elf_Internal_Rel
-
typedef struct elf_internal_rela {
bfd_vma r_offset; /* Location at which to apply the action */
bfd_vma r_info; /* Index and Type of relocation */
bfd_vma r_addend; /* Constant addend used to compute value */
} Elf_Internal_Rela;
-#define elf32_internal_rela elf_internal_rela
-#define elf64_internal_rela elf_internal_rela
-#define Elf32_Internal_Rela Elf_Internal_Rela
-#define Elf64_Internal_Rela Elf_Internal_Rela
-
/* dynamic section structure */
typedef struct elf_internal_dyn {
} d_un;
} Elf_Internal_Dyn;
-#define elf32_internal_dyn elf_internal_dyn
-#define elf64_internal_dyn elf_internal_dyn
-#define Elf32_Internal_Dyn Elf_Internal_Dyn
-#define Elf64_Internal_Dyn Elf_Internal_Dyn
-
/* This structure appears in a SHT_GNU_verdef section. */
typedef struct elf_internal_verdef {
} Elf_Internal_Syminfo;
-#define elf32_internal_verdef elf_internal_verdef
-#define elf64_internal_verdef elf_internal_verdef
-#define elf32_internal_verdaux elf_internal_verdaux
-#define elf64_internal_verdaux elf_internal_verdaux
-#define elf32_internal_verneed elf_internal_verneed
-#define elf64_internal_verneed elf_internal_verneed
-#define elf32_internal_vernaux elf_internal_vernaux
-#define elf64_internal_vernaux elf_internal_vernaux
-#define elf32_internal_versym elf_internal_versym
-#define elf64_internal_versym elf_internal_versym
-
-#define Elf32_Internal_Verdef Elf_Internal_Verdef
-#define Elf64_Internal_Verdef Elf_Internal_Verdef
-#define Elf32_Internal_Verdaux Elf_Internal_Verdaux
-#define Elf64_Internal_Verdaux Elf_Internal_Verdaux
-#define Elf32_Internal_Verneed Elf_Internal_Verneed
-#define Elf64_Internal_Verneed Elf_Internal_Verneed
-#define Elf32_Internal_Vernaux Elf_Internal_Vernaux
-#define Elf64_Internal_Vernaux Elf_Internal_Vernaux
-#define Elf32_Internal_Versym Elf_Internal_Versym
-#define Elf64_Internal_Versym Elf_Internal_Versym
-#define Elf32_Internal_Syminfo Elf_Internal_Syminfo
-#define Elf64_Internal_Syminfo Elf_Internal_Syminfo
-
/* This structure is used to describe how sections should be assigned
to program segments. */