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]

patch for elf32-arm.h `relocation truncated to fit' error


Branches to unresolved symbols currently cause two error messages to be 
produced by the arm-elf linker, at least with the default segment addresses 
used for GNU/Linux:

t.o(.text+0x0): undefined reference to `undef'
t.o(.text+0x0): relocation truncated to fit: R_ARM_PC24 undef

The latter message doesn't really convey any useful information, and can be 
confusing for users.  I'd like to propose this patch to shut it up.

p.

2000-11-04  Philip Blundell  <philb@gnu.org>

	* elf32-arm.h (elf32_arm_relocate_section): Suppress error message
	if a relocation for an undefined symbol also results in an
	overflow.

Index: elf32-arm.h
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.h,v
retrieving revision 1.25.2.5
diff -u -p -u -r1.25.2.5 elf32-arm.h
--- elf32-arm.h	2000/10/31 22:56:17	1.25.2.5
+++ elf32-arm.h	2000/11/05 12:39:35
@@ -1846,10 +1846,15 @@ elf32_arm_relocate_section (output_bfd, 
 	  switch (r)
 	    {
 	    case bfd_reloc_overflow:
-	      if (!((*info->callbacks->reloc_overflow)
-		    (info, name, howto->name, (bfd_vma) 0,
-		     input_bfd, input_section, rel->r_offset)))
-		return false;
+	      /* If the overflowing reloc was to an undefined symbol,
+		 we have already printed one error message and there
+		 is no point complaining again.  */
+	      if ((! h ||
+		   h->root.type != bfd_link_hash_undefined)
+		  && (!((*info->callbacks->reloc_overflow)
+			(info, name, howto->name, (bfd_vma) 0,
+			 input_bfd, input_section, rel->r_offset))))
+		  return false;
 	      break;
 
 	    case bfd_reloc_undefined:



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