From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Cc: wilson@specifixinc.com
Subject: Re: PATCH: Change ia64 br relaxation failure message
Date: Fri, 11 Feb 2005 23:48:00 -0000 [thread overview]
Message-ID: <20050211202025.GA8015@lucon.org> (raw)
In-Reply-To: <20050211000511.GA22813@lucon.org>
On Thu, Feb 10, 2005 at 04:05:11PM -0800, H. J. Lu wrote:
> 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
>
Hi Jim,
I just noticed a relaxation bug. We won't relax
foo:
huge text
br foo
since branch and target are in the same section. We can relax backward
branch in this case. Also we do &h->root without checking if h is NULL.
The updated patch fixes both problems.
H.J.
----
2005-02-10 H.J. Lu <hongjiu.lu@intel.com>
* elfxx-ia64.c (elfNN_ia64_relax_section): Allow relax
backward branch in the same section.
(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. Check h before accessing &h->root.
--- bfd/elfxx-ia64.c.big 2005-02-11 11:16:33.000000000 -0800
+++ bfd/elfxx-ia64.c 2005-02-11 12:12:58.353313904 -0800
@@ -994,9 +994,10 @@ elfNN_ia64_relax_section (abfd, sec, lin
}
/* If the branch and target are in the same section, you've
- got one honking big section and we can't help you. You'll
- get an error message later. */
- if (tsec == sec)
+ got one honking big section and we can't help you unless
+ you are branching backwards. You'll get an error message
+ later. */
+ if (tsec == sec && toff > roff)
continue;
/* Look for an existing fixup to this address. */
@@ -4542,13 +4543,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) to `%s' at 0x%lx in section `%A' with size 0x%lx (> 0x1000000)."),
+ input_bfd, input_section, howto->name, name,
+ rel->r_offset, input_section->size);
+ break;
+ }
+ default:
+ if (!(*info->callbacks->reloc_overflow) (info,
+ h ? &h->root : NULL,
+ name,
+ howto->name,
+ (bfd_vma) 0,
+ input_bfd,
+ input_section,
+ rel->r_offset))
+ return FALSE;
+ break;
+ }
+
ret_val = FALSE;
}
break;
next prev parent reply other threads:[~2005-02-11 20:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-11 2:30 H. J. Lu
2005-02-11 23:48 ` H. J. Lu [this message]
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=20050211202025.GA8015@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).