public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: Michael Matz <matz@suse.de>
Cc: binutils@sources.redhat.com
Subject: Re: PATCH: Fix alpha relocation overflow (Re: PATCH: Add _bfd_elf_provide_symbol)
Date: Mon, 25 Apr 2005 17:46:00 -0000	[thread overview]
Message-ID: <20050425174359.GA2592@lucon.org> (raw)
In-Reply-To: <20050425172736.GA2235@lucon.org>

On Mon, Apr 25, 2005 at 10:27:36AM -0700, H. J. Lu wrote:
> On Mon, Apr 25, 2005 at 05:17:24PM +0200, Michael Matz wrote:
> > > Do you have a simple testcase for alpha which I can run on Linux/i386?
> > 
> > I've packed together the elf-init.oS file from the system, a small c file 
> > providing some symbols needed from that .oS, and this file precompiled for 
> > alpha.  So you should be able to reproduce the problem with:
> > 
> > % ld elf-init.oS a.o
> > 
> > with a cross linker.  This will of course not create a functioning 
> > executable, but will demonstrate the linking error.  With my patch this 
> > works.  Hope this helps.
> > 
> 
> How about this patch?
> 
> 

Wrong patch. This is the updated one.


H.J.
----
2005-04-25  H.J. Lu  <hongjiu.lu@intel.com>

	* emultempl/elf32.em (gld${EMULATION_NAME}_provide_bound_symbols):
	Use the first SEC_ALLOC section which isn't SEC_CODE or the
	last SEC_CODE section if the section doesn't exist.

--- ld/emultempl/elf32.em.alpha	2005-04-25 09:24:59.000000000 -0700
+++ ld/emultempl/elf32.em	2005-04-25 10:41:25.000000000 -0700
@@ -1463,8 +1463,21 @@ gld${EMULATION_NAME}_provide_bound_symbo
     }
   else
     {
+      /* We have to choose those values very carefully.  Some targets,
+	 like alpha, may have relocation overflow with 0.  We use the
+	 first SEC_ALLOC section which isn't SEC_CODE or the last
+	 SEC_CODE section.   */
       start_val = 0;
-      end_val = 0;
+      for (s = output_bfd->sections; s != NULL; s = s->next)
+	{
+	  if ((s->flags & SEC_ALLOC) != 0)
+	    {
+	      start_val = s->vma;
+	      if ((s->flags & SEC_CODE) == 0)
+		break;
+	    }
+	}
+      end_val = start_val;
     }
   _bfd_elf_provide_symbol (&link_info, start, start_val);
   _bfd_elf_provide_symbol (&link_info, end, end_val);

  reply	other threads:[~2005-04-25 17:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-21 15:42 Yet another unnecessary powerpc section Alan Modra
2005-03-22  8:16 ` Alan Modra
2005-03-22 11:48   ` H. J. Lu
2005-03-22 12:06     ` Alan Modra
2005-03-22 17:37       ` PATCH: Add _bfd_elf_provide_symbol H. J. Lu
2005-03-23  4:19         ` H. J. Lu
2005-03-23  5:37           ` H. J. Lu
2005-03-23  9:28             ` Alan Modra
2005-03-23  9:31               ` Daniel Jacobowitz
2005-03-23  9:33                 ` H. J. Lu
2005-04-25  4:53                   ` Michael Matz
2005-04-25 14:55                     ` H. J. Lu
2005-04-25 15:17                       ` Michael Matz
2005-04-25 17:31                         ` PATCH: Fix alpha relocation overflow (Re: PATCH: Add _bfd_elf_provide_symbol) H. J. Lu
2005-04-25 17:46                           ` H. J. Lu [this message]
2005-04-26 12:01                             ` Michael Matz
2005-04-26 13:47                               ` H. J. Lu
2005-04-27 19:35                                 ` H. J. Lu
2005-05-03  1:27                                   ` Alan Modra
2005-05-03  1:35                                     ` H. J. Lu
2005-05-03  5:31                                       ` Alan Modra
2005-05-03 21:40                                         ` H. J. Lu
2005-05-04  6:18                                           ` Alan Modra
2005-05-04  6:50                                             ` H. J. Lu
2005-05-04 10:17                                               ` Alan Modra

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=20050425174359.GA2592@lucon.org \
    --to=hjl@lucon.org \
    --cc=binutils@sources.redhat.com \
    --cc=matz@suse.de \
    /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).