This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: ld segfault for powerpc-linux with CVS trunk
This cures the powerpc segfault, and fixes similar problems on other
targets that emit dynamic relocs against section symbols.
I also ripped out R_PPC_RELAX32 code that looks completely unnecessary.
I hope I'm not missing something here. Eric?
Oh, and I reckon that x86_64, cris, and probably other targets are
emitting dynamic relocs against section syms wrongly. See this comment
in elf32-ppc.c (probably where the wrong code came from originally, when
it didn't have a comment).
/* We are turning this relocation into one
against a section symbol. It would be
proper to subtract the symbol's value,
osec->vma, from the emitted reloc addend,
but ld.so expects buggy relocs. */
And also this code in glibc/sysdeps/powerpc/powerpc32/dl-machine.h
/* binutils on ppc32 includes st_value in r_addend for relocations
against local symbols. */
if (__builtin_expect (ELF32_ST_BIND (sym->st_info) == STB_LOCAL, 0)
&& sym->st_shndx != SHN_UNDEF)
value = map->l_addr;
else
other code that adds in sym->st_value
bfd/ChangeLog
* 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.
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.207
diff -u -p -r1.207 elf.c
--- bfd/elf.c 4 Nov 2003 10:41:51 -0000 1.207
+++ bfd/elf.c 5 Nov 2003 07:32:51 -0000
@@ -7368,9 +7368,10 @@ _bfd_elf_reloc_type_class (const Elf_Int
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;
}
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.118
diff -u -p -r1.118 elf-bfd.h
--- bfd/elf-bfd.h 4 Nov 2003 10:41:51 -0000 1.118
+++ bfd/elf-bfd.h 5 Nov 2003 07:32:43 -0000
@@ -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
Index: bfd/elf-hppa.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-hppa.h,v
retrieving revision 1.65
diff -u -p -r1.65 elf-hppa.h
--- bfd/elf-hppa.h 20 Aug 2003 08:37:19 -0000 1.65
+++ bfd/elf-hppa.h 5 Nov 2003 07:32:44 -0000
@@ -1346,7 +1346,7 @@ elf_hppa_relocate_section (bfd *output_b
/* 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. */
Index: bfd/elf-m10200.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10200.c,v
retrieving revision 1.22
diff -u -p -r1.22 elf-m10200.c
--- bfd/elf-m10200.c 25 Jun 2003 06:40:19 -0000 1.22
+++ bfd/elf-m10200.c 5 Nov 2003 07:32:44 -0000
@@ -373,7 +373,7 @@ mn10200_elf_relocate_section (output_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
{
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.42
diff -u -p -r1.42 elf-m10300.c
--- bfd/elf-m10300.c 4 Nov 2003 10:45:54 -0000 1.42
+++ bfd/elf-m10300.c 5 Nov 2003 07:32:47 -0000
@@ -1576,7 +1576,7 @@ mn10300_elf_relocate_section (output_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
{
Index: bfd/elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.114
diff -u -p -r1.114 elf32-arm.h
--- bfd/elf32-arm.h 3 Nov 2003 15:17:38 -0000 1.114
+++ bfd/elf32-arm.h 5 Nov 2003 07:32:53 -0000
@@ -2127,7 +2127,7 @@ elf32_arm_relocate_section (output_bfd,
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
Index: bfd/elf32-avr.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-avr.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-avr.c
--- bfd/elf32-avr.c 25 Jun 2003 06:40:22 -0000 1.14
+++ bfd/elf32-avr.c 5 Nov 2003 07:32:54 -0000
@@ -750,7 +750,7 @@ elf32_avr_relocate_section (output_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);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.44
diff -u -p -r1.44 elf32-cris.c
--- bfd/elf32-cris.c 3 Nov 2003 15:17:38 -0000 1.44
+++ bfd/elf32-cris.c 5 Nov 2003 07:32:55 -0000
@@ -847,7 +847,7 @@ cris_elf_relocate_section (output_bfd, i
{
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, i
{
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)
{
Index: bfd/elf32-fr30.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-fr30.c,v
retrieving revision 1.20
diff -u -p -r1.20 elf32-fr30.c
--- bfd/elf32-fr30.c 25 Jun 2003 06:40:21 -0000 1.20
+++ bfd/elf32-fr30.c 5 Nov 2003 07:32:55 -0000
@@ -552,7 +552,7 @@ fr30_elf_relocate_section (output_bfd, i
{
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);
Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.9
diff -u -p -r1.9 elf32-frv.c
--- bfd/elf32-frv.c 8 Oct 2003 17:57:59 -0000 1.9
+++ bfd/elf32-frv.c 5 Nov 2003 07:32:56 -0000
@@ -724,7 +724,7 @@ elf32_frv_relocate_section (output_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);
name = bfd_elf_string_from_elf_section
(input_bfd, symtab_hdr->sh_link, sym->st_name);
Index: bfd/elf32-h8300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-h8300.c,v
retrieving revision 1.32
diff -u -p -r1.32 elf32-h8300.c
--- bfd/elf32-h8300.c 15 Oct 2003 19:08:10 -0000 1.32
+++ bfd/elf32-h8300.c 5 Nov 2003 07:32:56 -0000
@@ -435,7 +435,7 @@ elf32_h8_relocate_section (bfd *output_b
{
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
{
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.107
diff -u -p -r1.107 elf32-hppa.c
--- bfd/elf32-hppa.c 4 Nov 2003 23:52:58 -0000 1.107
+++ bfd/elf32-hppa.c 5 Nov 2003 07:32:59 -0000
@@ -3439,7 +3439,7 @@ elf32_hppa_relocate_section (bfd *output
/* 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
{
Index: bfd/elf32-i370.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i370.c,v
retrieving revision 1.28
diff -u -p -r1.28 elf32-i370.c
--- bfd/elf32-i370.c 4 Jul 2003 01:50:12 -0000 1.28
+++ bfd/elf32-i370.c 5 Nov 2003 07:33:00 -0000
@@ -1210,7 +1210,7 @@ i370_elf_relocate_section (output_bfd, i
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, i
{
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)
{
Index: bfd/elf32-i860.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i860.c,v
retrieving revision 1.27
diff -u -p -r1.27 elf32-i860.c
--- bfd/elf32-i860.c 31 Aug 2003 18:25:09 -0000 1.27
+++ bfd/elf32-i860.c 5 Nov 2003 07:33:00 -0000
@@ -1104,7 +1104,7 @@ elf32_i860_relocate_section (bfd *output
{
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);
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.35
diff -u -p -r1.35 elf32-m32r.c
--- bfd/elf32-m32r.c 23 Sep 2003 00:40:48 -0000 1.35
+++ bfd/elf32-m32r.c 5 Nov 2003 07:33:02 -0000
@@ -1107,7 +1107,7 @@ m32r_elf_relocate_section (output_bfd, i
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
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.58
diff -u -p -r1.58 elf32-m68k.c
--- bfd/elf32-m68k.c 20 Aug 2003 08:37:17 -0000 1.58
+++ bfd/elf32-m68k.c 5 Nov 2003 07:33:03 -0000
@@ -1403,7 +1403,7 @@ elf_m68k_relocate_section (output_bfd, i
{
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, i
{
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)
{
Index: bfd/elf32-mcore.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-mcore.c,v
retrieving revision 1.29
diff -u -p -r1.29 elf32-mcore.c
--- bfd/elf32-mcore.c 23 Sep 2003 00:40:48 -0000 1.29
+++ bfd/elf32-mcore.c 5 Nov 2003 07:33:03 -0000
@@ -467,7 +467,7 @@ mcore_elf_relocate_section (output_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);
addend = rel->r_addend;
}
else
Index: bfd/elf32-msp430.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-msp430.c,v
retrieving revision 1.3
diff -u -p -r1.3 elf32-msp430.c
--- bfd/elf32-msp430.c 8 Aug 2003 10:14:50 -0000 1.3
+++ bfd/elf32-msp430.c 5 Nov 2003 07:33:03 -0000
@@ -449,7 +449,7 @@ elf32_msp430_relocate_section (output_bf
{
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);
Index: bfd/elf32-openrisc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-openrisc.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-openrisc.c
--- bfd/elf32-openrisc.c 25 Jun 2003 06:40:23 -0000 1.14
+++ bfd/elf32-openrisc.c 5 Nov 2003 07:33:04 -0000
@@ -375,7 +375,7 @@ openrisc_elf_relocate_section (output_bf
{
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);
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.103
diff -u -p -r1.103 elf32-ppc.c
--- bfd/elf32-ppc.c 4 Nov 2003 06:16:35 -0000 1.103
+++ bfd/elf32-ppc.c 5 Nov 2003 07:33:07 -0000
@@ -4715,7 +4715,7 @@ ppc_elf_relocate_section (bfd *output_bf
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_bf
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:
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.50
diff -u -p -r1.50 elf32-s390.c
--- bfd/elf32-s390.c 4 Nov 2003 06:16:35 -0000 1.50
+++ bfd/elf32-s390.c 5 Nov 2003 07:33:08 -0000
@@ -2325,7 +2325,7 @@ elf_s390_relocate_section (output_bfd, i
{
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
{
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.96
diff -u -p -r1.96 elf32-sh.c
--- bfd/elf32-sh.c 4 Nov 2003 06:16:35 -0000 1.96
+++ bfd/elf32-sh.c 5 Nov 2003 07:33:12 -0000
@@ -4805,7 +4805,7 @@ sh_elf_relocate_section (bfd *output_bfd
}
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)
Index: bfd/elf32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
retrieving revision 1.58
diff -u -p -r1.58 elf32-sparc.c
--- bfd/elf32-sparc.c 4 Nov 2003 06:16:35 -0000 1.58
+++ bfd/elf32-sparc.c 5 Nov 2003 07:33:14 -0000
@@ -2180,7 +2180,7 @@ elf32_sparc_relocate_section (output_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
{
@@ -2457,16 +2457,8 @@ elf32_sparc_relocate_section (output_bfd
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)
{
Index: bfd/elf32-v850.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-v850.c,v
retrieving revision 1.36
diff -u -p -r1.36 elf32-v850.c
--- bfd/elf32-v850.c 23 Sep 2003 00:40:48 -0000 1.36
+++ bfd/elf32-v850.c 5 Nov 2003 07:33:15 -0000
@@ -1681,7 +1681,7 @@ v850_elf_relocate_section (output_bfd, i
{
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;
Index: bfd/elf32-vax.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-vax.c,v
retrieving revision 1.14
diff -u -p -r1.14 elf32-vax.c
--- bfd/elf32-vax.c 20 Aug 2003 08:37:18 -0000 1.14
+++ bfd/elf32-vax.c 5 Nov 2003 07:33:16 -0000
@@ -1483,7 +1483,7 @@ elf_vax_relocate_section (output_bfd, in
{
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, in
{
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)
{
Index: bfd/elf32-xstormy16.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xstormy16.c,v
retrieving revision 1.22
diff -u -p -r1.22 elf32-xstormy16.c
--- bfd/elf32-xstormy16.c 25 Jun 2003 06:40:24 -0000 1.22
+++ bfd/elf32-xstormy16.c 5 Nov 2003 07:33:17 -0000
@@ -845,7 +845,7 @@ xstormy16_elf_relocate_section (output_b
{
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);
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.15
diff -u -p -r1.15 elf32-xtensa.c
--- bfd/elf32-xtensa.c 16 Oct 2003 15:25:54 -0000 1.15
+++ bfd/elf32-xtensa.c 5 Nov 2003 07:33:20 -0000
@@ -2004,7 +2004,7 @@ elf_xtensa_relocate_section (output_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
{
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.109
diff -u -p -r1.109 elf64-alpha.c
--- bfd/elf64-alpha.c 4 Nov 2003 06:16:35 -0000 1.109
+++ bfd/elf64-alpha.c 5 Nov 2003 07:33:23 -0000
@@ -4338,9 +4338,11 @@ elf64_alpha_relocate_section (output_bfd
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
&& !gotent->reloc_xlated)
{
struct alpha_elf_got_entry *ent;
- asection *msec;
for (ent = gotent; ent; ent = ent->next)
{
Index: bfd/elf64-mmix.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-mmix.c,v
retrieving revision 1.26
diff -u -p -r1.26 elf64-mmix.c
--- bfd/elf64-mmix.c 18 Oct 2003 15:42:40 -0000 1.26
+++ bfd/elf64-mmix.c 5 Nov 2003 07:33:25 -0000
@@ -1472,7 +1472,7 @@ mmix_elf_relocate_section (output_bfd, i
{
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);
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.136
diff -u -p -r1.136 elf64-ppc.c
--- bfd/elf64-ppc.c 4 Nov 2003 08:51:36 -0000 1.136
+++ bfd/elf64-ppc.c 5 Nov 2003 07:33:29 -0000
@@ -7391,7 +7391,7 @@ ppc64_elf_relocate_section (bfd *output_
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_
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;
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.51
diff -u -p -r1.51 elf64-s390.c
--- bfd/elf64-s390.c 4 Nov 2003 06:16:35 -0000 1.51
+++ bfd/elf64-s390.c 5 Nov 2003 07:33:31 -0000
@@ -2295,7 +2295,7 @@ elf_s390_relocate_section (output_bfd, i
{
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
{
Index: bfd/elf64-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sh64.c,v
retrieving revision 1.39
diff -u -p -r1.39 elf64-sh64.c
--- bfd/elf64-sh64.c 3 Nov 2003 15:17:39 -0000 1.39
+++ bfd/elf64-sh64.c 5 Nov 2003 07:33:33 -0000
@@ -1582,7 +1582,7 @@ sh_elf64_relocate_section (bfd *output_b
}
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)
Index: bfd/elf64-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.79
diff -u -p -r1.79 elf64-sparc.c
--- bfd/elf64-sparc.c 3 Nov 2003 15:17:39 -0000 1.79
+++ bfd/elf64-sparc.c 5 Nov 2003 07:33:35 -0000
@@ -2070,7 +2070,7 @@ sparc64_elf_relocate_section (output_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
{
@@ -2247,16 +2247,8 @@ sparc64_elf_relocate_section (output_bfd
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)
{
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.69
diff -u -p -r1.69 elf64-x86-64.c
--- bfd/elf64-x86-64.c 4 Nov 2003 06:16:35 -0000 1.69
+++ bfd/elf64-x86-64.c 5 Nov 2003 07:33:37 -0000
@@ -1821,7 +1821,7 @@ elf64_x86_64_relocate_section (bfd *outp
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 *outp
{
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)
{
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.107
diff -u -p -r1.107 elfxx-ia64.c
--- bfd/elfxx-ia64.c 4 Nov 2003 06:16:35 -0000 1.107
+++ bfd/elfxx-ia64.c 5 Nov 2003 07:33:39 -0000
@@ -3846,9 +3846,11 @@ elfNN_ia64_relocate_section (output_bfd,
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,
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)
{
--
Alan Modra
IBM OzLabs - Linux Technology Centre