This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: The relax finalize pass has broken relax for h8300-coff
On Wed, Nov 26, 2003 at 12:50:30PM -0800, H. J. Lu wrote:
> On Wed, Nov 26, 2003 at 04:10:06PM +0530, Asgari J. Jinia wrote:
> > Hi,
> >
> > There are many errors when using -relax for h8300-coff.
> > The 16 bit PC relative branch to 8 bit PC relative branch ( R_PCRWORD ) relaxation is done for boundary cases and "relocation truncated to fit" error occurs for other cases.
> >
> > Adding -relax option for C code with call to sin(), cos(), malloc(), free() etc gives relocation truncated o fit error.
> >
>
I added it to all affected targets.
H.J.
---
2003-11-26 H.J. Lu <hongjiu.lu@intel.com>
* bout.c (b_out_bfd_relax_section): Skip the relax finalize
pass.
* coff-mips.c (mips_relax_section): Likewise.
* coff-sh.c (sh_relax_section): Likewise.
* elf-m10200.c (mn10200_elf_relax_section): Likewise.
* elf-m10300.c (mn10300_elf_relax_section): Likewise.
* elf32-h8300.c (elf32_h8_relax_section): Likewise.
* elf32-ip2k.c (ip2k_elf_relax_section): Likewise.
* elf32-m68hc11.c (m68hc11_elf_relax_section): Likewise.
* elf32-ppc.c (ppc_elf_relax_section): Likewise.
* elf32-sh.c (sh_elf_relax_section): Likewise.
* elf32-v850.c (v850_elf_relax_section): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
* elf32-xtensa.c (elf_xtensa_relax_section): Likewise.
* elf64-alpha.c (elf64_alpha_relax_section): Likewise.
* elf64-mmix.c (x_elf_relax_section): Likewise.
* elfxx-mips.c (_bfd_mips_relax_section): Likewise.
* reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
Index: bout.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/bout.c,v
retrieving revision 1.16
diff -u -p -r1.16 bout.c
--- bout.c 4 Nov 2003 17:42:46 -0000 1.16
+++ bout.c 26 Nov 2003 21:22:02 -0000
@@ -1245,6 +1245,10 @@ b_out_bfd_relax_section (abfd, i, link_i
multiple times, but it hasn't been tested. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (reloc_size)
{
long reloc_count;
Index: coff-mips.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/coff-mips.c,v
retrieving revision 1.18
diff -u -p -r1.18 coff-mips.c
--- coff-mips.c 26 Jun 2003 14:34:24 -0000 1.18
+++ coff-mips.c 26 Nov 2003 21:22:03 -0000
@@ -1916,6 +1916,10 @@ mips_relax_section (abfd, sec, info, aga
/* Assume we are not going to need another pass. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (info->relax_finalizing)
+ return TRUE;
+
/* If we are not generating an ECOFF file, this is much too
confusing to deal with. */
if (info->hash->creator->flavour != bfd_get_flavour (abfd))
Index: coff-sh.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/coff-sh.c,v
retrieving revision 1.18
diff -u -p -r1.18 coff-sh.c
--- coff-sh.c 13 Oct 2003 16:15:46 -0000 1.18
+++ coff-sh.c 26 Nov 2003 21:22:03 -0000
@@ -706,6 +706,10 @@ sh_relax_section (abfd, sec, link_info,
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (link_info->relocatable
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
Index: elf-m10200.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf-m10200.c,v
retrieving revision 1.21
diff -u -p -r1.21 elf-m10200.c
--- elf-m10200.c 5 Nov 2003 16:01:12 -0000 1.21
+++ elf-m10200.c 26 Nov 2003 21:22:03 -0000
@@ -512,6 +512,10 @@ mn10200_elf_relax_section (abfd, sec, li
/* Assume nothing changes. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
Index: elf-m10300.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf-m10300.c,v
retrieving revision 1.37
diff -u -p -r1.37 elf-m10300.c
--- elf-m10300.c 11 Nov 2003 16:33:24 -0000 1.37
+++ elf-m10300.c 26 Nov 2003 21:22:04 -0000
@@ -1814,6 +1814,10 @@ mn10300_elf_relax_section (abfd, sec, li
/* Assume nothing changes. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
/* We need a pointer to the mn10300 specific hash table. */
hash_table = elf32_mn10300_hash_table (link_info);
Index: elf32-h8300.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-h8300.c,v
retrieving revision 1.1.1.27
diff -u -p -r1.1.1.27 elf32-h8300.c
--- elf32-h8300.c 5 Nov 2003 15:53:42 -0000 1.1.1.27
+++ elf32-h8300.c 26 Nov 2003 21:22:04 -0000
@@ -679,6 +679,10 @@ elf32_h8_relax_section (bfd *abfd, asect
/* Assume nothing changes. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
Index: elf32-ip2k.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-ip2k.c,v
retrieving revision 1.1.1.9
diff -u -p -r1.1.1.9 elf32-ip2k.c
--- elf32-ip2k.c 20 Aug 2003 14:32:53 -0000 1.1.1.9
+++ elf32-ip2k.c 26 Nov 2003 21:22:04 -0000
@@ -819,6 +819,10 @@ ip2k_elf_relax_section (abfd, sec, link_
/* Assume nothing changes. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (first_section == NULL)
{
ip2k_relaxed = TRUE;
Index: elf32-m68hc11.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-m68hc11.c,v
retrieving revision 1.1.1.18
diff -u -p -r1.1.1.18 elf32-m68hc11.c
--- elf32-m68hc11.c 6 Oct 2003 18:14:00 -0000 1.1.1.18
+++ elf32-m68hc11.c 26 Nov 2003 21:22:05 -0000
@@ -670,6 +670,10 @@ m68hc11_elf_relax_section (bfd *abfd, as
/* Assume nothing changes. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
/* We don't have to do anything for a relocatable link, if
this section does not have relocs, or if this is not a
code section. */
Index: elf32-ppc.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-ppc.c,v
retrieving revision 1.82
diff -u -p -r1.82 elf32-ppc.c
--- elf32-ppc.c 18 Nov 2003 19:11:40 -0000 1.82
+++ elf32-ppc.c 26 Nov 2003 21:22:05 -0000
@@ -1675,6 +1675,10 @@ ppc_elf_relax_section (bfd *abfd,
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
/* Nothing to do if there are no relocations and no need for
the relax finalize pass. */
if ((isec->flags & SEC_RELOC) == 0
Index: elf32-sh.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-sh.c,v
retrieving revision 1.69
diff -u -p -r1.69 elf32-sh.c
--- elf32-sh.c 18 Nov 2003 19:11:40 -0000 1.69
+++ elf32-sh.c 26 Nov 2003 21:22:06 -0000
@@ -2183,6 +2183,10 @@ sh_elf_relax_section (bfd *abfd, asectio
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (link_info->relocatable
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
Index: elf32-v850.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-v850.c,v
retrieving revision 1.29
diff -u -p -r1.29 elf32-v850.c
--- elf32-v850.c 5 Nov 2003 16:01:12 -0000 1.29
+++ elf32-v850.c 26 Nov 2003 21:22:07 -0000
@@ -2541,6 +2541,10 @@ v850_elf_relax_section (abfd, sec, link_
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (link_info->relocatable
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
Index: elf32-xstormy16.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-xstormy16.c,v
retrieving revision 1.1.1.22
diff -u -p -r1.1.1.22 elf32-xstormy16.c
--- elf32-xstormy16.c 5 Nov 2003 15:53:57 -0000 1.1.1.22
+++ elf32-xstormy16.c 26 Nov 2003 21:22:07 -0000
@@ -609,6 +609,10 @@ xstormy16_elf_relax_section (dynobj, spl
/* Assume nothing changes. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (info->relax_finalizing)
+ return TRUE;
+
if (info->relocatable)
return TRUE;
Index: elf32-xtensa.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf32-xtensa.c,v
retrieving revision 1.1.1.16
diff -u -p -r1.1.1.16 elf32-xtensa.c
--- elf32-xtensa.c 18 Nov 2003 18:08:18 -0000 1.1.1.16
+++ elf32-xtensa.c 26 Nov 2003 21:22:07 -0000
@@ -4059,6 +4059,12 @@ elf_xtensa_relax_section (abfd, sec, lin
static value_map_hash_table *values = NULL;
xtensa_relax_info *relax_info;
+ *again = FALSE;
+
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (!values)
{
/* Do some overall initialization for relaxation. */
@@ -4067,7 +4073,6 @@ elf_xtensa_relax_section (abfd, sec, lin
if (!analyze_relocations (link_info))
return FALSE;
}
- *again = FALSE;
/* Don't mess with linker-created sections. */
if ((sec->flags & SEC_LINKER_CREATED) != 0)
Index: elf64-alpha.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf64-alpha.c,v
retrieving revision 1.85
diff -u -p -r1.85 elf64-alpha.c
--- elf64-alpha.c 5 Nov 2003 16:01:12 -0000 1.85
+++ elf64-alpha.c 26 Nov 2003 21:22:08 -0000
@@ -1977,6 +1977,10 @@ elf64_alpha_relax_section (abfd, sec, li
/* We are not currently changing any sizes, so only one pass. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (link_info->relocatable
|| (sec->flags & SEC_RELOC) == 0
|| sec->reloc_count == 0)
Index: elf64-mmix.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elf64-mmix.c,v
retrieving revision 1.1.1.25
diff -u -p -r1.1.1.25 elf64-mmix.c
--- elf64-mmix.c 5 Nov 2003 15:53:47 -0000 1.1.1.25
+++ elf64-mmix.c 26 Nov 2003 21:22:09 -0000
@@ -2636,6 +2636,10 @@ mmix_elf_relax_section (abfd, sec, link_
/* Assume nothing changes. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
/* If this is the first time we have been called for this section,
initialize the cooked size. */
if (sec->_cooked_size == 0 && sec->_raw_size != 0)
Index: elfxx-mips.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/elfxx-mips.c,v
retrieving revision 1.1.1.58
diff -u -p -r1.1.1.58 elfxx-mips.c
--- elfxx-mips.c 17 Nov 2003 19:47:11 -0000 1.1.1.58
+++ elfxx-mips.c 26 Nov 2003 21:22:10 -0000
@@ -5495,6 +5495,10 @@ _bfd_mips_relax_section (abfd, sec, link
/* We are not currently changing any sizes, so only one pass. */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (link_info->relocatable)
return TRUE;
Index: reloc16.c
===================================================================
RCS file: /export/cvs/gnu/binutils/bfd/reloc16.c,v
retrieving revision 1.10
diff -u -p -r1.10 reloc16.c
--- reloc16.c 26 Jun 2003 14:34:25 -0000 1.10
+++ reloc16.c 26 Nov 2003 21:22:10 -0000
@@ -155,6 +155,10 @@ bfd_coff_reloc16_relax_section (abfd, in
times (see discussion of the "shrinks" array below). */
*again = FALSE;
+ /* Skip the relax finalize pass. */
+ if (link_info->relax_finalizing)
+ return TRUE;
+
if (reloc_size < 0)
return FALSE;