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]
Other format: [Raw text]

mips: don't duplicate options section


Linking a very complex non-IRIX MIPS ELF64 shared library, containing
many object files with their own options sections, some of them having
undergone ld -r, fails because not enough space was allocated in the
program headers for the options section.

It turns out that _bfd_mips_elf_additional_program_headers() only
allocates on additional header for the options section in IRIX 6
compatibility mode, but _bfd_mips_elf_modify_segment_map introduces a
separate segment for it regardless of IRIX 6 compatibility mode, so we
end up missing space for this additional segment.

This used not to be a problem back when we simply dropped options
sections, but this was fixed with:

2002-09-17  Stan Cox <scox@redhat.com>
[...]
	* elfxx-mips.c (_bfd_mips_elf_final_link): Always create
	.MIPS.options/.options section.

This patch fixes the problem such that we only introduce a separate
segment for the options section when IRIX 6 compatibility is enabled,
so that we don't run out of header space.  I'm not entirely sure we're
not duplicating the options section on IRIX 6, though.  Unfortunately,
our only IRIX box is having issues to come back up after the move, so
I couldn't test this myself.  However, since this patch preserves the
behavior on IRIX 6, I thought I'd submit it anyway.  Ok to install?

Index: bfd/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* elfxx-mips.c (_bfd_mips_elf_modify_segment_map): Don't move
	the options section into a separate section unless IRIX 6
	compatibility is enabled.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.27
diff -u -p -r1.27 elfxx-mips.c
--- bfd/elfxx-mips.c 13 Oct 2002 21:22:31 -0000 1.27
+++ bfd/elfxx-mips.c 19 Oct 2002 20:58:18 -0000
@@ -6135,7 +6135,12 @@ _bfd_mips_elf_modify_segment_map (abfd)
      .dynamic end up in PT_DYNAMIC.  However, we do have to insert a
      PT_OPTIONS segment immediately following the program header
      table.  */
-  if (NEWABI_P (abfd))
+  if (NEWABI_P (abfd)
+      /* On non-IRIX6 new abi, we'll have already created a segment
+	 for this section, so don't create another.  I'm not sure this
+	 is not also the case for IRIX 6, but I can't test it right
+	 now.  */
+      && IRIX_COMPAT (abfd) == ict_irix6)
     {
       for (s = abfd->sections; s; s = s->next)
 	if (elf_section_data (s)->this_hdr.sh_type == SHT_MIPS_OPTIONS)
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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