summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-07-23 12:29:33 +0000
committerAlan Modra <amodra@gmail.com>2002-07-23 12:29:33 +0000
commitf0fe0e16e17d196619746299b29755f87718a96b (patch)
tree532435a5a3411f6c9f7b4461db032b2bd23ea5d6
parent5e8d7549530ad332442a2dde84d45242608a0446 (diff)
* elf-hppa.h (elf_hppa_relocate_section): If relocatable, return
immediately. Remove code handling relocatable linking. * elf32-avr.c (elf32_avr_relocate_section): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-fr30.c (elf32_frv_relocate_section): Likewise. * elf32-h8300.c (elf32_h8_relocate_section): Likewise. * elf32-hppa.c (elf32_hppa_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-sparc.c (elf32_sparc_relocate_section): Likewise. * elf32-v850.c (v850_elf_relocate_section): Likewise. * elf32-vax.c (elf_vax_relocate_section): Likewise. * elf64-sparc.c (sparc64_elf_relocate_section): Likewise. * elf32-avr.c (elf_backend_rela_normal): Define. * elf32-cris.c: Likewise. * elf32-fr30.c: Likewise. * elf32-h8300.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-sparc.c: Likewise. * elf32-v850.c: Likewise. * elf32-vax.c: Likewise. * elf64-hppa.c: Likewise. * elf64-sparc.c: Likewise. * elf32-fr30.c (elf32_frv_relocate_section): Edit comment. * elf32-i860.c (elf32_i860_relocate_section): Likewise. * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise. * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise. * elf-m10200.c (USE_RELA): Don't define. * elf-m10300.c: Likewise. * elf32-i370.c: Likewise. * elf32-ip2k.c: Likewise. * elf32-m68k.c: Likewise. * elf32-mcore.c: Likewise. * elf32-ppc.c: Likewise. * elf32-s390.c: Likewise. * elf32-vax.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-x86-64.c: Likewise. * elfxx-ia64.c: Likewise. * elf32-avr.c (USE_REL): Don't undef. * elf32-ip2k.c: Likewise.
-rw-r--r--bfd/ChangeLog47
-rw-r--r--bfd/elf-hppa.h28
-rw-r--r--bfd/elf-m10200.c4
-rw-r--r--bfd/elf-m10300.c4
-rw-r--r--bfd/elf32-avr.c30
-rw-r--r--bfd/elf32-cris.c27
-rw-r--r--bfd/elf32-fr30.c3
-rw-r--r--bfd/elf32-h8300.c26
-rw-r--r--bfd/elf32-hppa.c25
-rw-r--r--bfd/elf32-i370.c2
-rw-r--r--bfd/elf32-i860.c3
-rw-r--r--bfd/elf32-ip2k.c34
-rw-r--r--bfd/elf32-m32r.c3
-rw-r--r--bfd/elf32-m68k.c2
-rw-r--r--bfd/elf32-mcore.c3
-rw-r--r--bfd/elf32-openrisc.c3
-rw-r--r--bfd/elf32-ppc.c2
-rw-r--r--bfd/elf32-s390.c2
-rw-r--r--bfd/elf32-sparc.c26
-rw-r--r--bfd/elf32-v850.c26
-rw-r--r--bfd/elf32-vax.c28
-rw-r--r--bfd/elf32-xstormy16.c3
-rw-r--r--bfd/elf64-hppa.c3
-rw-r--r--bfd/elf64-ppc.c3
-rw-r--r--bfd/elf64-s390.c2
-rw-r--r--bfd/elf64-sparc.c26
-rw-r--r--bfd/elf64-x86-64.c3
-rw-r--r--bfd/elfxx-ia64.c2
28 files changed, 103 insertions, 267 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 93e19b00ca..0bdb1f8078 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,50 @@
+2002-07-23 Alan Modra <amodra@bigpond.net.au>
+
+ * elf-hppa.h (elf_hppa_relocate_section): If relocatable, return
+ immediately. Remove code handling relocatable linking.
+ * elf32-avr.c (elf32_avr_relocate_section): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-fr30.c (elf32_frv_relocate_section): Likewise.
+ * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-v850.c (v850_elf_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf32-avr.c (elf_backend_rela_normal): Define.
+ * elf32-cris.c: Likewise.
+ * elf32-fr30.c: Likewise.
+ * elf32-h8300.c: Likewise.
+ * elf32-hppa.c: Likewise.
+ * elf32-ip2k.c: Likewise.
+ * elf32-sparc.c: Likewise.
+ * elf32-v850.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf64-hppa.c: Likewise.
+ * elf64-sparc.c: Likewise.
+ * elf32-fr30.c (elf32_frv_relocate_section): Edit comment.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-ip2k.c (ip2k_elf_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-openrisc.c (openrisc_elf_relocate_section): Likewise.
+ * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+ * elf-m10200.c (USE_RELA): Don't define.
+ * elf-m10300.c: Likewise.
+ * elf32-i370.c: Likewise.
+ * elf32-ip2k.c: Likewise.
+ * elf32-m68k.c: Likewise.
+ * elf32-mcore.c: Likewise.
+ * elf32-ppc.c: Likewise.
+ * elf32-s390.c: Likewise.
+ * elf32-vax.c: Likewise.
+ * elf64-ppc.c: Likewise.
+ * elf64-s390.c: Likewise.
+ * elf64-x86-64.c: Likewise.
+ * elfxx-ia64.c: Likewise.
+ * elf32-avr.c (USE_REL): Don't undef.
+ * elf32-ip2k.c: Likewise.
+
2002-07-23 Nick Clifton <nickc@redhat.com>
* elf-bfd.h (struct elf_backend_data): Add new bitfield
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index d58c5b1251..263e9ac503 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -1376,8 +1376,12 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
- struct elf64_hppa_link_hash_table *hppa_info = elf64_hppa_hash_table (info);
+ struct elf64_hppa_link_hash_table *hppa_info;
+ if (info->relocateable)
+ return true;
+
+ hppa_info = elf64_hppa_hash_table (info);
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
rel = relocs;
@@ -1405,28 +1409,8 @@ elf_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
return false;
}
- r_symndx = ELF_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. */
+ r_symndx = ELF_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
sym_sec = NULL;
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 025e3ad92a..37b832aaf0 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -45,10 +45,6 @@ static bfd_byte * mn10200_elf_get_relocated_section_contents
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_order *,
bfd_byte *, boolean, asymbol **));
-/* We have to use RELA instructions since md_apply_fix3 in the assembler
- does absolutely nothing. */
-#define USE_RELA
-
enum reloc_type {
R_MN10200_NONE = 0,
R_MN10200_32,
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 2c9b4a928a..374e55e703 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -134,10 +134,6 @@ static void compute_function_info
PARAMS ((bfd *, struct elf32_mn10300_link_hash_entry *,
bfd_vma, unsigned char *));
-/* We have to use RELA instructions since md_apply_fix3 in the assembler
- does absolutely nothing. */
-#define USE_RELA
-
static reloc_howto_type elf_mn10300_howto_table[] = {
/* Dummy relocation. Does nothing. */
HOWTO (R_MN10300_NONE,
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index bef8c7f0cb..42683682ff 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -46,9 +46,6 @@ static boolean elf32_avr_relocate_section
static void bfd_elf_avr_final_write_processing PARAMS ((bfd *, boolean));
static boolean elf32_avr_object_p PARAMS ((bfd *));
-/* Use RELA instead of REL */
-#undef USE_REL
-
static reloc_howto_type elf_avr_howto_table[] =
{
HOWTO (R_AVR_NONE, /* type */
@@ -722,6 +719,9 @@ elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -738,30 +738,9 @@ elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
const char * name = NULL;
int r_type;
+ /* This is a final link. */
r_type = ELF32_R_TYPE (rel->r_info);
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 = elf_avr_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
@@ -952,6 +931,7 @@ elf32_avr_object_p (abfd)
#define elf_backend_gc_sweep_hook elf32_avr_gc_sweep_hook
#define elf_backend_check_relocs elf32_avr_check_relocs
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define elf_backend_final_write_processing \
bfd_elf_avr_final_write_processing
#define elf_backend_object_p elf32_avr_object_p
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 063c7dd0ba..afe74bd71b 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -799,6 +799,9 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela * rel;
Elf_Internal_Rela * relend;
+ if (info->relocateable)
+ return true;
+
dynobj = elf_hash_table (info)->dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd);
symtab_hdr = & elf_tdata (input_bfd)->symtab_hdr;
@@ -833,29 +836,8 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_CRIS_GNU_VTENTRY)
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. */
+ r_symndx = ELF32_R_SYM (rel->r_info);
howto = cris_elf_howto_table + r_type;
h = NULL;
sym = NULL;
@@ -3113,6 +3095,7 @@ elf_cris_reloc_type_class (rela)
take the easy route. */
#define elf_backend_may_use_rel_p 0
#define elf_backend_may_use_rela_p 1
+#define elf_backend_rela_normal 1
#include "elf32-target.h"
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index 5f033efb7a..07453cf2bc 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -468,9 +468,6 @@ fr30_final_link_relocate (howto, input_bfd, input_section, contents, rel, reloca
}
/* Relocate an FR30 ELF section.
- There is some attempt to make this function usable for many architectures,
- both USE_REL and USE_RELA ['twould be nice if such a critter existed],
- if only to serve as a learning tool.
The RELOCATE_SECTION function is called by the new ELF backend linker
to handle the relocations for a section.
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 0c7be53367..48e2960998 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -429,6 +429,9 @@ elf32_h8_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -444,29 +447,9 @@ elf32_h8_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_vma relocation;
bfd_reloc_status_type r;
+ /* This is a final link. */
r_symndx = ELF32_R_SYM (rel->r_info);
r_type = ELF32_R_TYPE (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;
@@ -1465,6 +1448,7 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order,
/* Use an H8 specific linker, not the ELF generic linker. */
#define elf_backend_relocate_section elf32_h8_relocate_section
+#define elf_backend_rela_normal 1
/* And relaxing stuff. */
#define bfd_elf32_bfd_relax_section elf32_h8_relax_section
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 7a244eca30..ca62709872 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3610,6 +3610,9 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *rel;
Elf_Internal_Rela *relend;
+ if (info->relocateable)
+ return true;
+
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
htab = hppa_link_hash_table (info);
@@ -3641,27 +3644,8 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == (unsigned int) R_PARISC_GNU_VTINHERIT)
continue;
- r_symndx = ELF32_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 (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. */
+ r_symndx = ELF32_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
sym_sec = NULL;
@@ -4469,6 +4453,7 @@ elf32_hppa_elf_get_symbol_type (elf_sym, type)
#define elf_backend_plt_readonly 0
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 8
+#define elf_backend_rela_normal 1
#define TARGET_BIG_SYM bfd_elf32_hppa_vec
#define TARGET_BIG_NAME "elf32-hppa"
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index e0ec33c2b8..3ba50ba851 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -34,8 +34,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf-bfd.h"
#include "elf/i370.h"
-#define USE_RELA /* we want RELA relocations, not REL */
-
/* i370 relocations */
/* Note that there is really just one relocation that we currently
* support (and only one that we seem to need, at the moment), and
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index 82c7190d42..f8ab971051 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -831,9 +831,6 @@ i860_final_link_relocate (howto, input_bfd, input_section, contents, rel, reloca
/* Relocate an i860 ELF section.
This is boiler-plate code copied from fr30.
- There is some attempt to make this function usable for many architectures,
- both USE_REL and USE_RELA ['twould be nice if such a critter existed],
- if only to serve as a learning tool.
The RELOCATE_SECTION function is called by the new ELF backend linker
to handle the relocations for a section.
diff --git a/bfd/elf32-ip2k.c b/bfd/elf32-ip2k.c
index 42287f367a..bd5375c3c5 100644
--- a/bfd/elf32-ip2k.c
+++ b/bfd/elf32-ip2k.c
@@ -1711,9 +1711,6 @@ ip2k_final_link_relocate (howto, input_bfd, input_section, contents, rel,
}
/* Relocate a IP2K ELF section.
- There is some attempt to make this function usable for many architectures,
- both USE_REL and USE_RELA ['twould be nice if such a critter existed],
- if only to serve as a learning tool.
The RELOCATE_SECTION function is called by the new ELF backend linker
to handle the relocations for a section.
@@ -1760,6 +1757,9 @@ ip2k_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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;
@@ -1776,31 +1776,9 @@ ip2k_elf_relocate_section (output_bfd, info, input_bfd, input_section,
const char * name = NULL;
int r_type;
+ /* This is a final link. */
r_type = ELF32_R_TYPE (rel->r_info);
-
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 = ip2k_elf_howto_table + ELF32_R_TYPE (rel->r_info);
h = NULL;
sym = NULL;
@@ -1968,13 +1946,11 @@ ip2k_elf_gc_sweep_hook (abfd, info, sec, relocs)
#define ELF_MACHINE_CODE EM_IP2K
#define ELF_MAXPAGESIZE 1 /* No pages on the IP2K */
-#undef USE_REL
-#define USE_RELA
-
#define elf_info_to_howto_rel NULL
#define elf_info_to_howto ip2k_info_to_howto_rela
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define elf_backend_gc_mark_hook ip2k_elf_gc_mark_hook
#define elf_backend_gc_sweep_hook ip2k_elf_gc_sweep_hook
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 56c3f04746..a2e9e0baaf 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -931,8 +931,7 @@ m32r_elf_final_sda_base (output_bfd, info, error_message, psb)
/* Relocate an M32R/D ELF section.
There is some attempt to make this function usable for many architectures,
- both USE_REL and USE_RELA ['twould be nice if such a critter existed],
- if only to serve as a learning tool.
+ both for RELA and REL type relocs, if only to serve as a learning tool.
The RELOCATE_SECTION function is called by the new ELF backend linker
to handle the relocations for a section.
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 6c71418b4e..2c50ed08b7 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -180,8 +180,6 @@ reloc_type_lookup (abfd, code)
#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
#define ELF_ARCH bfd_arch_m68k
/* end code generated by elf.el */
-
-#define USE_RELA
/* Functions for the m68k ELF linker. */
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index e840e3b3ca..789f72508b 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -29,8 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf/mcore.h"
#include <assert.h>
-#define USE_RELA /* Only USE_REL is actually significant, but this is
- here are a reminder... */
+/* RELA relocs are used here... */
static void mcore_elf_howto_init
PARAMS ((void));
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index f0f8b8778f..7092110ac9 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -289,9 +289,6 @@ openrisc_final_link_relocate (howto, input_bfd, input_section, contents, rel,
}
/* Relocate an OpenRISC ELF section.
- There is some attempt to make this function usable for many architectures,
- both USE_REL and USE_RELA ['twould be nice if such a critter existed],
- if only to serve as a learning tool.
The RELOCATE_SECTION function is called by the new ELF backend linker
to handle the relocations for a section.
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 1745ef575d..4ce1c452c9 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf-bfd.h"
#include "elf/ppc.h"
-#define USE_RELA /* we want RELA relocations, not REL */
+/* RELA relocations are used here. */
static reloc_howto_type *ppc_elf_reloc_type_lookup
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index 5879995164..8067018dd8 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -71,8 +71,6 @@ static boolean elf_s390_finish_dynamic_sections
static boolean elf_s390_object_p PARAMS ((bfd *));
static boolean elf_s390_grok_prstatus PARAMS ((bfd *, Elf_Internal_Note *));
-#define USE_RELA 1 /* We want RELA relocations, not REL. */
-
#include "elf/s390.h"
/* The relocation "howto" table. */
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 38200dc04b..4c9b3d45aa 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -1117,6 +1117,9 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_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);
@@ -1159,28 +1162,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
}
howto = _bfd_sparc_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. */
+ r_symndx = ELF32_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
@@ -2147,5 +2130,6 @@ elf32_sparc_reloc_type_class (rela)
#define elf_backend_want_plt_sym 1
#define elf_backend_got_header_size 4
#define elf_backend_plt_header_size (4*PLT_ENTRY_SIZE)
+#define elf_backend_rela_normal 1
#include "elf32-target.h"
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 6762190cb9..07890c6a7c 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -1529,6 +1529,9 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
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);
@@ -1566,28 +1569,8 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
|| r_type == R_V850_GNU_VTINHERIT)
continue;
- howto = v850_elf_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. */
+ howto = v850_elf_howto_table + r_type;
h = NULL;
sym = NULL;
sec = NULL;
@@ -2208,6 +2191,7 @@ v850_elf_fake_sections (abfd, hdr, sec)
#define elf_backend_gc_sweep_hook v850_elf_gc_sweep_hook
#define elf_backend_can_gc_sections 1
+#define elf_backend_rela_normal 1
#define bfd_elf32_bfd_is_local_label_name v850_elf_is_local_label_name
#define bfd_elf32_bfd_reloc_type_lookup v850_elf_reloc_type_lookup
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index e7145f1222..068578bb24 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -341,8 +341,6 @@ reloc_type_lookup (abfd, code)
#define bfd_elf32_bfd_reloc_type_lookup reloc_type_lookup
#define ELF_ARCH bfd_arch_vax
/* end code generated by elf.el */
-
-#define USE_RELA
/* Functions for the VAX ELF linker. */
@@ -1419,6 +1417,9 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_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);
@@ -1450,28 +1451,8 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
}
howto = 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. */
+ r_symndx = ELF32_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
@@ -2208,5 +2189,6 @@ elf_vax_finish_dynamic_sections (output_bfd, info)
#define elf_backend_plt_readonly 1
#define elf_backend_want_plt_sym 0
#define elf_backend_got_header_size 16
+#define elf_backend_rela_normal 1
#include "elf32-target.h"
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index ada29d8db4..b845bc432f 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -709,9 +709,6 @@ xstormy16_elf_always_size_sections (output_bfd, info)
}
/* Relocate an XSTORMY16 ELF section.
- There is some attempt to make this function usable for many architectures,
- both USE_REL and USE_RELA ['twould be nice if such a critter existed],
- if only to serve as a learning tool.
The RELOCATE_SECTION function is called by the new ELF backend linker
to handle the relocations for a section.
diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c
index 7ebbb52dcc..aef822a02f 100644
--- a/bfd/elf64-hppa.c
+++ b/bfd/elf64-hppa.c
@@ -2724,7 +2724,7 @@ const struct elf_size_info hppa64_elf_size_info =
#define elf_backend_fake_sections elf_hppa_fake_sections
#define elf_backend_add_symbol_hook elf_hppa_add_symbol_hook
-#define elf_backend_relocate_section elf_hppa_relocate_section
+#define elf_backend_relocate_section elf_hppa_relocate_section
#define bfd_elf64_bfd_final_link elf_hppa_final_link
@@ -2770,6 +2770,7 @@ const struct elf_size_info hppa64_elf_size_info =
#define elf_backend_type_change_ok true
#define elf_backend_get_symbol_type elf64_hppa_elf_get_symbol_type
#define elf_backend_reloc_type_class elf64_hppa_reloc_type_class
+#define elf_backend_rela_normal 1
#include "elf64-target.h"
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 9ed037f527..b5c2ab1a64 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -30,9 +30,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf/ppc.h"
#include "elf64-ppc.h"
-#define USE_RELA /* we want RELA relocations, not REL. */
-
-
static void ppc_howto_init
PARAMS ((void));
static reloc_howto_type *ppc64_elf_reloc_type_lookup
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index 6e7b5d94c2..5f2a16e214 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -70,8 +70,6 @@ static boolean elf_s390_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static boolean elf_s390_object_p PARAMS ((bfd *));
-#define USE_RELA 1 /* We want RELA relocations, not REL. */
-
#include "elf/s390.h"
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index def93c41fe..764b0d75a9 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -1919,6 +1919,9 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_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);
@@ -1954,28 +1957,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
}
howto = sparc64_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. */
+ r_symndx = ELF64_R_SYM (rel->r_info);
h = NULL;
sym = NULL;
sec = NULL;
@@ -3171,6 +3154,7 @@ const struct elf_size_info sparc64_elf_size_info =
#define elf_backend_want_got_plt 0
#define elf_backend_plt_readonly 0
#define elf_backend_want_plt_sym 1
+#define elf_backend_rela_normal 1
/* Section 5.2.4 of the ABI specifies a 256-byte boundary for the table. */
#define elf_backend_plt_alignment 8
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 8016bd5efe..b6cce8eef9 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -26,9 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "elf/x86-64.h"
-/* We use only the RELA entries. */
-#define USE_RELA 1
-
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
#define MINUS_ONE (~ (bfd_vma) 0)
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 6c7616bb26..eda0a05d76 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -53,8 +53,6 @@
MIN_PLT Created by PLTOFF entries against dynamic symbols. This
does not reqire dynamic relocations. */
-#define USE_RELA /* we want RELA relocs, not REL */
-
#define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
typedef struct bfd_hash_entry *(*new_hash_entry_func)