From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17636 invoked by alias); 18 Aug 2011 16:41:10 -0000 Received: (qmail 17391 invoked by uid 22791); 18 Aug 2011 16:41:06 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_FX X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 18 Aug 2011 16:40:53 +0000 Received: (qmail 11463 invoked from network); 18 Aug 2011 16:40:52 -0000 Received: from unknown (HELO tp.orcam.me.uk) (macro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 18 Aug 2011 16:40:52 -0000 Date: Thu, 18 Aug 2011 16:41:00 -0000 From: "Maciej W. Rozycki" To: binutils@sourceware.org cc: gdb-patches@sourceware.org Subject: [PATCH] MIPS/BFD: Fix assertions with SGI IRIX files Message-ID: User-Agent: Alpine 1.10 (DEB 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00360.txt.bz2 Hello, If an SGI IRIX ELF variation binary (also produced by binutils for some target configurations) is loaded into GDB configured for the traditional MIPS ELF variation, then a load of assertion failures is spat. They actually come from BFD being confused. As no user input, however unreasonable, should ever trigger assertions and this is simply a case of an unsupported binary format, here's a fix to convert the offending code to do proper error reporting instead. Verified manually with GDB, the error messages are produced. I was unable to trigger this problem with the linker, even though this piece of code looks reachable within to me. OK to apply? 2011-08-18 Maciej W. Rozycki bfd/ * elfxx-mips.c (_bfd_mips_elf_symbol_processing): Replace assertions with warning messages. Maciej binutils-mips-sgi-err.diff Index: binutils-fsf-trunk-quilt/bfd/elfxx-mips.c =================================================================== --- binutils-fsf-trunk-quilt.orig/bfd/elfxx-mips.c 2011-08-03 14:02:30.000000000 +0100 +++ binutils-fsf-trunk-quilt/bfd/elfxx-mips.c 2011-08-03 14:04:07.000000000 +0100 @@ -6350,7 +6350,10 @@ _bfd_mips_elf_symbol_processing (bfd *ab { asection *section = bfd_get_section_by_name (abfd, ".text"); - BFD_ASSERT (SGI_COMPAT (abfd)); + if (!SGI_COMPAT (abfd)) + _bfd_error_handler (_("%B: Warning: SGI IRIX format special section " + "%s unsupported with the selected emulation"), + abfd, "MIPS_TEXT"); if (section != NULL) { asym->section = section; @@ -6366,7 +6369,10 @@ _bfd_mips_elf_symbol_processing (bfd *ab { asection *section = bfd_get_section_by_name (abfd, ".data"); - BFD_ASSERT (SGI_COMPAT (abfd)); + if (!SGI_COMPAT (abfd)) + _bfd_error_handler (_("%B: Warning: SGI IRIX format special section " + "%s unsupported with the selected emulation"), + abfd, "MIPS_DATA"); if (section != NULL) { asym->section = section;