This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

2.11.2 PATCH: Fix gas to allow GCC 3.0 to bootstrap on mips-sgi-irix5.3


As reported in

	http://sources.redhat.com/ml/binutils/2001-06/msg00752.html

GCC 3.0 for mips-sgi-irix5.3 doesn't bootstrap with gas 2.11.2.  Since that
request for help/suggestions evoked no response whatsoever, I analyzed the
problem myself, and (with lots of help from SGIs Dave Anderson) could trace
it to a combination of a dubious check in SGIs 32-bit ld and useless empty
sections emitted by gas.

As reported above, ld fails as soon as it tries to link gas-created object
files.  The error message is emitted because the last sections's offset

Offset     Size        Name

0x5594     0           .rela.rodata

starts at the object file size.  See the comment below for details.  The
following patch allows me to bootstrap GCC 3.0, so at least it fixes this
problem.

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE


Fri Jul 20 00:12:38 2001  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* elf32-mips.c (_bfd_mips_elf_fake_sections): Don't create .rela
	sections for the O32 ABI.

===================================================================
RCS file: bfd/RCS/elf32-mips.c,v
retrieving revision 1.1
diff -up -r1.1 bfd/elf32-mips.c
--- bfd/elf32-mips.c	2001/06/11 10:04:11	1.1
+++ bfd/elf32-mips.c	2001/07/20 22:45:18
@@ -3047,8 +3047,16 @@ _bfd_mips_elf_fake_sections (abfd, hdr, 
 
   /* The generic elf_fake_sections will set up REL_HDR using the
      default kind of relocations.  But, we may actually need both
-     kinds of relocations, so we set up the second header here.  */
-  if ((sec->flags & SEC_RELOC) != 0)
+     kinds of relocations, so we set up the second header here.
+
+     This is not necessary for the O32 ABI since that only uses Elf32_Rel
+     relocations (cf. System V ABI, MIPS RISC Processor Supplement,
+     3rd Edition, p. 4-17).  It breaks the IRIX 5/6 32-bit ld, since one
+     of the resulting empty .rela.<section> sections starts with
+     sh_offset == object size, and ld doesn't allow that.  While the check
+     is arguably bogus for empty or SHT_NOBITS sections, it can easily be
+     avoided by not emitting those useless sections in the first place.  */
+  if (IRIX_COMPAT (abfd) != ict_irix5 && (sec->flags & SEC_RELOC) != 0)
     {
       struct bfd_elf_section_data *esd;
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]