linux-mips
[Top] [All Lists]

RE: objcopy error -- was RE: your mail

To: John Van Horne <JohnVan.Horne@cosinecom.com>
Subject: RE: objcopy error -- was RE: your mail
From: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Date: Fri, 5 Jan 2001 12:55:41 +0100 (MET)
Cc: "'linux-mips@oss.sgi.com'" <linux-mips@oss.sgi.com>
In-reply-to: <7EB7C6B62C4FD41196A80090279A29113D7357@exchsrv1.cosinecom.com>
Organization: Technical University of Gdansk
Sender: owner-linux-mips@oss.sgi.com
On Thu, 4 Jan 2001, John Van Horne wrote:

> This is the same script that worked fine when we were using 
> egcs-mips-linux-1.0.3a and binutils-mips-linux-2.8.1.  Have
> there been any changes in the linker that would affect how
> we write our linker script?

 It's possible the linker emits unnecessary sections.  Try the following
patch to see if it helps.

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

2000-11-30  Ralf Baechle  <ralf@gnu.org>

        * elf32-mips.c (elf32_mips_merge_private_bfd_data): Always permit
        BFDs containing no sections or empty .text, .data or .bss sections
        to be merged, regardless of their flags.

diff -urN binutils-cygnus/bfd/elf32-mips.c binutils/bfd/elf32-mips.c
--- binutils-cygnus/bfd/elf32-mips.c    Sat Oct 14 14:21:14 2000
+++ binutils/bfd/elf32-mips.c   Thu Nov 30 16:13:09 2000
@@ -2475,6 +2475,8 @@
   flagword old_flags;
   flagword new_flags;
   boolean ok;
+  boolean null_input_bfd = true;
+  asection *sec;
 
   /* Check if we have the same endianess */
   if (_bfd_generic_verify_endian_match (ibfd, obfd) == false)
@@ -2512,6 +2514,27 @@
   old_flags &= ~EF_MIPS_NOREORDER;
 
   if (new_flags == old_flags)
+    return true;
+
+  /* Check to see if the input BFD actually contains any sections.
+     If not, its flags may not have been initialised either, but it cannot
+     actually cause any incompatibility.  */
+  for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+    {
+      /* Ignore synthetic sections and empty .text, .data and .bss sections
+         which are automatically generated by gas.  */
+      if (strcmp (sec->name, ".reginfo")
+         && strcmp (sec->name, ".mdebug")
+         && ((!strcmp (sec->name, ".text")
+              || !strcmp (sec->name, ".data")
+              || !strcmp (sec->name, ".bss"))
+             && sec->_raw_size != 0))
+       {
+         null_input_bfd = false;
+         break;
+       }
+    }
+  if (null_input_bfd)
     return true;
 
   ok = true;


<Prev in Thread] Current Thread [Next in Thread>