public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: Jim Wilson <wilson@specifixinc.com>
Cc: binutils@sources.redhat.com
Subject: Re: PATCH: IA64: Don't relax branch in .init/.fini sections.
Date: Wed, 30 Jun 2004 01:16:00 -0000	[thread overview]
Message-ID: <20040630011604.GA9509@lucon.org> (raw)
In-Reply-To: <1088552945.1194.49.camel@localhost>

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

On Tue, Jun 29, 2004 at 04:49:05PM -0700, Jim Wilson wrote:
> On Sat, 2004-06-26 at 22:53, H. J. Lu wrote:
> > 	* elfxx-ia64.c (elfNN_ia64_relax_section): Don't relax branch
> > 	in .init/.fini sections.
> 
> This looks OK to me.
> 
> You suggest using brl.  The gcc startup files deliberately use indirect
> branches to avoid this problem.  We load the function address into a
> register, and then branch on the register.  This also avoids use of brl
> which is a slow on an Itanium1.  If we can ignore Itanium1, then we can
> simplify the gcc startup code a little bit.
> 
> The error message doesn't give any hint about which instruction can't be
> relocated.  Which means if you have lots of them you are screwed.  This
> might be rare enough that we don't have to worry about it.  You didn't
> give any info on how the problem was detected, so I can't tell if this
> matters.

I will check in this shortly.


H.J.

[-- Attachment #2: bfd-ia64-brl-2.patch --]
[-- Type: text/plain, Size: 948 bytes --]

2004-06-29  H.J. Lu  <hongjiu.lu@intel.com>

	PR 240
	* elfxx-ia64.c (elfNN_ia64_relax_section): Don't relax branch
	in .init/.fini sections.

--- bfd/elfxx-ia64.c.brl	2004-06-29 14:41:42.833932627 -0700
+++ bfd/elfxx-ia64.c	2004-06-29 18:10:44.212915584 -0700
@@ -953,6 +953,19 @@ elfNN_ia64_relax_section (abfd, sec, lin
 	{
 	  bfd_signed_vma offset;
 
+	  /* We can't put a trampoline in a .init/.fini section. Issue
+	     an error.  */
+	  if (strcmp (sec->output_section->name, ".init") == 0
+	      || strcmp (sec->output_section->name, ".fini") == 0)
+	    {
+	      (*_bfd_error_handler)
+		(_("%s: Can't relax br at 0x%lx in section `%s'. Please use brl or indirect branch."),
+		 bfd_archive_filename (sec->owner),
+		 (unsigned long) roff, sec->name);
+	      bfd_set_error (bfd_error_bad_value);
+	      goto error_return;
+	    }
+
 	  reladdr = (sec->output_section->vma
 		     + sec->output_offset
 		     + roff) & (bfd_vma) -4;

      parent reply	other threads:[~2004-06-30  1:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-27  0:48 IA64 linker bug: Linker failed to relax long call H. J. Lu
2004-06-27  5:53 ` PATCH: IA64: Don't relax branch in .init/.fini sections H. J. Lu
2004-06-29 23:49   ` Jim Wilson
2004-06-30  0:05     ` H. J. Lu
2004-06-30  1:16     ` H. J. Lu [this message]

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=20040630011604.GA9509@lucon.org \
    --to=hjl@lucon.org \
    --cc=binutils@sources.redhat.com \
    --cc=wilson@specifixinc.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).