public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: "David S. Miller" <dm@neteng.engr.sgi.com>
To: gas2@cygnus.com
Subject: BFD_ASSERT failure in elf32-mips.c with possible fix
Date: Fri, 09 Aug 1996 06:46:00 -0000	[thread overview]
Message-ID: <199608091345.GAA14227@neteng.engr.sgi.com> (raw)

The following c-torture case:

extern int abort();
typedef int (*frob)();
frob f[] = {abort};
main()
{
  exit(0);
}

Caused GNU ld to fail the assertion on line 5214 in
mips_elf_adjust_dynamic_symbol  The following diff make
the problem go away for me, but the fix may not be correct.

*** elf32-mips.c.~1~	Wed Jul 24 16:11:13 1996
--- elf32-mips.c	Fri Aug  9 06:31:44 1996
***************
*** 5107,5154 ****
  	  if ((info->shared || h != NULL)
  	      && (sec->flags & SEC_ALLOC) != 0)
  	    {
! 	      if (info->shared)
  		{
! 		  /* When creating a shared object, we must copy these
! 		     reloc types into the output file as R_MIPS_REL32
! 		     relocs.  We create the .rel.dyn reloc section in
! 		     dynobj and make room for this reloc.  */
  		  if (sreloc == NULL)
  		    {
! 		      const char *name = ".rel.dyn";
  
! 		      sreloc = bfd_get_section_by_name (dynobj, name);
! 		      if (sreloc == NULL)
! 			{
! 			  sreloc = bfd_make_section (dynobj, name);
! 			  if (sreloc == NULL
! 			      || ! bfd_set_section_flags (dynobj, sreloc,
! 							  (SEC_ALLOC
! 							   | SEC_LOAD
! 							   | SEC_HAS_CONTENTS
! 							   | SEC_IN_MEMORY
! 							   | SEC_READONLY))
! 			      || ! bfd_set_section_alignment (dynobj, sreloc,
! 							      4))
! 			    return false;
! 
! 			  /* Add a null element. */
! 			  sreloc->_raw_size += sizeof (Elf32_External_Rel);
! 			  ++sreloc->reloc_count;
! 			}
  		    }
- 
- 		  sreloc->_raw_size += sizeof (Elf32_External_Rel);
  		}
- 	      else
- 		{
- 		  struct mips_elf_link_hash_entry *hmips;
  
! 		  /* We only need to copy this reloc if the symbol is
!                      defined in a dynamic object.  */
! 		  hmips = (struct mips_elf_link_hash_entry *) h;
! 		  ++hmips->mips_32_relocs;
! 		}
  	    }
  
  	  if (SGI_COMPAT (abfd))
--- 5107,5142 ----
  	  if ((info->shared || h != NULL)
  	      && (sec->flags & SEC_ALLOC) != 0)
  	    {
! 	      /* When creating a shared object, we must copy these
! 		 reloc types into the output file as R_MIPS_REL32
! 		 relocs.  We create the .rel.dyn reloc section in
! 		 dynobj and make room for this reloc.  */
! 	      if (sreloc == NULL)
  		{
! 		  const char *name = ".rel.dyn";
! 
! 		  sreloc = bfd_get_section_by_name (dynobj, name);
  		  if (sreloc == NULL)
  		    {
! 		      sreloc = bfd_make_section (dynobj, name);
! 		      if (sreloc == NULL
! 			  || ! bfd_set_section_flags (dynobj, sreloc,
! 						      (SEC_ALLOC
! 						       | SEC_LOAD
! 						       | SEC_HAS_CONTENTS
! 						       | SEC_IN_MEMORY
! 						       | SEC_READONLY))
! 			  || ! bfd_set_section_alignment (dynobj, sreloc,
! 							  4))
! 			return false;
  
! 		      /* Add a null element. */
! 		      sreloc->_raw_size += sizeof (Elf32_External_Rel);
! 		      ++sreloc->reloc_count;
  		    }
  		}
  
! 	      sreloc->_raw_size += sizeof (Elf32_External_Rel);
  	    }
  
  	  if (SGI_COMPAT (abfd))


             reply	other threads:[~1996-08-09  6:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-09  6:46 David S. Miller [this message]
1996-08-09  9:44 ` Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199608091345.GAA14227@neteng.engr.sgi.com \
    --to=dm@neteng.engr.sgi.com \
    --cc=gas2@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).