summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog54
-rw-r--r--bfd/elf-bfd.h2
-rw-r--r--bfd/elf-hppa.h2
-rw-r--r--bfd/elf-m10200.c2
-rw-r--r--bfd/elf-m10300.c2
-rw-r--r--bfd/elf.c15
-rw-r--r--bfd/elf32-arm.h2
-rw-r--r--bfd/elf32-avr.c2
-rw-r--r--bfd/elf32-cris.c13
-rw-r--r--bfd/elf32-fr30.c2
-rw-r--r--bfd/elf32-frv.c2
-rw-r--r--bfd/elf32-h8300.c2
-rw-r--r--bfd/elf32-hppa.c2
-rw-r--r--bfd/elf32-i370.c13
-rw-r--r--bfd/elf32-i860.c2
-rw-r--r--bfd/elf32-m32r.c2
-rw-r--r--bfd/elf32-m68k.c13
-rw-r--r--bfd/elf32-mcore.c2
-rw-r--r--bfd/elf32-msp430.c2
-rw-r--r--bfd/elf32-openrisc.c2
-rw-r--r--bfd/elf32-ppc.c43
-rw-r--r--bfd/elf32-s390.c2
-rw-r--r--bfd/elf32-sh.c2
-rw-r--r--bfd/elf32-sparc.c14
-rw-r--r--bfd/elf32-v850.c2
-rw-r--r--bfd/elf32-vax.c13
-rw-r--r--bfd/elf32-xstormy16.c2
-rw-r--r--bfd/elf32-xtensa.c2
-rw-r--r--bfd/elf64-alpha.c5
-rw-r--r--bfd/elf64-mmix.c2
-rw-r--r--bfd/elf64-ppc.c6
-rw-r--r--bfd/elf64-s390.c2
-rw-r--r--bfd/elf64-sh64.c2
-rw-r--r--bfd/elf64-sparc.c14
-rw-r--r--bfd/elf64-x86-64.c13
-rw-r--r--bfd/elfxx-ia64.c5
36 files changed, 114 insertions, 153 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7968601fca..d606e9b20c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,59 @@
2003-11-05 Alan Modra <amodra@bigpond.net.au>
+ * elf.c (_bfd_elf_rela_local_sym): Accept asection **, and return
+ updated section in case of merged section.
+ * elf-bfd.h (_bfd_elf_rela_local_sym): Update declaration.
+ * elf-hppa.h (elf_hppa_relocate_section): Adjust call.
+ * elf-m10200.c (mn10200_elf_relocate_section): Likewise.
+ * elf-m10300.c (mn10300_elf_relocate_section): Likewise.
+ * elf32-arm.h (elf32_arm_relocate_section): Likewise.
+ * elf32-avr.c (elf32_avr_relocate_section): Likewise.
+ * elf32-cris.c (cris_elf_relocate_section): Likewise.
+ * elf32-fr30.c (fr30_elf_relocate_section): Likewise.
+ * elf32-frv.c (elf32_frv_relocate_section): Likewise.
+ * elf32-h8300.c (elf32_h8_relocate_section): Likewise.
+ * elf32-hppa.c (elf32_hppa_relocate_section): Likewise.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-i860.c (elf32_i860_relocate_section): Likewise.
+ * elf32-m32r.c (m32r_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-mcore.c (mcore_elf_relocate_section): Likewise.
+ * elf32-msp430.c (elf32_msp430_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-sh.c (sh_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.
+ * elf32-xstormy16.c (xstormy16_elf_relocate_section): Likewise.
+ * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
+ * elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
+ * elf64-mmix.c (mmix_elf_relocate_section): Likewise.
+ * elf64-ppc.c (ppc64_elf_relocate_section): Likewise.
+ * elf64-s390.c (elf_s390_relocate_section): Likewise.
+ * elf64-sh64.c (sh_elf64_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+ * elfxx-ia64.c (elfNN_ia64_relocate_section): Likewise.
+
+ * elf32-cris.c (cris_elf_relocate_section): Don't recalculate symbol
+ section for reloc output.
+ * elf32-i370.c (i370_elf_relocate_section): Likewise.
+ * elf32-m68k.c (elf_m68k_relocate_section): Likewise.
+ * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
+ * elf32-vax.c (elf_vax_relocate_section): Likewise.
+ * elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
+ * elf64-x86-64.c (elf64_x86_64_relocate_section): Likewise.
+
+ * elf32-ppc.c (ppc_elf_relocate_section): Don't recalculate everything
+ for R_PPC_RELAX32 reloc. Don't bother checking ppc_elf_install_value
+ return value.
+ * elf64-ppc.c (ppc64_elf_relocate_section <R_PPC64_TOC>): Sanity check
+ sec->id.
+
+2003-11-05 Alan Modra <amodra@bigpond.net.au>
+
* elf32-d10v.c (extract_rel_addend, insert_rel_addend): New functions.
(elf32_d10v_relocate_section): Use them to handle -r reloc
adjustments, and in place of _bfd_elf_rela_local_sym.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 8059b4e244..d5965d3ffb 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1295,7 +1295,7 @@ extern void _bfd_elf_fprintf_vma
extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
(const Elf_Internal_Rela *);
extern bfd_vma _bfd_elf_rela_local_sym
- (bfd *, Elf_Internal_Sym *, asection *, Elf_Internal_Rela *);
+ (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *);
extern bfd_vma _bfd_elf_rel_local_sym
(bfd *, Elf_Internal_Sym *, asection **, bfd_vma);
extern bfd_vma _bfd_elf_section_offset
diff --git a/bfd/elf-hppa.h b/bfd/elf-hppa.h
index bdd7a7471e..0f15b0de33 100644
--- a/bfd/elf-hppa.h
+++ b/bfd/elf-hppa.h
@@ -1346,7 +1346,7 @@ elf_hppa_relocate_section (bfd *output_bfd,
/* This is a local symbol. */
sym = local_syms + r_symndx;
sym_sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
/* If this symbol has an entry in the PA64 dynamic hash
table, then get it. */
diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c
index 09d7d993ba..7373dc054c 100644
--- a/bfd/elf-m10200.c
+++ b/bfd/elf-m10200.c
@@ -373,7 +373,7 @@ mn10200_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c
index 19ba0d2bad..8f69c529e5 100644
--- a/bfd/elf-m10300.c
+++ b/bfd/elf-m10300.c
@@ -1576,7 +1576,7 @@ mn10300_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
diff --git a/bfd/elf.c b/bfd/elf.c
index e9db1a0305..e008cb7bd6 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -7368,9 +7368,10 @@ _bfd_elf_reloc_type_class (const Elf_Internal_Rela *rela ATTRIBUTE_UNUSED)
bfd_vma
_bfd_elf_rela_local_sym (bfd *abfd,
Elf_Internal_Sym *sym,
- asection *sec,
+ asection **psec,
Elf_Internal_Rela *rel)
{
+ asection *sec = *psec;
bfd_vma relocation;
relocation = (sec->output_section->vma
@@ -7380,16 +7381,14 @@ _bfd_elf_rela_local_sym (bfd *abfd,
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
&& sec->sec_info_type == ELF_INFO_TYPE_MERGE)
{
- asection *msec;
-
- msec = sec;
rel->r_addend =
- _bfd_merged_section_offset (abfd, &msec,
+ _bfd_merged_section_offset (abfd, psec,
elf_section_data (sec)->sec_info,
sym->st_value + rel->r_addend,
- 0)
- - relocation;
- rel->r_addend += msec->output_section->vma + msec->output_offset;
+ 0);
+ sec = *psec;
+ rel->r_addend -= relocation;
+ rel->r_addend += sec->output_section->vma + sec->output_offset;
}
return relocation;
}
diff --git a/bfd/elf32-arm.h b/bfd/elf32-arm.h
index a42f75a5c5..efb713cbc2 100644
--- a/bfd/elf32-arm.h
+++ b/bfd/elf32-arm.h
@@ -2127,7 +2127,7 @@ elf32_arm_relocate_section (output_bfd, info, input_bfd, input_section,
bfd_put_32 (input_bfd, value, contents + rel->r_offset);
}
#else
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
#endif
}
else
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index defa9ce453..44f2b38167 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -750,7 +750,7 @@ elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf32-cris.c b/bfd/elf32-cris.c
index 762101a29d..e145b26b43 100644
--- a/bfd/elf32-cris.c
+++ b/bfd/elf32-cris.c
@@ -847,7 +847,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
symname = (bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name));
@@ -1292,16 +1292,7 @@ cris_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
long indx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
diff --git a/bfd/elf32-fr30.c b/bfd/elf32-fr30.c
index c4e2290896..472a07a92b 100644
--- a/bfd/elf32-fr30.c
+++ b/bfd/elf32-fr30.c
@@ -552,7 +552,7 @@ fr30_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf32-frv.c b/bfd/elf32-frv.c
index 582b0dea95..5157f407f4 100644
--- a/bfd/elf32-frv.c
+++ b/bfd/elf32-frv.c
@@ -724,7 +724,7 @@ elf32_frv_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c
index 3dc8ad70a7..452db27f63 100644
--- a/bfd/elf32-h8300.c
+++ b/bfd/elf32-h8300.c
@@ -435,7 +435,7 @@ elf32_h8_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c
index 5d60428661..1fab847bc4 100644
--- a/bfd/elf32-hppa.c
+++ b/bfd/elf32-hppa.c
@@ -3439,7 +3439,7 @@ elf32_hppa_relocate_section (bfd *output_bfd,
/* This is a local symbol, h defaults to NULL. */
sym = local_syms + r_symndx;
sym_sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sym_sec, rel);
}
else
{
diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c
index 4a06ac08fa..b4d305dc16 100644
--- a/bfd/elf32-i370.c
+++ b/bfd/elf32-i370.c
@@ -1210,7 +1210,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
sec = local_sections[r_symndx];
sym_name = "<local symbol>";
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
addend = rel->r_addend;
}
else
@@ -1363,16 +1363,7 @@ i370_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
long indx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
diff --git a/bfd/elf32-i860.c b/bfd/elf32-i860.c
index 209cbe6554..8ab3c9251c 100644
--- a/bfd/elf32-i860.c
+++ b/bfd/elf32-i860.c
@@ -1104,7 +1104,7 @@ elf32_i860_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf32-m32r.c b/bfd/elf32-m32r.c
index 257a68cc7d..7500f56e33 100644
--- a/bfd/elf32-m32r.c
+++ b/bfd/elf32-m32r.c
@@ -1107,7 +1107,7 @@ m32r_elf_relocate_section (output_bfd, info, input_bfd, input_section,
sec = local_sections[r_symndx];
sym_name = "<local symbol>";
#if !USE_REL
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
addend = rel->r_addend;
#else
/* FIXME: This won't handle local relocations against SEC_MERGE
diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c
index 7688bfd9fc..849bfe8fb1 100644
--- a/bfd/elf32-m68k.c
+++ b/bfd/elf32-m68k.c
@@ -1403,7 +1403,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
@@ -1657,16 +1657,7 @@ elf_m68k_relocate_section (output_bfd, info, input_bfd, input_section,
{
long indx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
diff --git a/bfd/elf32-mcore.c b/bfd/elf32-mcore.c
index 59c5840d45..6992a3d410 100644
--- a/bfd/elf32-mcore.c
+++ b/bfd/elf32-mcore.c
@@ -467,7 +467,7 @@ mcore_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
addend = rel->r_addend;
}
else
diff --git a/bfd/elf32-msp430.c b/bfd/elf32-msp430.c
index b09ef873cb..306a79889b 100644
--- a/bfd/elf32-msp430.c
+++ b/bfd/elf32-msp430.c
@@ -449,7 +449,7 @@ elf32_msp430_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf32-openrisc.c b/bfd/elf32-openrisc.c
index a9b6d1d235..62f86d419a 100644
--- a/bfd/elf32-openrisc.c
+++ b/bfd/elf32-openrisc.c
@@ -375,7 +375,7 @@ openrisc_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 1b10e5682c..71a5d45421 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -4715,7 +4715,7 @@ ppc_elf_relocate_section (bfd *output_bfd,
sec = local_sections[r_symndx];
sym_name = bfd_elf_local_sym_name (input_bfd, sym);
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
@@ -5441,44 +5441,9 @@ ppc_elf_relocate_section (bfd *output_bfd,
break;
case R_PPC_RELAX32:
- {
- unsigned long r_symndx;
- Elf_Internal_Sym *sym;
- asection *sym_sec;
- bfd_byte *hit_addr = 0;
- bfd_vma value = 0;
-
- r_symndx = ELF32_R_SYM (rel->r_info);
-
- if (r_symndx < symtab_hdr->sh_info)
- {
- sym = local_syms + r_symndx;
- sym_sec = local_sections[r_symndx];
-
- value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
- }
- else
- {
- bfd_boolean warned;
- bfd_boolean unresolved_reloc;
-
- RELOC_FOR_GLOBAL_SYMBOL (h, elf_sym_hashes (input_bfd),
- r_symndx, symtab_hdr,
- value, sym_sec,
- unresolved_reloc, info,
- warned);
- if (warned)
- continue;
- }
- hit_addr = contents + rel->r_offset;
- value += rel->r_addend;
-
- r = ppc_elf_install_value (output_bfd, hit_addr, value, r_type);
- if (r != bfd_reloc_ok)
- break;
- else
- continue;
- }
+ ppc_elf_install_value (output_bfd, contents + rel->r_offset,
+ relocation + addend, r_type);
+ continue;
/* Indirect .sdata relocation. */
case R_PPC_EMB_SDAI16:
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index f594189d81..80a753ac9d 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -2325,7 +2325,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 34036e5284..9ffd05ba50 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -4805,7 +4805,7 @@ sh_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
}
else if (! howto->partial_inplace)
{
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
addend = rel->r_addend;
}
else if ((sec->flags & SEC_MERGE)
diff --git a/bfd/elf32-sparc.c b/bfd/elf32-sparc.c
index 85a2a2fe04..ea3a9b139b 100644
--- a/bfd/elf32-sparc.c
+++ b/bfd/elf32-sparc.c
@@ -2180,7 +2180,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
@@ -2457,16 +2457,8 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
if (is_plt)
sec = htab->splt;
- else if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index e2b80126f9..fb290eb378 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -1681,7 +1681,7 @@ v850_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
#if 0
{
char * name;
diff --git a/bfd/elf32-vax.c b/bfd/elf32-vax.c
index 7d78e0ff3b..5d729effaf 100644
--- a/bfd/elf32-vax.c
+++ b/bfd/elf32-vax.c
@@ -1483,7 +1483,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
@@ -1737,16 +1737,7 @@ elf_vax_relocate_section (output_bfd, info, input_bfd, input_section,
{
long indx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c
index af9a04882f..1377ff2517 100644
--- a/bfd/elf32-xstormy16.c
+++ b/bfd/elf32-xstormy16.c
@@ -845,7 +845,7 @@ xstormy16_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 5cf45b615a..31adf3baff 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -2004,7 +2004,7 @@ elf_xtensa_relocate_section (output_bfd, info, input_bfd,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c
index 4933d28dab..ac16fb55e7 100644
--- a/bfd/elf64-alpha.c
+++ b/bfd/elf64-alpha.c
@@ -4338,9 +4338,11 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
if (r_symndx < symtab_hdr->sh_info)
{
+ asection *msec;
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- value = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ msec = sec;
+ value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
/* If this is a tp-relative relocation against sym 0,
this is hackery from relax_section. Force the value to
@@ -4368,7 +4370,6 @@ elf64_alpha_relocate_section (output_bfd, info, input_bfd, input_section,
&& !gotent->reloc_xlated)
{
struct alpha_elf_got_entry *ent;
- asection *msec;
for (ent = gotent; ent; ent = ent->next)
{
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index 5960e32580..6440dcb9b5 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -1472,7 +1472,7 @@ mmix_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections [r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 4024a94e35..8ae3f12ed8 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7391,7 +7391,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
sec = local_sections[r_symndx];
sym_name = bfd_elf_local_sym_name (input_bfd, sym);
sym_type = ELF64_ST_TYPE (sym->st_info);
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
if (elf_section_data (sec) != NULL)
{
long *opd_sym_adjust;
@@ -8184,7 +8184,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
relocation = TOCstart;
if (r_symndx == 0)
relocation += htab->stub_group[input_section->id].toc_off;
- else if (sec != NULL && !unresolved_reloc)
+ else if (unresolved_reloc)
+ ;
+ else if (sec != NULL && sec->id <= htab->top_id)
relocation += htab->stub_group[sec->id].toc_off;
else
unresolved_reloc = TRUE;
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index a55a191c3e..6e72ced5c6 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -2295,7 +2295,7 @@ elf_s390_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index f7d1afff6d..db096a53fb 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -1582,7 +1582,7 @@ sh_elf64_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
}
else if (! howto->partial_inplace)
{
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
relocation |= ((sym->st_other & STO_SH5_ISA32) != 0);
}
else if ((sec->flags & SEC_MERGE)
diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c
index 8c99477fdf..92609e2397 100644
--- a/bfd/elf64-sparc.c
+++ b/bfd/elf64-sparc.c
@@ -2070,7 +2070,7 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
{
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
@@ -2247,16 +2247,8 @@ sparc64_elf_relocate_section (output_bfd, info, input_bfd, input_section,
if (is_plt)
sec = splt;
- else if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+
+ if (bfd_is_abs_section (sec))
indx = 0;
else if (sec == NULL || sec->owner == NULL)
{
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 44e60e8997..4cfcba506d 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1821,7 +1821,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
sym = local_syms + r_symndx;
sec = local_sections[r_symndx];
- relocation = _bfd_elf_rela_local_sym (output_bfd, sym, sec, rel);
+ relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel);
}
else
{
@@ -2046,16 +2046,7 @@ elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
{
long sindx;
- if (h == NULL)
- sec = local_sections[r_symndx];
- else
- {
- BFD_ASSERT (h->root.type == bfd_link_hash_defined
- || (h->root.type
- == bfd_link_hash_defweak));
- sec = h->root.u.def.section;
- }
- if (sec != NULL && bfd_is_abs_section (sec))
+ if (bfd_is_abs_section (sec))
sindx = 0;
else if (sec == NULL || sec->owner == NULL)
{
diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c
index 8fae4eefa6..24d607956d 100644
--- a/bfd/elfxx-ia64.c
+++ b/bfd/elfxx-ia64.c
@@ -3846,9 +3846,11 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
if (r_symndx < symtab_hdr->sh_info)
{
/* Reloc against local symbol. */
+ asection *msec;
sym = local_syms + r_symndx;
sym_sec = local_sections[r_symndx];
- value = _bfd_elf_rela_local_sym (output_bfd, sym, sym_sec, rel);
+ msec = sym_sec;
+ value = _bfd_elf_rela_local_sym (output_bfd, sym, &msec, rel);
if ((sym_sec->flags & SEC_MERGE)
&& ELF_ST_TYPE (sym->st_info) == STT_SECTION
&& sym_sec->sec_info_type == ELF_INFO_TYPE_MERGE)
@@ -3859,7 +3861,6 @@ elfNN_ia64_relocate_section (output_bfd, info, input_bfd, input_section,
if (loc_h && ! loc_h->sec_merge_done)
{
struct elfNN_ia64_dyn_sym_info *dynent;
- asection *msec;
for (dynent = loc_h->info; dynent; dynent = dynent->next)
{
OpenPOWER on IntegriCloud