aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog62
-rw-r--r--bfd/elf-bfd.h64
-rw-r--r--bfd/elf-hppa.h10
-rw-r--r--bfd/elf-m10200.c4
-rw-r--r--bfd/elf-m10300.c4
-rw-r--r--bfd/elf.c11
-rw-r--r--bfd/elf32-arc.c4
-rw-r--r--bfd/elf32-arm.h53
-rw-r--r--bfd/elf32-avr.c4
-rw-r--r--bfd/elf32-cris.c49
-rw-r--r--bfd/elf32-d10v.c4
-rw-r--r--bfd/elf32-d30v.c8
-rw-r--r--bfd/elf32-dlx.c8
-rw-r--r--bfd/elf32-fr30.c4
-rw-r--r--bfd/elf32-frv.c4
-rw-r--r--bfd/elf32-gen.c8
-rw-r--r--bfd/elf32-h8300.c6
-rw-r--r--bfd/elf32-hppa.c38
-rw-r--r--bfd/elf32-i370.c21
-rw-r--r--bfd/elf32-i386.c99
-rw-r--r--bfd/elf32-i860.c4
-rw-r--r--bfd/elf32-i960.c8
-rw-r--r--bfd/elf32-ip2k.c12
-rw-r--r--bfd/elf32-m32r.c4
-rw-r--r--bfd/elf32-m68hc11.c4
-rw-r--r--bfd/elf32-m68hc12.c4
-rw-r--r--bfd/elf32-m68k.c47
-rw-r--r--bfd/elf32-mcore.c4
-rw-r--r--bfd/elf32-mips.c21
-rw-r--r--bfd/elf32-openrisc.c4
-rw-r--r--bfd/elf32-or32.c4
-rw-r--r--bfd/elf32-ppc.c51
-rw-r--r--bfd/elf32-s390.c28
-rw-r--r--bfd/elf32-sh.c91
-rw-r--r--bfd/elf32-v850.c24
-rw-r--r--bfd/elf32-vax.c32
-rw-r--r--bfd/elf32-xstormy16.c4
-rw-r--r--bfd/elf64-alpha.c74
-rw-r--r--bfd/elf64-gen.c8
-rw-r--r--bfd/elf64-hppa.c55
-rw-r--r--bfd/elf64-mips.c53
-rw-r--r--bfd/elf64-mmix.c4
-rw-r--r--bfd/elf64-ppc.c44
-rw-r--r--bfd/elf64-s390.c404
-rw-r--r--bfd/elf64-sh64.c46
-rw-r--r--bfd/elf64-sparc.c64
-rw-r--r--bfd/elf64-x86-64.c55
-rw-r--r--bfd/elfarm-nabi.c4
-rw-r--r--bfd/elfarm-oabi.c4
-rw-r--r--bfd/elfcode.h209
-rw-r--r--bfd/elflink.h482
-rw-r--r--bfd/elfn32-mips.c14
-rw-r--r--bfd/elfxx-ia64.c32
-rw-r--r--bfd/elfxx-mips.c26
-rw-r--r--include/elf/ChangeLog22
-rw-r--r--include/elf/internal.h68
56 files changed, 1099 insertions, 1380 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f0b8dc6..1b34937 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,65 @@
+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
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 2fae2b4..18cf8cb 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -424,6 +424,9 @@ struct elf_size_info {
/* 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;
@@ -446,30 +449,25 @@ struct elf_size_info {
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) \
@@ -523,7 +521,7 @@ struct elf_backend_data
/* 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.
@@ -566,28 +564,28 @@ struct elf_backend_data
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
@@ -1486,21 +1484,21 @@ extern elf_linker_section_pointers_t *_bfd_elf_find_pointer_linker_section
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));
@@ -1526,13 +1524,13 @@ extern void bfd_elf32_swap_symbol_in
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
@@ -1578,13 +1576,13 @@ extern void bfd_elf64_swap_symbol_in
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
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index 263e9ac..5615cf5 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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
@@ -38,7 +37,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#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
@@ -50,7 +48,7 @@ static void elf_hppa_info_to_howto
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));
@@ -59,7 +57,7 @@ static boolean elf_hppa_is_local_label_name
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));
@@ -937,7 +935,7 @@ static void
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);
@@ -978,7 +976,7 @@ elf_hppa_is_local_label_name (abfd, name)
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;
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 37b832a..a97010e 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
@@ -213,7 +213,7 @@ static void
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;
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 374e55e..4497ef2 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -117,7 +117,7 @@ static void elf32_mn10300_link_hash_table_free
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 *));
@@ -322,7 +322,7 @@ static void
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;
diff --git a/bfd/elf.c b/bfd/elf.c
index 46c2c9e..341f3ae 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -6081,17 +6081,6 @@ _bfd_elf_no_info_to_howto (abfd, cache_ptr, dst)
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
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index fad1a1e..c9428ac 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -29,7 +29,7 @@
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
@@ -142,7 +142,7 @@ static void
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;
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index d0e7085..3c8adcd 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -1128,7 +1128,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
|| (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)
@@ -1192,11 +1193,9 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
}
}
- 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
@@ -1657,7 +1656,8 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
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);
@@ -1666,11 +1666,9 @@ elf32_arm_final_link_relocate (howto, input_bfd, output_bfd,
+ 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;
@@ -1863,12 +1861,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
|| 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
@@ -3321,7 +3314,8 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -3371,9 +3365,8 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
{
@@ -3394,7 +3387,8 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
{
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. */
@@ -3420,16 +3414,15 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -3444,10 +3437,8 @@ elf32_arm_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. */
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index 42683682..b2c6335 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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 *));
@@ -386,7 +386,7 @@ static void
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;
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index dfbdbe7..8db1115 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -31,7 +31,7 @@ static reloc_howto_type * cris_reloc_type_lookup
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));
@@ -458,7 +458,7 @@ static void
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;
@@ -1079,22 +1079,21 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -1237,6 +1236,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
& ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
@@ -1345,11 +1345,9 @@ cris_elf_relocate_section (output_bfd, info, 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_CRIS_32 relocations
@@ -1437,6 +1435,7 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -1517,9 +1516,8 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
@@ -1554,6 +1552,7 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -1587,16 +1586,16 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -1613,10 +1612,8 @@ elf_cris_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. */
diff --git a/bfd/elf32-d10v.c b/bfd/elf32-d10v.c
index fe31b92..43bd61d 100644
--- a/bfd/elf32-d10v.c
+++ b/bfd/elf32-d10v.c
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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 *));
@@ -230,7 +230,7 @@ static void
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;
diff --git a/bfd/elf32-d30v.c b/bfd/elf32-d30v.c
index f2f3946..8f281c6 100644
--- a/bfd/elf32-d30v.c
+++ b/bfd/elf32-d30v.c
@@ -28,9 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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,
@@ -522,7 +522,7 @@ static void
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;
@@ -537,7 +537,7 @@ static void
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;
diff --git a/bfd/elf32-dlx.c b/bfd/elf32-dlx.c
index 91d75f3..64dd04e 100644
--- a/bfd/elf32-dlx.c
+++ b/bfd/elf32-dlx.c
@@ -28,9 +28,9 @@ int set_dlx_skip_hi16_flag PARAMS ((int));
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
@@ -632,7 +632,7 @@ static void
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 ();
}
@@ -641,7 +641,7 @@ static void
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;
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index 07453cf..ec219cd 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -31,7 +31,7 @@ static bfd_reloc_status_type fr30_elf_i32_reloc
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 **));
@@ -377,7 +377,7 @@ static void
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;
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index c818795..4cacf36 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -41,7 +41,7 @@ static bfd_reloc_status_type elf32_frv_relocate_gprelhi
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
@@ -581,7 +581,7 @@ static void
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;
diff --git a/bfd/elf32-gen.c b/bfd/elf32-gen.c
index 58b5fc6..c5d192d 100644
--- a/bfd/elf32-gen.c
+++ b/bfd/elf32-gen.c
@@ -41,9 +41,9 @@ static reloc_howto_type dummy =
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 *));
@@ -51,7 +51,7 @@ static void
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;
}
@@ -60,7 +60,7 @@ static void
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;
}
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 9cb900b..4f9c3cf 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -29,7 +29,7 @@ static reloc_howto_type *elf32_h8_reloc_type_lookup
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
@@ -261,7 +261,7 @@ static void
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;
@@ -280,7 +280,7 @@ static void
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;
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 35e6f32..6df3803 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3774,16 +3774,16 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -3864,16 +3864,16 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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
@@ -3958,7 +3958,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -4027,8 +4027,8 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -4126,7 +4126,7 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -4145,8 +4145,8 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
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);
}
@@ -4171,7 +4171,7 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -4204,8 +4204,8 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
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);
}
@@ -4213,7 +4213,7 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
{
asection *s;
Elf_Internal_Rela rel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
@@ -4229,7 +4229,7 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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);
}
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index d047f01..f9a94a1 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -231,7 +231,7 @@ static reloc_howto_type *i370_elf_reloc_type_lookup
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));
/* Initialize the i370_elf_howto_table, so that linear accesses can be done. */
@@ -292,10 +292,10 @@ static boolean i370_elf_create_dynamic_sections PARAMS ((bfd *,
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
@@ -328,7 +328,7 @@ static void
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 ();
@@ -402,7 +402,7 @@ i370_elf_merge_private_bfd_data (ibfd, obfd)
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;
@@ -432,7 +432,7 @@ i370_elf_section_from_shdr (abfd, hdr, name)
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)
@@ -1388,6 +1388,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
&& r_symndx != 0)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
int skip;
#ifdef DEBUG
@@ -1493,11 +1494,9 @@ i370_elf_relocate_section (output_bfd, info, 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, unless this is a RELATIVE
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index ed601a7..d949128 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -27,9 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
@@ -70,7 +70,7 @@ static boolean allocate_dynrelocs
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
@@ -374,9 +374,9 @@ elf_i386_reloc_type_lookup (abfd, code)
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 ();
}
@@ -385,7 +385,7 @@ static void
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;
@@ -1995,7 +1995,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
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;
@@ -2340,20 +2340,20 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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);
}
@@ -2436,10 +2436,10 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
|| 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
@@ -2479,8 +2479,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -2495,9 +2495,9 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -2506,8 +2506,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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 */
@@ -2726,8 +2726,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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)
@@ -2753,8 +2753,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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)
@@ -2774,9 +2774,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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)
@@ -2787,7 +2786,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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);
}
@@ -2906,8 +2905,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
off &= ~1;
else
{
- Elf_Internal_Rel outrel;
- Elf32_External_Rel *loc;
+ Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (htab->srelgot == NULL)
abort ();
@@ -2920,8 +2919,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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;
}
@@ -2941,9 +2940,9 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -2960,8 +2959,8 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -3057,8 +3056,8 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
{
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. */
@@ -3117,7 +3116,7 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
@@ -3135,8 +3134,8 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
&& 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. */
@@ -3170,15 +3169,15 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -3192,8 +3191,8 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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);
}
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index f8ab971..8069ec3 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -34,7 +34,7 @@ static reloc_howto_type *elf32_i860_reloc_type_lookup
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));
@@ -694,7 +694,7 @@ static void
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));
diff --git a/bfd/elf32-i960.c b/bfd/elf32-i960.c
index fcaea20..0655d94 100644
--- a/bfd/elf32-i960.c
+++ b/bfd/elf32-i960.c
@@ -28,9 +28,9 @@ static bfd_reloc_status_type elf32_i960_relocate
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
@@ -77,7 +77,7 @@ static void
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 ();
}
@@ -86,7 +86,7 @@ static void
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;
diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index 67da85c..9181982 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -35,10 +35,10 @@ struct misc
/* 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));
@@ -256,7 +256,7 @@ static bfd_vma
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)
@@ -1164,7 +1164,7 @@ adjust_all_relocations (abfd, sec, addr, endaddr, count, noadj)
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);
@@ -1265,7 +1265,7 @@ add_page_insn (abfd, sec, irel, misc)
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)
@@ -1360,7 +1360,7 @@ static void
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;
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 7a7d500..d395f1c 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -43,7 +43,7 @@ static bfd_reloc_status_type m32r_elf_sda16_reloc
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
@@ -756,7 +756,7 @@ static void
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;
diff --git a/bfd/elf32-m68hc11.c b/bfd/elf32-m68hc11.c
index 9f05a9e..8366024 100644
--- a/bfd/elf32-m68hc11.c
+++ b/bfd/elf32-m68hc11.c
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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 **));
@@ -392,7 +392,7 @@ static void
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;
diff --git a/bfd/elf32-m68hc12.c b/bfd/elf32-m68hc12.c
index ea12e3b..44a2847 100644
--- a/bfd/elf32-m68hc12.c
+++ b/bfd/elf32-m68hc12.c
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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 **));
@@ -579,7 +579,7 @@ static void
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;
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 2c50ed08..a8b5c6e 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
@@ -1503,22 +1503,21 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -1609,6 +1608,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
& ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
@@ -1703,11 +1703,9 @@ elf_m68k_relocate_section (output_bfd, info, 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_68K_32
@@ -1791,6 +1789,7 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -1863,9 +1862,8 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
{
@@ -1880,6 +1878,7 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -1914,16 +1913,16 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -1940,10 +1939,8 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. */
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index 789f725..1cd7791 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -36,7 +36,7 @@ static void mcore_elf_howto_init
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
@@ -275,7 +275,7 @@ static void
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 ();
diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c
index f166732..875e316 100644
--- a/bfd/elf32-mips.c
+++ b/bfd/elf32-mips.c
@@ -62,9 +62,9 @@ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
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
@@ -1464,7 +1464,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
}
}
-/* 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)
@@ -1497,13 +1497,13 @@ 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;
@@ -1520,21 +1520,18 @@ mips_info_to_howto_rel (abfd, cache_ptr, dst)
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. */
}
/* Determine whether a symbol is global for the purposes of splitting
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index 7092110..156b24f 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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 **));
@@ -246,7 +246,7 @@ static void
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;
diff --git a/bfd/elf32-or32.c b/bfd/elf32-or32.c
index 39219e9..a5214ad 100644
--- a/bfd/elf32-or32.c
+++ b/bfd/elf32-or32.c
@@ -26,7 +26,7 @@
#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 **));
@@ -221,7 +221,7 @@ static void
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;
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 243ff14..fbc880d 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -36,7 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
@@ -56,10 +56,10 @@ static boolean ppc_elf_create_dynamic_sections
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,
@@ -1333,7 +1333,7 @@ static void
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. */
@@ -1511,7 +1511,7 @@ ppc_elf_merge_private_bfd_data (ibfd, obfd)
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;
@@ -1537,7 +1537,7 @@ ppc_elf_section_from_shdr (abfd, hdr, name)
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)
@@ -2664,6 +2664,7 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *splt;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
bfd_vma reloc_index;
#ifdef DEBUG
@@ -2692,9 +2693,8 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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)
{
@@ -2716,6 +2716,7 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -2748,16 +2749,16 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
}
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. */
@@ -2780,10 +2781,8 @@ ppc_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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
@@ -3181,6 +3180,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared && r_symndx != 0)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
int skip;
#ifdef DEBUG
@@ -3281,11 +3281,9 @@ ppc_elf_relocate_section (output_bfd, info, 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);
if (skip == -1)
continue;
@@ -3401,6 +3399,7 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
asection *srelgot;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
/* We need to generate a R_PPC_RELATIVE reloc
for the dynamic linker. */
@@ -3412,11 +3411,9 @@ ppc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ 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;
}
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index bbc2ead..e9ec738 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -1788,7 +1788,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
{
asection *srelgot;
Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
srelgot = htab->srelgot;
if (srelgot == NULL)
@@ -1799,8 +1799,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
+ 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);
}
@@ -1907,7 +1907,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -1954,8 +1954,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -2047,7 +2047,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -2167,7 +2167,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
@@ -2184,7 +2184,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -2221,15 +2221,15 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -2244,8 +2244,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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);
}
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index c7c078c..a3b8cd7 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -4875,6 +4875,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
@@ -4948,11 +4949,9 @@ sh_elf_relocate_section (output_bfd, info, 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);
/* If this reloc is against an external symbol, we do
not want to fiddle with the addend. Otherwise, we
@@ -5106,6 +5105,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (srelgot == NULL)
{
@@ -5119,11 +5119,9 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ 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
@@ -5273,6 +5271,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
unsigned short insn;
int indx;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (ELF32_R_TYPE (rel->r_info) == R_SH_TLS_GD_32)
{
@@ -5378,12 +5377,10 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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;
}
@@ -5406,7 +5403,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
int dr_type, indx;
if (srelgot == NULL)
@@ -5426,8 +5423,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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)
@@ -5445,9 +5442,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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);
}
}
@@ -5578,7 +5574,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
Elf_Internal_Rela outrel;
- Elf32_External_Rela *loc;
+ bfd_byte *loc;
srelgot = htab->srelgot;
if (srelgot == NULL)
@@ -5588,8 +5584,8 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ 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;
}
@@ -5604,6 +5600,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
int indx;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (sreloc == NULL)
{
@@ -5634,12 +5631,10 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -5652,6 +5647,7 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
int indx;
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
if (sreloc == NULL)
{
@@ -5682,12 +5678,10 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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;
}
}
@@ -6877,6 +6871,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -6996,9 +6991,8 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
#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)
{
@@ -7015,6 +7009,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *sgot;
asection *srel;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -7050,10 +7045,9 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -7066,6 +7060,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -7102,10 +7097,9 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -7114,6 +7108,7 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
{
asection *s;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol needs a copy reloc. Set it up. */
@@ -7130,10 +7125,8 @@ sh_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. */
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index bf92ccf..ee3b14e 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -35,9 +35,9 @@
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
@@ -59,7 +59,7 @@ static bfd_reloc_status_type v850_elf_final_link_relocate
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
@@ -589,9 +589,9 @@ v850_elf_reloc_type_lookup (abfd, code)
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;
@@ -603,9 +603,9 @@ v850_elf_info_to_howto_rel (abfd, cache_ptr, dst)
/* 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;
@@ -2225,9 +2225,9 @@ v850_elf_section_from_shdr (abfd, hdr, name)
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;
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 0d42b72..4cc18e5 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
@@ -1693,6 +1693,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
& ELF_LINK_HASH_DEF_REGULAR) == 0)))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
@@ -1811,11 +1812,9 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -1905,6 +1904,7 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -1955,9 +1955,8 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
{
@@ -1972,6 +1971,7 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -2002,16 +2002,16 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
(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. */
@@ -2028,10 +2028,8 @@ elf_vax_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. */
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index b845bc4..30b152e 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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,
@@ -296,7 +296,7 @@ static void
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);
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index ab053f9..e482028 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -66,18 +66,18 @@ static bfd_reloc_status_type elf64_alpha_reloc_gpdisp
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
@@ -1165,7 +1165,7 @@ static void
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;
@@ -2325,7 +2325,7 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
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;
@@ -2365,7 +2365,7 @@ elf64_alpha_section_from_shdr (abfd, hdr, name)
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;
@@ -2379,7 +2379,7 @@ elf64_alpha_section_flags (flags, hdr)
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;
@@ -4465,6 +4465,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared && !dynamic_symbol_p)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
BFD_ASSERT(srelgot != NULL);
@@ -4474,10 +4475,9 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -4607,6 +4607,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
case R_ALPHA_TPREL64:
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
/* Careful here to remember RELATIVE relocations for global
variables for symbolic shared objects. */
@@ -4659,10 +4660,9 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
}
@@ -4708,6 +4708,7 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (info->shared && !dynamic_symbol_p)
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
BFD_ASSERT(srelgot != NULL);
@@ -4718,10 +4719,9 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -4880,6 +4880,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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;
@@ -4925,9 +4926,8 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
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))
{
@@ -4963,10 +4963,9 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
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);
}
@@ -4981,6 +4980,7 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
/* 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");
@@ -5024,18 +5024,18 @@ elf64_alpha_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -5504,10 +5504,10 @@ static const struct elf_size_info alpha_elf_size_info =
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
diff --git a/bfd/elf64-gen.c b/bfd/elf64-gen.c
index a58f6ac..f0f897e 100644
--- a/bfd/elf64-gen.c
+++ b/bfd/elf64-gen.c
@@ -41,9 +41,9 @@ static reloc_howto_type dummy =
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 *));
@@ -51,7 +51,7 @@ static void
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;
}
@@ -60,7 +60,7 @@ static void
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;
}
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 3c8e00f..2a4ff10 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -184,7 +184,7 @@ static boolean elf64_hppa_object_p
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 *));
@@ -408,7 +408,7 @@ elf64_hppa_object_p (abfd)
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;
@@ -1991,6 +1991,7 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
{
bfd_vma value;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
BFD_ASSERT (splt != NULL && spltrel != NULL)
@@ -2029,11 +2030,9 @@ elf64_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -2156,7 +2155,8 @@ elf64_hppa_finalize_opd (dyn_h, data)
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
@@ -2221,11 +2221,9 @@ elf64_hppa_finalize_opd (dyn_h, data)
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;
}
@@ -2291,7 +2289,8 @@ elf64_hppa_finalize_dlt (dyn_h, data)
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
@@ -2315,11 +2314,9 @@ elf64_hppa_finalize_dlt (dyn_h, data)
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;
}
@@ -2362,7 +2359,8 @@ elf64_hppa_finalize_dynreloc (dyn_h, data)
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. */
@@ -2429,12 +2427,11 @@ elf64_hppa_finalize_dynreloc (dyn_h, data)
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);
}
}
@@ -2704,10 +2701,10 @@ const struct elf_size_info hppa64_elf_size_info =
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
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index f06d065..2d7cb63 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -63,20 +63,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
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
@@ -86,9 +86,9 @@ static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup
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 *));
@@ -1218,7 +1218,7 @@ static void
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);
@@ -1226,6 +1226,7 @@ mips_elf64_swap_reloc_in (abfd, src, dst)
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. */
@@ -1250,7 +1251,7 @@ mips_elf64_swap_reloca_in (abfd, src, dst)
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);
@@ -1284,9 +1285,9 @@ static void
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,
@@ -1294,10 +1295,13 @@ mips_elf64_be_swap_reloc_in (abfd, src, dst)
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. */
@@ -1330,10 +1334,10 @@ mips_elf64_be_swap_reloca_in (abfd, src, dst)
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);
@@ -1947,7 +1951,7 @@ bfd_elf64_bfd_reloc_type_lookup (abfd, code)
}
}
-/* 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)
@@ -1980,7 +1984,7 @@ static void
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);
}
@@ -1989,7 +1993,7 @@ static void
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);
}
@@ -2058,20 +2062,9 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr)
(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. */
@@ -2326,7 +2319,7 @@ mips_elf64_write_rel (abfd, sec, rel_hdr, count, data)
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;
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 939d12f..57d6258 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -131,7 +131,7 @@ static reloc_howto_type *bfd_elf64_bfd_reloc_type_lookup
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));
@@ -1063,7 +1063,7 @@ static void
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;
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index e437427..f572ffe 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -35,7 +35,7 @@ static void ppc_howto_init
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
@@ -1351,7 +1351,7 @@ static void
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;
@@ -4471,7 +4471,7 @@ ppc_build_one_stub (gen_entry, in_arg)
{
/* 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
@@ -4479,9 +4479,9 @@ ppc_build_one_stub (gen_entry, in_arg)
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
@@ -5618,7 +5618,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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. */
@@ -5627,8 +5627,9 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
+ 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);
}
@@ -5763,7 +5764,7 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -5853,8 +5854,8 @@ ppc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -6065,7 +6066,7 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
&& ((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. */
@@ -6084,15 +6085,16 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -6130,15 +6132,15 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -6153,8 +6155,8 @@ ppc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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);
}
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 296e349..31d59c7 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -606,7 +606,7 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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:
@@ -649,19 +649,19 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
}
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;
@@ -669,12 +669,12 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
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:
@@ -831,17 +831,17 @@ elf_s390_check_relocs (abfd, info, sec, relocs)
/* 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;
@@ -1029,8 +1029,8 @@ elf_s390_adjust_dynamic_symbol (info, h)
&& 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;
@@ -1540,10 +1540,10 @@ elf_s390_size_dynamic_sections (output_bfd, info)
}
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,
@@ -1610,8 +1610,8 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_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);
@@ -1666,7 +1666,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
{
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;
@@ -1676,93 +1676,93 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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 ();
@@ -1778,72 +1778,72 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -1864,18 +1864,18 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
& 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,
@@ -1885,12 +1885,12 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, 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
@@ -1901,12 +1901,12 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
|| !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);
@@ -1917,23 +1917,23 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -2011,10 +2011,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -2023,11 +2023,11 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -2062,7 +2062,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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
@@ -2076,7 +2076,7 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
@@ -2093,10 +2093,10 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
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 ();
@@ -2115,30 +2115,30 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
|| 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. */
@@ -2153,8 +2153,8 @@ elf_s390_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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);
}
@@ -2331,8 +2331,8 @@ const struct elf_size_info s390_elf64_size_info =
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,
@@ -2345,10 +2345,10 @@ const struct elf_size_info s390_elf64_size_info =
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
@@ -2388,6 +2388,6 @@ const struct elf_size_info s390_elf64_size_info =
#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"
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index 590c133..f2109b6 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -1755,6 +1755,7 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
/* When generating a shared object, these relocations
@@ -1825,11 +1826,9 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- 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
@@ -1978,22 +1977,21 @@ sh_elf64_relocate_section (output_bfd, info, input_bfd, input_section,
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)
@@ -3827,6 +3825,7 @@ sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -3915,9 +3914,8 @@ sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym)
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)
{
@@ -3932,6 +3930,7 @@ sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *sgot;
asection *srel;
Elf_Internal_Rela rel;
+ bfd_byte *loc;
/* This symbol has an entry in the global offset table. Set it
up. */
@@ -3965,16 +3964,16 @@ sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -3991,10 +3990,9 @@ sh64_elf64_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. */
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index ae4e57a..0311f8a 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -73,7 +73,7 @@ static boolean sparc64_elf_merge_private_bfd_data
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 *));
@@ -255,7 +255,7 @@ static void
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)];
@@ -323,7 +323,7 @@ sparc64_elf_slurp_one_reloc_table (abfd, asect, rel_hdr, symbols, dynamic)
{
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.
@@ -626,7 +626,7 @@ sparc64_elf_write_relocs (abfd, sec, data)
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;
}
}
@@ -2073,6 +2073,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
case R_SPARC_UA16:
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
boolean skip, relocate;
if (sreloc == NULL)
@@ -2224,11 +2225,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
}
- 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. */
@@ -2308,8 +2307,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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.
@@ -2321,19 +2321,17 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
/* 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);
@@ -2647,6 +2645,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *splt;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the PLT. Set it up. */
@@ -2678,9 +2677,9 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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)
{
@@ -2702,6 +2701,7 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
asection *sgot;
asection *srela;
Elf_Internal_Rela rela;
+ bfd_byte *loc;
/* This symbol has an entry in the GOT. Set it up. */
@@ -2736,16 +2736,16 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -2760,10 +2760,8 @@ sparc64_elf_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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. */
@@ -2993,7 +2991,7 @@ sparc64_elf_merge_private_bfd_data (ibfd, obfd)
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;
@@ -3086,10 +3084,10 @@ const struct elf_size_info sparc64_elf_size_info =
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
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index cbb961f..cd98e82 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -153,7 +153,7 @@ static const struct elf_reloc_map x86_64_reloc_map[] =
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
@@ -231,7 +231,7 @@ static void
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;
@@ -2004,14 +2004,14 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -2019,8 +2019,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
+ 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);
}
@@ -2099,9 +2099,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
|| 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
@@ -2186,8 +2186,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
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
@@ -2333,7 +2333,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
int dr_type, indx;
if (htab->srelgot == NULL)
@@ -2354,8 +2354,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
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)
@@ -2375,9 +2375,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
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);
}
}
@@ -2473,7 +2472,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
else
{
Elf_Internal_Rela outrel;
- Elf64_External_Rela *loc;
+ bfd_byte *loc;
if (htab->srelgot == NULL)
abort ();
@@ -2487,8 +2486,8 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
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;
}
@@ -2589,7 +2588,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -2649,7 +2648,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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)
@@ -2668,7 +2667,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
&& 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. */
@@ -2706,15 +2705,15 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
@@ -2729,8 +2728,8 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
+ 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);
}
diff --git a/bfd/elfarm-nabi.c b/bfd/elfarm-nabi.c
index dcf6808..47ac1c0 100644
--- a/bfd/elfarm-nabi.c
+++ b/bfd/elfarm-nabi.c
@@ -583,13 +583,13 @@ static reloc_howto_type elf32_arm_thm_pc9_howto =
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;
diff --git a/bfd/elfarm-oabi.c b/bfd/elfarm-oabi.c
index fb92046..00cdeea 100644
--- a/bfd/elfarm-oabi.c
+++ b/bfd/elfarm-oabi.c
@@ -49,7 +49,7 @@
#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[] =
@@ -369,7 +369,7 @@ static void
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;
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index f523972..c1ef912 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -421,44 +421,49 @@ elf_swap_phdr_out (abfd, src, dst)
}
/* 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);
@@ -858,12 +863,13 @@ elf_write_relocs (abfd, sec, data)
{
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)
@@ -891,122 +897,69 @@ elf_write_relocs (abfd, sec, data)
/* 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);
}
}
@@ -1372,17 +1325,11 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
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.
@@ -1421,7 +1368,7 @@ elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
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)
@@ -1649,8 +1596,8 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
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
};
diff --git a/bfd/elflink.h b/bfd/elflink.h
index c945194..7192778 100644
--- a/bfd/elflink.h
+++ b/bfd/elflink.h
@@ -2484,7 +2484,10 @@ elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
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)
@@ -2502,52 +2505,20 @@ elf_link_read_relocs_from_section (abfd, shdr, external_relocs,
/* 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;
@@ -4588,91 +4559,51 @@ elf_link_adjust_relocs (abfd, rel_hdr, count, rel_hash)
{
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
@@ -4691,13 +4622,13 @@ elf_link_sort_cmp1 (A, B)
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;
}
@@ -4721,9 +4652,9 @@ elf_link_sort_cmp2 (A, B)
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;
}
@@ -4736,12 +4667,14 @@ elf_link_sort_relocs (abfd, info, psec)
{
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)
@@ -4749,11 +4682,17 @@ elf_link_sort_relocs (abfd, info, psec)
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)
@@ -4765,24 +4704,10 @@ elf_link_sort_relocs (abfd, info, psec)
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,
@@ -4795,103 +4720,62 @@ elf_link_sort_relocs (abfd, info, psec)
== (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;
}
@@ -6481,11 +6365,12 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
{
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;
@@ -6515,55 +6400,23 @@ elf_link_output_relocs (output_bfd, input_section, input_rel_hdr,
}
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
@@ -7221,6 +7074,9 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
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)
@@ -7336,58 +7192,28 @@ elf_reloc_link_order (output_bfd, info, output_section, link_order)
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;
@@ -7604,19 +7430,10 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
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. */
@@ -7630,17 +7447,18 @@ elf_finish_pointer_linker_section (output_bfd, input_bfd, info, lsect, h,
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);
}
}
}
diff --git a/bfd/elfn32-mips.c b/bfd/elfn32-mips.c
index 916b16b..15f0fdf 100644
--- a/bfd/elfn32-mips.c
+++ b/bfd/elfn32-mips.c
@@ -77,9 +77,9 @@ static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
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
@@ -1896,7 +1896,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
}
}
-/* 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)
@@ -1923,13 +1923,13 @@ 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;
@@ -1946,13 +1946,13 @@ mips_info_to_howto_rel (abfd, cache_ptr, dst)
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;
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index ddd86fb..9a6f65c 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -163,18 +163,18 @@ static reloc_howto_type * lookup_howto
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
@@ -597,7 +597,7 @@ static void
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));
@@ -1017,7 +1017,7 @@ is_unwind_section_name (abfd, name)
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;
@@ -1057,7 +1057,7 @@ elfNN_ia64_section_from_shdr (abfd, hdr, name)
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;
@@ -1071,7 +1071,7 @@ elfNN_ia64_section_flags (flags, hdr)
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;
@@ -3203,6 +3203,7 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, type,
bfd_vma addend;
{
Elf_Internal_Rela outrel;
+ bfd_byte *loc;
BFD_ASSERT (dynindx != -1);
outrel.r_info = ELFNN_R_INFO (dynindx, type);
@@ -3219,9 +3220,9 @@ elfNN_ia64_install_dyn_reloc (abfd, info, sec, srel, offset, 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);
}
@@ -4350,7 +4351,6 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
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);
@@ -4407,10 +4407,10 @@ elfNN_ia64_finish_dynamic_symbol (output_bfd, info, h, sym)
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. */
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index 98dfdd85..c8e9906 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -1176,16 +1176,13 @@ sort_dynamic_relocs (arg1, arg2)
const PTR arg1;
const PTR arg2;
{
- const Elf32_External_Rel *ext_reloc1 = (const Elf32_External_Rel *) arg1;
- const Elf32_External_Rel *ext_reloc2 = (const Elf32_External_Rel *) arg2;
+ Elf_Internal_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
@@ -2861,7 +2858,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
bfd_vma *addendp;
asection *input_section;
{
- Elf_Internal_Rel outrel[3];
+ Elf_Internal_Rela outrel[3];
boolean skip;
asection *sreloc;
bfd *dynobj;
@@ -2917,7 +2914,7 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
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;
@@ -3001,10 +2998,9 @@ mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
+ 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. */
@@ -3577,7 +3573,7 @@ _bfd_mips_elf_section_from_shdr (abfd, hdr, name)
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;
diff --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 65f3160..f8bf08a 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,25 @@
+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.
diff --git a/include/elf/internal.h b/include/elf/internal.h
index 5d39d3a..45d682a 100644
--- a/include/elf/internal.h
+++ b/include/elf/internal.h
@@ -1,5 +1,5 @@
/* 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
@@ -58,11 +58,6 @@ typedef struct elf_internal_ehdr {
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 {
@@ -77,10 +72,6 @@ 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 */
@@ -101,11 +92,6 @@ typedef struct elf_internal_shdr {
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 {
@@ -119,11 +105,6 @@ 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 {
@@ -134,33 +115,15 @@ 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 {
@@ -173,11 +136,6 @@ 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 {
@@ -257,30 +215,6 @@ typedef struct
} 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. */