binutils is broken on ELF/MIPS

H . J . Lu hjl@lucon.org
Mon Jun 3 11:57:00 GMT 2002


On Mon, Jun 03, 2002 at 10:41:31AM -0700, H . J . Lu wrote:
> 
> Jakub, I believe your patch
> 
> http://sources.redhat.com/ml/binutils/2001-11/msg00580.html
> 
> breaks ELF/MIPS since it didn't modify ELF/MIPS to support relocating
> STT_SECTION sym in SHF_MERGE section. As the result, the ELF/MIPS
> linker generates incorrect debug information. Could you please look
> into it?
> 
> BTW, I don't know if ELF/MIPS is the only broken target.
> 
> Thanks.
> 
> 

This patch makes gdb 5.2 happy. However, I have no ideas if it is
correct. Could someone please take a look?

Thanks.


H.J.
---
2002-06-03  H.J. Lu <hjl@gnu.org>

	* elfxx-mips.c (mips_elf_calculate_relocation): Call
	_bfd_elf_rel_local_sym for STT_SECTION relocations against
	the SEC_MERGE section.

--- bfd/elfxx-mips.c.merge	Sat May 25 17:39:36 2002
+++ bfd/elfxx-mips.c	Mon Jun  3 11:52:49 2002
@@ -2086,6 +2086,17 @@ mips_elf_calculate_relocation (abfd, inp
       if (ELF_ST_TYPE (sym->st_info) != STT_SECTION)
 	symbol += sym->st_value;
 
+      if ((sec->flags & SEC_MERGE)
+	  && ELF_ST_TYPE (sym->st_info) == STT_SECTION)
+	{
+	  asection *msec;
+
+	  msec = sec;
+	  addend = _bfd_elf_rel_local_sym (abfd, sym, &msec, addend);
+	  addend -= symbol;
+	  addend += msec->output_section->vma + msec->output_offset;
+	}
+
       /* MIPS16 text labels should be treated as odd.  */
       if (sym->st_other == STO_MIPS16)
 	++symbol;



More information about the Binutils mailing list