This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Change ia64 br relaxation failure message


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]