* PATCH: Change ia64 br relaxation failure message
@ 2005-02-11 2:30 H. J. Lu
2005-02-11 23:48 ` H. J. Lu
0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2005-02-11 2:30 UTC (permalink / raw)
To: binutils
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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Change ia64 br relaxation failure message
2005-02-11 2:30 PATCH: Change ia64 br relaxation failure message H. J. Lu
@ 2005-02-11 23:48 ` H. J. Lu
2005-02-13 13:44 ` Alan Modra
0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2005-02-11 23:48 UTC (permalink / raw)
To: binutils; +Cc: wilson
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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Change ia64 br relaxation failure message
2005-02-11 23:48 ` H. J. Lu
@ 2005-02-13 13:44 ` Alan Modra
2005-02-14 6:15 ` H. J. Lu
0 siblings, 1 reply; 5+ messages in thread
From: Alan Modra @ 2005-02-13 13:44 UTC (permalink / raw)
To: H. J. Lu; +Cc: binutils, wilson
On Fri, Feb 11, 2005 at 12:20:25PM -0800, H. J. Lu wrote:
> Also we do &h->root without checking if h is NULL.
So? (char *) h == (char *) &h->root
--
Alan Modra
IBM OzLabs - Linux Technology Centre
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Change ia64 br relaxation failure message
2005-02-13 13:44 ` Alan Modra
@ 2005-02-14 6:15 ` H. J. Lu
2005-02-15 10:03 ` James E Wilson
0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2005-02-14 6:15 UTC (permalink / raw)
To: binutils, wilson
[-- Attachment #1: Type: text/plain, Size: 259 bytes --]
On Sat, Feb 12, 2005 at 04:58:21PM +1030, Alan Modra wrote:
> On Fri, Feb 11, 2005 at 12:20:25PM -0800, H. J. Lu wrote:
> > Also we do &h->root without checking if h is NULL.
>
> So? (char *) h == (char *) &h->root
Oops. Here is the updated patch.
H.J.
[-- Attachment #2: bfd-ia64-br-big-3.patch --]
[-- Type: text/plain, Size: 2296 bytes --]
2005-02-13 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 13:21:20.000000000 -0800
+++ bfd/elfxx-ia64.c 2005-02-13 08:36:46.182148909 -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->root,
+ name,
+ howto->name,
+ (bfd_vma) 0,
+ input_bfd,
+ input_section,
+ rel->r_offset))
+ return FALSE;
+ break;
+ }
+
ret_val = FALSE;
}
break;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: Change ia64 br relaxation failure message
2005-02-14 6:15 ` H. J. Lu
@ 2005-02-15 10:03 ` James E Wilson
0 siblings, 0 replies; 5+ messages in thread
From: James E Wilson @ 2005-02-15 10:03 UTC (permalink / raw)
To: H. J. Lu; +Cc: binutils
On Sun, 2005-02-13 at 08:55, H. J. Lu wrote:
> Oops. Here is the updated patch.
You updated the patch to remove the h check, but you forgot to update
the ChangeLog entry.
OK with that change.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-02-14 23:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-11 2:30 PATCH: Change ia64 br relaxation failure message H. J. Lu
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
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).