This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
elf32-mips.c changes for ABI conformance
- To: binutils at sourceware dot cygnus dot com
- Subject: elf32-mips.c changes for ABI conformance
- From: "Maciej W. Rozycki" <macro at ds2 dot pg dot gda dot pl>
- Date: Fri, 3 Nov 2000 22:56:00 +0100 (MET)
- cc: Ralf Baechle <ralf at uni-koblenz dot de>, Ulf Carlsson <ulfc at engr dot sgi dot com>, Andreas Jaeger <aj at suse dot de>
- Organization: Technical University of Gdansk
Hi,
The MIPS ABI states that for dynamic relocations against local dynsym
symbols the symbol's value has to be added by the dynamic loader and not
the static linker, just like for external dynsym symbols. Please apply
the following patch.
binutils/bfd/ChangeLog:
2000-10-30 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* elf32-mips.c (mips_elf_create_dynamic_relocation): Undo patch
from 2000-10-13. Do not add the symbol's value for R_MIPS_REL32
relocations against dynsym symbols.
Maciej
--
+ Maciej W. Rozycki, Technical University of Gdansk, Poland +
+--------------------------------------------------------------+
+ e-mail: macro@ds2.pg.gda.pl, PGP key available +
diff -up --recursive --new-file binutils.macro/bfd/elf32-mips.c binutils/bfd/elf32-mips.c
--- binutils.macro/bfd/elf32-mips.c Sun Oct 15 03:25:28 2000
+++ binutils/bfd/elf32-mips.c Mon Oct 30 12:32:57 2000
@@ -192,7 +192,7 @@ static bfd_vma mips_elf_got16_entry
static boolean mips_elf_create_dynamic_relocation
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Rela *,
struct mips_elf_link_hash_entry *, asection *,
- bfd_vma, bfd_vma *, asection *, boolean local_p));
+ bfd_vma, bfd_vma *, asection *));
static void mips_elf_allocate_dynamic_relocations
PARAMS ((bfd *, unsigned int));
static boolean mips_elf_stub_section_p
@@ -5680,7 +5680,7 @@ mips_elf_next_relocation (r_type, reloca
static boolean
mips_elf_create_dynamic_relocation (output_bfd, info, rel, h, sec,
- symbol, addendp, input_section, local_p)
+ symbol, addendp, input_section)
bfd *output_bfd;
struct bfd_link_info *info;
const Elf_Internal_Rela *rel;
@@ -5689,7 +5689,6 @@ mips_elf_create_dynamic_relocation (outp
bfd_vma symbol;
bfd_vma *addendp;
asection *input_section;
- boolean local_p;
{
Elf_Internal_Rel outrel;
boolean skip;
@@ -5774,15 +5773,16 @@ mips_elf_create_dynamic_relocation (outp
/* The relocation we're building is section-relative.
Therefore, the original addend must be adjusted by the
section offset. */
- *addendp += symbol - sec->output_section->vma;
+ *addendp += section_offset;
/* Now, the relocation is just against the section. */
symbol = sec->output_section->vma;
}
- /* If the relocation is against a local symbol was previously an absolute
- relocation, we must adjust it by the value we give it in the dynamic
- symbol table. */
- if (local_p && r_type != R_MIPS_REL32)
+ /* If the relocation was previously an absolute relocation and
+ this symbol will not be referred to by the relocation, we must
+ adjust it by the value we give it in the dynamic symbol table.
+ Otherwise leave the job up to the dynamic linker. */
+ if (!indx && r_type != R_MIPS_REL32)
*addendp += symbol;
/* The relocation is always an REL32 relocation because we don't
@@ -6220,7 +6220,7 @@ mips_elf_calculate_relocation (abfd,
sec,
symbol,
&value,
- input_section, local_p))
+ input_section))
return false;
}
else