public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Subject: PATCH: Change ia64 br relaxation failure message
Date: Fri, 11 Feb 2005 02:30:00 -0000	[thread overview]
Message-ID: <20050211000511.GA22813@lucon.org> (raw)

R_IA64_PCREL21B, R_IA64_PCREL21BI, R_IA64_PCREL21M and R_IA64_PCREL21F
can fail if the input section is too big. Users get

foo.o(.text+0x1000072): In function `main':
foo.c: relocation truncated to fit: PCREL21B against symbol `foo'
defined in .text section in foo.o
/usr/local/bin/ld: final link failed: Nonrepresentable section on
output

and they may think it is a linker error. This patch changes it to

./ld: foo.o: Can't relax br (PCREL21B) in section `.text' with size
0x10000b0 (> 0x1000000).
./ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status


H.J.
----
2005-02-10  H.J. Lu  <hongjiu.lu@intel.com>

	* elfxx-ia64.c (elfNN_ia64_relocate_section): Inform users
	that the input section is too big to relax br instruction
	when overflow happens to R_IA64_PCREL21B, R_IA64_PCREL21BI,
	R_IA64_PCREL21M and R_IA64_PCREL21F.

--- bfd/elfxx-ia64.c.br	2005-02-10 12:34:27.000000000 -0800
+++ bfd/elfxx-ia64.c	2005-02-10 15:59:38.704232801 -0800
@@ -4542,13 +4542,37 @@ elfNN_ia64_relocate_section (output_bfd,
 		if (*name == '\0')
 		  name = bfd_section_name (input_bfd, sym_sec);
 	      }
-	    if (!(*info->callbacks->reloc_overflow) (info, &h->root,
-						     name, howto->name,
-						     (bfd_vma) 0,
-						     input_bfd,
-						     input_section,
-						     rel->r_offset))
-	      return FALSE;
+
+	    switch (r_type)
+	      {
+	      case R_IA64_PCREL21B:
+	      case R_IA64_PCREL21BI:
+	      case R_IA64_PCREL21M:
+	      case R_IA64_PCREL21F:
+		if (is_elf_hash_table (info->hash))
+		  {
+		    /* Relaxtion is always performed for ELF output.
+		       Overflow failures for those relocations mean
+		       that the section is too big to relax.  */
+		    (*_bfd_error_handler)
+		      (_("%B: Can't relax br (%s) in section `%A' with size 0x%lx (> 0x1000000)."),
+		       input_bfd, input_section, howto->name,
+		       input_section->size);
+		    break;
+		  }
+	      default:
+		if (!(*info->callbacks->reloc_overflow) (info,
+							 &h->root,
+							 name,
+							 howto->name,
+							 (bfd_vma) 0,
+							 input_bfd,
+							 input_section,
+							 rel->r_offset))
+		  return FALSE;
+		break;
+	      }
+
 	    ret_val = FALSE;
 	  }
 	  break;

             reply	other threads:[~2005-02-11  0:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-11  2:30 H. J. Lu [this message]
2005-02-11 23:48 ` H. J. Lu
2005-02-13 13:44   ` Alan Modra
2005-02-14  6:15     ` H. J. Lu
2005-02-15 10:03       ` James E Wilson

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=20050211000511.GA22813@lucon.org \
    --to=hjl@lucon.org \
    --cc=binutils@sources.redhat.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).