* elfxx-target.h (elf_backend_rela_normal): Define.
(elfNN_bed): Init rela_normal.
* elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment
for section symbols here if rela_normal. Simplify abs section test.
* elf-m10200.c (mn10200_elf_relocate_section): If relocatable,
return immediately. Remove code handling relocatable linking.
* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
* elf32-fr30.c (fr30_elf_relocate_section): Likewise.
* elf32-i370.c (i370_elf_relocate_section): Likewise.
* elf32-i860.c (elf32_i860_relocate_section): Likewise.
* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
* elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
* elf32-s390.c (elf_s390_relocate_section): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
* elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
* elf64-s390.c (elf_s390_relocate_section): Likewise.
* elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
* elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
* elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL.
* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
* elf-m10200.c (elf_backend_rela_normal): Define.
* elf-m10300.c (elf_backend_rela_normal): Define.
* elf32-fr30.c (elf_backend_rela_normal): Define.
* elf32-i370.c (elf_backend_rela_normal): Define.
* elf32-i860.c (elf_backend_rela_normal): Define.
* elf32-m68k.c (elf_backend_rela_normal): Define.
* elf32-mcore.c (elf_backend_rela_normal): Define.
* elf32-openrisc.c (elf_backend_rela_normal): Define.
* elf32-ppc.c (elf_backend_rela_normal): Define.
* elf32-s390.c (elf_backend_rela_normal): Define.
* elf32-xstormy16.c (elf_backend_rela_normal): Define.
* elf64-ppc.c (elf_backend_rela_normal): Define.
* elf64-s390.c (elf_backend_rela_normal): Define.
* elf64-x86-64.c (elf_backend_rela_normal): Define.
* elfxx-ia64.c (elf_backend_rela_normal): Define.
* elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL.
* elf32-m32r.c (elf_backend_rela_normal): Likewise.
+2002-05-07 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-bfd.h (struct elf_backend_data): Add rela_normal.
+ * elfxx-target.h (elf_backend_rela_normal): Define.
+ (elfNN_bed): Init rela_normal.
+ * elflink.h (elf_link_input_bfd <emit_relocs>): Handle adjustment
+ for section symbols here if rela_normal. Simplify abs section test.
+ * elf-m10200.c (mn10200_elf_relocate_section): If relocatable,
+ return immediately. Remove code handling relocatable linking.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+ * elf32-ppc.c (ppc_elf_relocate_section): Likewise.
+ * elf32-s390.c (elf_s390_relocate_section): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise #ifndef USE_REL.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf-m10200.c (elf_backend_rela_normal): Define.
+ * elf-m10300.c (elf_backend_rela_normal): Define.
+ * elf32-fr30.c (elf_backend_rela_normal): Define.
+ * elf32-i370.c (elf_backend_rela_normal): Define.
+ * elf32-i860.c (elf_backend_rela_normal): Define.
+ * elf32-m68k.c (elf_backend_rela_normal): Define.
+ * elf32-mcore.c (elf_backend_rela_normal): Define.
+ * elf32-openrisc.c (elf_backend_rela_normal): Define.
+ * elf32-ppc.c (elf_backend_rela_normal): Define.
+ * elf32-s390.c (elf_backend_rela_normal): Define.
+ * elf32-xstormy16.c (elf_backend_rela_normal): Define.
+ * elf64-ppc.c (elf_backend_rela_normal): Define.
+ * elf64-s390.c (elf_backend_rela_normal): Define.
+ * elf64-x86-64.c (elf_backend_rela_normal): Define.
+ * elfxx-ia64.c (elf_backend_rela_normal): Define.
+ * elf32-arm.h (elf_backend_rela_normal): Define #ifndef USE_REL.
+ * elf32-m32r.c (elf_backend_rela_normal): Likewise.
+
2002-05-06 Nick Clifton <nickc@cambridge.redhat.com>
* elf32-arm.h (elf32_arm_final_link_relocate): Convert
section. */
unsigned default_use_rela_p : 1;
+ /* Set if RELA relocations for a relocatable link can be handled by
+ generic code. Backends that set this flag need do nothing in the
+ backend relocate_section routine for relocatable linking. */
+ unsigned rela_normal : 1;
+
/* True if addresses "naturally" sign extend. This is used when
swapping in from Elf32 when BFD64. */
unsigned sign_extend_vma : 1;
/* Matsushita 10200 specific support for 32-bit ELF
- Copyright 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
struct elf_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
r_type = ELF32_R_TYPE (rel->r_info);
howto = elf_mn10200_howto_table + r_type;
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
#define ELF_MACHINE_ALT1 EM_CYGNUS_MN10200
#define ELF_MAXPAGESIZE 0x1000
+#define elf_backend_rela_normal 1
#define elf_info_to_howto mn10200_info_to_howto
#define elf_info_to_howto_rel 0
#define elf_backend_relocate_section mn10200_elf_relocate_section
struct elf32_mn10300_link_hash_entry **sym_hashes;
Elf_Internal_Rela *rel, *relend;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = (struct elf32_mn10300_link_hash_entry **)
(elf_sym_hashes (input_bfd));
|| r_type == R_MN10300_GNU_VTENTRY)
continue;
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
#define elf_info_to_howto mn10300_info_to_howto
#define elf_info_to_howto_rel 0
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define elf_backend_check_relocs mn10300_elf_check_relocs
#define elf_backend_gc_mark_hook mn10300_elf_gc_mark_hook
#define elf_backend_relocate_section mn10300_elf_relocate_section
Elf_Internal_Rela * relend;
const char * name;
+#ifndef USE_REL
+ if (info->relocateable)
+ return true;
+#endif
+
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
#endif
howto = bfd_reloc.howto;
+#ifdef USE_REL
if (info->relocateable)
{
/* This is a relocateable link. We don't have to change
if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
{
sec = local_sections[r_symndx];
-#ifdef USE_REL
arm_add_to_rel (input_bfd, contents + rel->r_offset,
howto,
(bfd_signed_vma) (sec->output_offset
+ sym->st_value));
-#else
- rel->r_addend += (sec->output_offset + sym->st_value);
-#endif
}
}
continue;
}
+#endif
/* This is a final link. */
h = NULL;
#define elf_backend_plt_readonly 1
#define elf_backend_want_got_plt 1
#define elf_backend_want_plt_sym 0
+#ifndef USE_REL
+#define elf_backend_rela_normal 1
+#endif
#define elf_backend_got_header_size 12
#define elf_backend_plt_header_size PLT_ENTRY_SIZE
/* FR30-specific support for 32-bit ELF.
- Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
-
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections [r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
howto = fr30_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
#define elf_backend_check_relocs fr30_elf_check_relocs
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup fr30_reloc_type_lookup
bfd_vma *local_got_offsets;
boolean ret = true;
+ if (info->relocateable)
+ return true;
+
#ifdef DEBUG
fprintf (stderr, "i370_elf_relocate_section called for %s section %s, %ld relocations%s\n",
bfd_archive_filename (input_bfd),
howto = i370_elf_howto_table[(int)r_type];
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- addend = rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
-#ifdef DEBUG
- fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n",
- howto->name,
- (int)r_type,
- r_symndx,
- (long)offset,
- (long)addend);
-#endif
- continue;
- }
-
- /* This is a final link. */
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
#define elf_backend_plt_not_loaded 1
#define elf_backend_got_symbol_offset 4
+#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup i370_elf_reloc_type_lookup
#define bfd_elf32_bfd_set_private_flags i370_elf_set_private_flags
/* Intel i860 specific support for 32-bit ELF.
- Copyright 1993, 1995, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1993, 1995, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
Full i860 support contributed by Jason Eckhardt <jle@cygnus.com>.
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
-
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections [r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
howto = lookup_howto ((unsigned) ELF32_R_TYPE (rel->r_info));
h = NULL;
sym = NULL;
#define ELF_MACHINE_CODE EM_860
#define ELF_MAXPAGESIZE 4096
+#define elf_backend_rela_normal 1
#define elf_info_to_howto_rel NULL
#define elf_info_to_howto elf32_i860_info_to_howto_rela
#define elf_backend_relocate_section elf32_i860_relocate_section
/* Assume success. */
boolean ret = true;
+#ifndef USE_REL
+ if (info->relocateable)
+ return true;
+#endif
+
rel = relocs;
relend = relocs + input_section->reloc_count;
for (; rel < relend; rel++)
howto = m32r_elf_howto_table + r_type;
r_symndx = ELF32_R_SYM (rel->r_info);
+#ifdef USE_REL
if (info->relocateable)
{
/* This is a relocateable link. We don't have to change
sec = local_sections[r_symndx];
addend += sec->output_offset + sym->st_value;
-#ifndef USE_REL
- /* This can't be done for USE_REL because it doesn't mean anything
- and elf_link_input_bfd asserts this stays zero. */
- rel->r_addend = addend;
-#endif
-#ifndef USE_REL
- /* Addends are stored with relocs. We're done. */
- continue;
-#else /* USE_REL */
/* If partial_inplace, we need to store any additional addend
back in the section. */
if (! howto->partial_inplace)
r = _bfd_relocate_contents (howto, input_bfd,
addend, contents + offset);
}
-#endif /* USE_REL */
}
else
+#endif /* USE_REL */
{
bfd_vma relocation;
#define elf_backend_check_relocs m32r_elf_check_relocs
#define elf_backend_can_gc_sections 1
+#ifndef USE_REL
+#define elf_backend_rela_normal 1
+#endif
#if 0 /* not yet */
/* relax support */
#define bfd_elf32_bfd_relax_section m32r_elf_relax_section
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ if (info->relocateable)
+ return true;
+
dynobj = elf_hash_table (info)->dynobj;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 12
+#define elf_backend_rela_normal 1
#include "elf32-target.h"
/* Motorola MCore specific support for 32-bit ELF
- Copyright 1994, 1995, 1999, 2000, 2001 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
(info->relocateable) ? " (relocatable)" : "");
#endif
+ if (info->relocateable)
+ return true;
+
if (! mcore_elf_howto_table [R_MCORE_PCRELIMM8BY4]) /* Initialize howto table if needed */
mcore_elf_howto_init ();
howto = mcore_elf_howto_table [(int) r_type];
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
-
- if ((unsigned)ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- addend = rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
-#ifdef DEBUG
- fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n",
- howto->name, (int) r_type, r_symndx, (long) offset, (long) addend);
-#endif
- continue;
- }
-
- /* This is a final link. */
-
/* Complain about known relocation that are not yet supported. */
if (howto->special_function == mcore_elf_unsupported_reloc)
{
#define elf_backend_check_relocs mcore_elf_check_relocs
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#include "elf32-target.h"
/* OpenRISC-specific support for 32-bit ELF.
- Copyright 2001 Free Software Foundation, Inc.
+ Copyright 2001, 2002 Free Software Foundation, Inc.
Contributed by Johan Rydberg, jrydberg@opencores.org
This file is part of BFD, the Binary File Descriptor library.
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
|| r_type == R_OPENRISC_GNU_VTENTRY)
continue;
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
-
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
- continue;
- }
-
if ((unsigned int) r_type >
(sizeof openrisc_elf_howto_table / sizeof (reloc_howto_type)))
abort ();
#define elf_backend_check_relocs openrisc_elf_check_relocs
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup openrisc_reloc_type_lookup
/* PowerPC-specific support for 32-bit ELF
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+ Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
(info->relocateable) ? " (relocatable)" : "");
#endif
+ if (info->relocateable)
+ return true;
+
if (!ppc_elf_howto_table[R_PPC_ADDR32])
/* Initialize howto table if needed. */
ppc_elf_howto_init ();
howto = ppc_elf_howto_table[(int) r_type];
r_symndx = ELF32_R_SYM (rel->r_info);
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- addend = rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
-#ifdef DEBUG
- fprintf (stderr, "\ttype = %s (%d), symbol index = %ld, offset = %ld, addend = %ld\n",
- howto->name,
- (int) r_type,
- r_symndx,
- (long) offset,
- (long) addend);
-#endif
- continue;
- }
-
- /* This is a final link. */
if (r_symndx < symtab_hdr->sh_info)
{
sym = local_syms + r_symndx;
#define elf_backend_can_refcount 1
#define elf_backend_got_header_size 12
#define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE
+#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_merge_private_bfd_data ppc_elf_merge_private_bfd_data
#define bfd_elf32_bfd_relax_section ppc_elf_relax_section
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ if (info->relocateable)
+ return true;
+
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
bfd_set_error (bfd_error_bad_value);
return false;
}
- howto = elf_howto_table + r_type;
+ howto = elf_howto_table + r_type;
r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 12
#define elf_backend_plt_header_size PLT_ENTRY_SIZE
+#define elf_backend_rela_normal 1
#define elf_info_to_howto elf_s390_info_to_howto
bfd *dynobj;
asection *splt;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
relend = relocs + input_section->reloc_count;
continue;
r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
-
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections [r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
howto = xstormy16_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
xstormy16_elf_finish_dynamic_sections
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_reloc_type_lookup xstormy16_reloc_type_lookup
#define bfd_elf32_bfd_relax_section xstormy16_elf_relax_section
/* Disabled until we sort out how ld should choose 'y' vs 'at'. */
boolean is_power4 = false;
+ if (info->relocateable)
+ return true;
+
/* Initialize howto table if needed. */
if (!ppc64_elf_howto_table[R_PPC64_ADDR32])
ppc_howto_init ();
r_type = (enum elf_ppc_reloc_type) ELF64_R_TYPE (rel->r_info);
r_symndx = ELF64_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocatable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if ((unsigned) ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
- continue;
- }
-
- /* This is a final link. */
-
offset = rel->r_offset;
addend = rel->r_addend;
r = bfd_reloc_other;
#define elf_backend_plt_header_size PLT_INITIAL_ENTRY_SIZE
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
+#define elf_backend_rela_normal 1
#define bfd_elf64_bfd_reloc_type_lookup ppc64_elf_reloc_type_lookup
#define bfd_elf64_bfd_set_private_flags ppc64_elf_set_private_flags
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ if (info->relocateable)
+ return true;
+
htab = elf_s390_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
bfd_set_error (bfd_error_bad_value);
return false;
}
- howto = elf_howto_table + r_type;
+ howto = elf_howto_table + r_type;
r_symndx = ELF64_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 24
#define elf_backend_plt_header_size PLT_ENTRY_SIZE
+#define elf_backend_rela_normal 1
#define elf_info_to_howto elf_s390_info_to_howto
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ if (info->relocateable)
+ return true;
+
htab = elf64_x86_64_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd);
bfd_set_error (bfd_error_bad_value);
return false;
}
- howto = x86_64_elf_howto_table + r_type;
+ howto = x86_64_elf_howto_table + r_type;
r_symndx = ELF64_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sec = local_sections[r_symndx];
- rel->r_addend += sec->output_offset + sym->st_value;
- }
- }
-
- continue;
- }
-
- /* This is a final link. */
h = NULL;
sym = NULL;
sec = NULL;
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size (GOT_ENTRY_SIZE*3)
#define elf_backend_plt_header_size PLT_ENTRY_SIZE
+#define elf_backend_rela_normal 1
#define elf_info_to_howto elf64_x86_64_info_to_howto
void (*reloc_emitter) PARAMS ((bfd *, asection *,
Elf_Internal_Shdr *,
Elf_Internal_Rela *));
+ boolean rela_normal;
+
+ input_rel_hdr = &elf_section_data (o)->rel_hdr;
+ rela_normal = (bed->rela_normal
+ && (input_rel_hdr->sh_entsize
+ == sizeof (Elf_External_Rela)));
/* Adjust the reloc addresses and symbol indices. */
processor specific section. If we have
discarded a section, the output_section will
be the absolute section. */
- if (sec != NULL
- && (bfd_is_abs_section (sec)
- || (sec->output_section != NULL
- && bfd_is_abs_section (sec->output_section))))
+ if (bfd_is_abs_section (sec)
+ || (sec != NULL
+ && bfd_is_abs_section (sec->output_section)))
r_symndx = 0;
else if (sec == NULL || sec->owner == NULL)
{
r_symndx = sec->output_section->target_index;
BFD_ASSERT (r_symndx != 0);
}
+
+ /* Adjust the addend according to where the
+ section winds up in the output section. */
+ if (rela_normal)
+ irela->r_addend += sec->output_offset;
}
else
{
else
reloc_emitter = elf_link_output_relocs;
- input_rel_hdr = &elf_section_data (o)->rel_hdr;
(*reloc_emitter) (output_bfd, o, input_rel_hdr, internal_relocs);
input_rel_hdr = elf_section_data (o)->rel_hdr2;
elf_section_data(input_section->output_section)
->this_hdr.sh_flags |= flags;
+ return true;
}
gp_val = _bfd_get_gp_value (output_bfd);
ret_val = false;
continue;
}
+
howto = lookup_howto (r_type);
r_symndx = ELFNN_R_SYM (rel->r_info);
-
- if (info->relocateable)
- {
- /* This is a relocateable link. We don't have to change
- anything, unless the reloc is against a section symbol,
- in which case we have to adjust according to where the
- section symbol winds up in the output section. */
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- if (ELF_ST_TYPE (sym->st_info) == STT_SECTION)
- {
- sym_sec = local_sections[r_symndx];
- rel->r_addend += sym_sec->output_offset;
- }
- }
- continue;
- }
-
- /* This is a final link. */
-
h = NULL;
sym = NULL;
sym_sec = NULL;
#define elf_backend_copy_indirect_symbol elfNN_ia64_hash_copy_indirect
#define elf_backend_hide_symbol elfNN_ia64_hash_hide_symbol
#define elf_backend_reloc_type_class elfNN_ia64_reloc_type_class
+#define elf_backend_rela_normal 1
#include "elfNN-target.h"
#define elf_backend_default_use_rela_p !USE_REL
#endif
+#ifndef elf_backend_rela_normal
+#define elf_backend_rela_normal 0
+#endif
+
#ifndef ELF_MACHINE_ALT1
#define ELF_MACHINE_ALT1 0
#endif
elf_backend_may_use_rel_p,
elf_backend_may_use_rela_p,
elf_backend_default_use_rela_p,
+ elf_backend_rela_normal,
elf_backend_sign_extend_vma,
elf_backend_want_got_plt,
elf_backend_plt_readonly,