This is the mail archive of the binutils@sourceware.org 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]

Re: ld error message %C format


On Thu, May 19, 2011 at 05:24:15PM -0700, Ian Lance Taylor wrote:
> It's specifically the multiple definition error and the undefined symbol
> error where I think we should tread carefully.

Fair enough.  I'll introduce a new format specifier.

bfd/
	* elf32-frv.c: Use info->callbacks->einfo throughout file in linker
	functions rather than warning callback or _bfd_error_handler.
	* elf32-ppc.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf32-ppc.c (ppc_elf_tls_optimize): Use %H in __tls_get_addr lost
	arg error.
	* elf64-ppc.c (ppc64_elf_tls_optimize): Likewise.
ld/
	* ldmisc.c (vfinfo): Add %H.
	* ldmain.c (reloc_overflow): Use %H rather than %C.
	(reloc_dangerous, unattached_reloc): Likewise.

Index: bfd/elf32-frv.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-frv.c,v
retrieving revision 1.72
diff -u -p -r1.72 elf32-frv.c
--- bfd/elf32-frv.c	28 Feb 2011 18:30:16 -0000	1.72
+++ bfd/elf32-frv.c	23 May 2011 01:15:35 -0000
@@ -1,5 +1,5 @@
 /* FRV-specific support for 32-bit ELF.
-   Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -2884,8 +2884,9 @@ elf32_frv_relocate_section (output_bfd, 
 						      osec, sym,
 						      rel->r_addend))
 	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%x): relocation to `%s+%x' may have caused the error above"),
+	      info->callbacks->einfo
+		(_("%H: relocation to `%s+%v'"
+		   " may have caused the error above\n"),
 		 input_bfd, input_section, rel->r_offset, name, rel->r_addend);
 	      return FALSE;
 	    }
@@ -2897,9 +2898,10 @@ elf32_frv_relocate_section (output_bfd, 
 	  picrel = NULL;
 	  if (h && ! FRVFDPIC_SYM_LOCAL (info, h))
 	    {
-	      info->callbacks->warning
-		(info, _("relocation references symbol not defined in the module"),
-		 name, input_bfd, input_section, rel->r_offset);
+	      info->callbacks->einfo
+		(_("%H: relocation references symbol"
+		   " not defined in the module\n"),
+		 input_bfd, input_section, rel->r_offset);
 	      return FALSE;
 	    }
 	  break;
@@ -2972,10 +2974,9 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a call instruction?  */
 	    if ((insn & (unsigned long)0x01fc0000) != 0x003c0000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GETTLSOFF not applied to a call instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GETTLSOFF not applied to a call instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3014,10 +3015,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this an lddi instruction?  */
 	    if ((insn & (unsigned long)0x01fc0000) != 0x00cc0000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GOTTLSDESC12 not applied to an lddi instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GOTTLSDESC12"
+		     " not applied to an lddi instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3085,10 +3086,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a sethi instruction?  */
 	    if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GOTTLSDESCHI not applied to a sethi instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GOTTLSDESCHI"
+		     " not applied to a sethi instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3122,11 +3123,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a setlo or setlos instruction?  */
 	    if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GOTTLSDESCLO"
-		     " not applied to a setlo or setlos instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GOTTLSDESCLO"
+		     " not applied to a setlo or setlos instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3170,10 +3170,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this an ldd instruction?  */
 	    if ((insn & (unsigned long)0x01fc0fc0) != 0x00080140)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_TLSDESC_RELAX not applied to an ldd instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_TLSDESC_RELAX"
+		     " not applied to an ldd instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3254,11 +3254,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a calll or callil instruction?  */
 	    if ((insn & (unsigned long)0x7ff80fc0) != 0x02300000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GETTLSOFF_RELAX"
-		     " not applied to a calll instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GETTLSOFF_RELAX"
+		     " not applied to a calll instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3309,10 +3308,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this an ldi instruction?  */
 	    if ((insn & (unsigned long)0x01fc0000) != 0x00c80000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GOTTLSOFF12 not applied to an ldi instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GOTTLSOFF12"
+		     " not applied to an ldi instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3339,10 +3338,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a sethi instruction?  */
 	    if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GOTTLSOFFHI not applied to a sethi instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GOTTLSOFFHI"
+		     " not applied to a sethi instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3368,11 +3367,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a setlo or setlos instruction?  */
 	    if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_GOTTLSOFFLO"
-		     " not applied to a setlo or setlos instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_GOTTLSOFFLO"
+		     " not applied to a setlo or setlos instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3399,10 +3397,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this an ld instruction?  */
 	    if ((insn & (unsigned long)0x01fc0fc0) != 0x00080100)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_TLSOFF_RELAX not applied to an ld instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_TLSOFF_RELAX"
+		     " not applied to an ld instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3444,10 +3442,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a sethi instruction?  */
 	    if ((insn & (unsigned long)0x01ff0000) != 0x00f80000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_TLSMOFFHI not applied to a sethi instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("%H: R_FRV_TLSMOFFHI"
+		     " not applied to a sethi instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3471,11 +3469,10 @@ elf32_frv_relocate_section (output_bfd, 
 	    /* Is this a setlo or setlos instruction?  */
 	    if ((insn & (unsigned long)0x01f70000) != 0x00f40000)
 	      {
-		r = info->callbacks->warning
-		  (info,
-		   _("R_FRV_TLSMOFFLO"
-		     " not applied to a setlo or setlos instruction"),
-		   name, input_bfd, input_section, rel->r_offset);
+		info->callbacks->einfo
+		  (_("R_FRV_TLSMOFFLO"
+		     " not applied to a setlo or setlos instruction\n"),
+		   input_bfd, input_section, rel->r_offset);
 		return FALSE;
 	      }
 
@@ -3593,9 +3590,10 @@ elf32_frv_relocate_section (output_bfd, 
 		  {
 		    if (addend)
 		      {
-			info->callbacks->warning
-			  (info, _("R_FRV_FUNCDESC references dynamic symbol with nonzero addend"),
-			   name, input_bfd, input_section, rel->r_offset);
+			info->callbacks->einfo
+			  (_("%H: R_FRV_FUNCDESC references dynamic symbol"
+			     " with nonzero addend\n"),
+			   input_bfd, input_section, rel->r_offset);
 			return FALSE;
 		      }
 		    dynindx = h->dynindx;
@@ -3633,10 +3631,10 @@ elf32_frv_relocate_section (output_bfd, 
 						       input_section
 						       ->output_section))
 			  {
-			    info->callbacks->warning
-			      (info,
-			       _("cannot emit fixups in read-only section"),
-			       name, input_bfd, input_section, rel->r_offset);
+			    info->callbacks->einfo
+			      (_("%H: cannot emit fixups"
+				 " in read-only section\n"),
+			       input_bfd, input_section, rel->r_offset);
 			    return FALSE;
 			  }
 
@@ -3664,10 +3662,10 @@ elf32_frv_relocate_section (output_bfd, 
 						   input_section
 						   ->output_section))
 		      {
-			info->callbacks->warning
-			  (info,
-			   _("cannot emit dynamic relocations in read-only section"),
-			   name, input_bfd, input_section, rel->r_offset);
+			info->callbacks->einfo
+			  (_("%H: cannot emit dynamic relocations"
+			     " in read-only section\n"),
+			   input_bfd, input_section, rel->r_offset);
 			return FALSE;
 		      }
 
@@ -3713,9 +3711,10 @@ elf32_frv_relocate_section (output_bfd, 
 	      {
 		if (addend && r_type == R_FRV_FUNCDESC_VALUE)
 		  {
-		    info->callbacks->warning
-		      (info, _("R_FRV_FUNCDESC_VALUE references dynamic symbol with nonzero addend"),
-		       name, input_bfd, input_section, rel->r_offset);
+		    info->callbacks->einfo
+		      (_("%H: R_FRV_FUNCDESC_VALUE"
+			 " references dynamic symbol with nonzero addend\n"),
+		       input_bfd, input_section, rel->r_offset);
 		    return FALSE;
 		  }
 		dynindx = h->dynindx;
@@ -3754,10 +3753,9 @@ elf32_frv_relocate_section (output_bfd, 
 						   input_section
 						   ->output_section))
 		      {
-			info->callbacks->warning
-			  (info,
-			   _("cannot emit fixups in read-only section"),
-			   name, input_bfd, input_section, rel->r_offset);
+			info->callbacks->einfo
+			  (_("%H: cannot emit fixups in read-only section\n"),
+			   input_bfd, input_section, rel->r_offset);
 			return FALSE;
 		      }
 		    if (!h || h->root.type != bfd_link_hash_undefweak)
@@ -3798,10 +3796,10 @@ elf32_frv_relocate_section (output_bfd, 
 						   input_section
 						   ->output_section))
 		      {
-			info->callbacks->warning
-			  (info,
-			   _("cannot emit dynamic relocations in read-only section"),
-			   name, input_bfd, input_section, rel->r_offset);
+			info->callbacks->einfo
+			  (_("%H: cannot emit dynamic relocations"
+			     " in read-only section\n"),
+			   input_bfd, input_section, rel->r_offset);
 			return FALSE;
 		      }
 
@@ -3969,16 +3967,9 @@ elf32_frv_relocate_section (output_bfd, 
 	      && !(picrel && picrel->symndx == -1
 		   && picrel->d.h->root.type == bfd_link_hash_undefined))
 	    {
-	      if (info->shared || info->pie)
-		(*_bfd_error_handler)
-		  (_("%B(%A+0x%lx): reloc against `%s': %s"),
-		   input_bfd, input_section, (long)rel->r_offset, name,
-		   _("relocation references a different segment"));
-	      else
-		info->callbacks->warning
-		  (info,
-		   _("relocation references a different segment"),
-		   name, input_bfd, input_section, rel->r_offset);
+	      info->callbacks->einfo
+		(_("%H: reloc against `%s' references a different segment\n"),
+		 input_bfd, input_section, rel->r_offset, name);
 	    }
 	  if (!silence_segment_error && (info->shared || info->pie))
 	    return FALSE;
@@ -4126,9 +4117,9 @@ elf32_frv_relocate_section (output_bfd, 
 
 	  if (msg)
 	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): reloc against `%s': %s"),
-		 input_bfd, input_section, (long)rel->r_offset, name, msg);
+	      info->callbacks->einfo
+		(_("%H: reloc against `%s': %s\n"),
+		 input_bfd, input_section, rel->r_offset, name, msg);
 	      return FALSE;
 	    }
 
@@ -5882,8 +5873,8 @@ elf32_frvfdpic_finish_dynamic_sections (
 	      != (frvfdpic_gotfixup_section (info)->reloc_count * 4))
 	    {
 	    error:
-	      (*_bfd_error_handler)
-		("LINKER BUG: .rofixup section size mismatch");
+	      info->callbacks->einfo
+		("LINKER BUG: .rofixup section size mismatch\n");
 	      return FALSE;
 	    }
 
@@ -6402,8 +6393,8 @@ elf32_frv_check_relocs (abfd, info, sec,
 
 	default:
 	bad_reloc:
-	  (*_bfd_error_handler)
-	    (_("%B: unsupported relocation type %i"),
+	  info->callbacks->einfo
+	    (_("%B: unsupported relocation type %i\n"),
 	     abfd, ELF32_R_TYPE (rel->r_info));
 	  return FALSE;
         }
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.294
diff -u -p -r1.294 elf32-ppc.c
--- bfd/elf32-ppc.c	10 May 2011 06:13:07 -0000	1.294
+++ bfd/elf32-ppc.c	23 May 2011 01:15:37 -0000
@@ -3703,12 +3683,9 @@ ppc_elf_check_relocs (bfd *abfd,
 	    {
 	      /* It does not make sense to have a procedure linkage
 		 table entry for a local symbol.  */
-	      (*_bfd_error_handler) (_("%B(%A+0x%lx): %s reloc against "
-				       "local symbol"),
-				     abfd,
-				     sec,
-				     (long) rel->r_offset,
-				     ppc_elf_howto_table[r_type]->name);
+	      info->callbacks->einfo (_("%H: %s reloc against local symbol\n"),
+				      abfd, sec, rel->r_offset,
+				      ppc_elf_howto_table[r_type]->name);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
 	    }
@@ -4704,7 +4681,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT
 		      && !expecting_tls_get_addr
 		      && is_branch_reloc (r_type))
 		    {
-		      info->callbacks->minfo ("%C __tls_get_addr lost arg, "
+		      info->callbacks->minfo ("%H __tls_get_addr lost arg, "
 					      "TLS optimization disabled\n",
 					      ibfd, sec, rel->r_offset);
 		      if (elf_section_data (sec)->relocs != relstart)
@@ -4790,7 +4767,7 @@ ppc_elf_tls_optimize (bfd *obfd ATTRIBUT
 			 could just mark this symbol to exclude it
 			 from tls optimization but it's safer to skip
 			 the entire optimization.  */
-		      info->callbacks->minfo (_("%C arg lost __tls_get_addr, "
+		      info->callbacks->minfo (_("%H arg lost __tls_get_addr, "
 						"TLS optimization disabled\n"),
 					      ibfd, sec, rel->r_offset);
 		      if (elf_section_data (sec)->relocs != relstart)
@@ -5025,8 +5002,8 @@ ppc_elf_adjust_dynamic_symbol (struct bf
 
   if (h->size == 0)
     {
-      (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
-			     h->root.root.string);
+      info->callbacks->einfo (_("dynamic variable `%s' is zero size\n"),
+			      h->root.root.string);
       return TRUE;
     }
 
@@ -7222,8 +7199,8 @@ ppc_elf_relocate_section (bfd *output_bf
       switch (r_type)
 	{
 	default:
-	  (*_bfd_error_handler)
-	    (_("%B: unknown relocation type %d for symbol %s"),
+	  info->callbacks->einfo
+	    (_("%B: unknown relocation type %d for symbol %s\n"),
 	     input_bfd, (int) r_type, sym_name);
 
 	  bfd_set_error (bfd_error_bad_value);
@@ -7483,11 +7460,9 @@ ppc_elf_relocate_section (bfd *output_bf
 	       generated by a hash table traversal, the value in the
 	       got at entry m+n bears little relation to the entry m.  */
 	    if (addend != 0)
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): non-zero addend on %s reloc against `%s'"),
-		 input_bfd,
-		 input_section,
-		 (long) rel->r_offset,
+	      info->callbacks->einfo
+		(_("%H: non-zero addend on %s reloc against `%s'\n"),
+		 input_bfd, input_section, rel->r_offset,
 		 howto->name,
 		 sym_name);
 	  }
@@ -7681,12 +7656,10 @@ ppc_elf_relocate_section (bfd *output_bf
 			     non-executable to apply text relocations.
 			     So we'll segfault when trying to run the
 			     indirection function to resolve the reloc.  */
-			  (*_bfd_error_handler)
-			    (_("%B(%A+0x%lx): relocation %s for indirect "
-			       "function %s unsupported"),
-			     input_bfd,
-			     input_section,
-			     (long) rel->r_offset,
+			  info->callbacks->einfo
+			    (_("%H: relocation %s for indirect "
+			       "function %s unsupported\n"),
+			     input_bfd, input_section, rel->r_offset,
 			     howto->name,
 			     sym_name);
 			  ret = FALSE;
@@ -7911,9 +7884,9 @@ ppc_elf_relocate_section (bfd *output_bf
 		   || (CONST_STRNEQ (name, ".sbss")
 		       && (name[5] == 0 || name[5] == '.'))))
 	      {
-		(*_bfd_error_handler)
+		info->callbacks->einfo
 		  (_("%B: the target (%s) of a %s relocation is "
-		     "in the wrong output section (%s)"),
+		     "in the wrong output section (%s)\n"),
 		   input_bfd,
 		   sym_name,
 		   howto->name,
@@ -7941,9 +7914,9 @@ ppc_elf_relocate_section (bfd *output_bf
 	    if (! (CONST_STRNEQ (name, ".sdata2")
 		   || CONST_STRNEQ (name, ".sbss2")))
 	      {
-		(*_bfd_error_handler)
+		info->callbacks->einfo
 		  (_("%B: the target (%s) of a %s relocation is "
-		     "in the wrong output section (%s)"),
+		     "in the wrong output section (%s)\n"),
 		   input_bfd,
 		   sym_name,
 		   howto->name,
@@ -7988,9 +7961,9 @@ ppc_elf_relocate_section (bfd *output_bf
 	      }
 	    else
 	      {
-		(*_bfd_error_handler)
+		info->callbacks->einfo
 		  (_("%B: the target (%s) of a %s relocation is "
-		     "in the wrong output section (%s)"),
+		     "in the wrong output section (%s)\n"),
 		   input_bfd,
 		   sym_name,
 		   howto->name,
@@ -8060,8 +8033,8 @@ ppc_elf_relocate_section (bfd *output_bf
 	case R_PPC_EMB_RELST_HI:
 	case R_PPC_EMB_RELST_HA:
 	case R_PPC_EMB_BIT_FLD:
-	  (*_bfd_error_handler)
-	    (_("%B: relocation %s is not yet supported for symbol %s."),
+	  info->callbacks->einfo
+	    (_("%B: relocation %s is not yet supported for symbol %s\n"),
 	     input_bfd,
 	     howto->name,
 	     sym_name);
@@ -8119,11 +8092,9 @@ ppc_elf_relocate_section (bfd *output_bf
 	  && !((input_section->flags & SEC_DEBUGGING) != 0
 	       && h->def_dynamic))
 	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
-	     input_bfd,
-	     input_section,
-	     (long) rel->r_offset,
+	  info->callbacks->einfo
+	    (_("%H: unresolvable %s relocation against symbol `%s'\n"),
+	     input_bfd, input_section, rel->r_offset,
 	     howto->name,
 	     sym_name);
 	  ret = FALSE;
@@ -8168,10 +8139,10 @@ ppc_elf_relocate_section (bfd *output_bf
 	    }
 	  else
 	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): %s reloc against `%s': error %d"),
-		 input_bfd, input_section,
-		 (long) rel->r_offset, howto->name, sym_name, (int) r);
+	      info->callbacks->einfo
+		(_("%H: %s reloc against `%s': error %d\n"),
+		 input_bfd, input_section, rel->r_offset,
+		 howto->name, sym_name, (int) r);
 	      ret = FALSE;
 	    }
 	}
@@ -8660,10 +8631,10 @@ ppc_elf_finish_dynamic_sections (bfd *ou
 	}
       else
 	{
-	  (*_bfd_error_handler) (_("%s not defined in linker created %s"),
-				 htab->elf.hgot->root.root.string,
-				 (htab->sgotplt != NULL
-				  ? htab->sgotplt->name : htab->got->name));
+	  info->callbacks->einfo (_("%s not defined in linker created %s\n"),
+				  htab->elf.hgot->root.root.string,
+				  (htab->sgotplt != NULL
+				   ? htab->sgotplt->name : htab->got->name));
 	  bfd_set_error (bfd_error_bad_value);
 	  ret = FALSE;
 	}
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.350
diff -u -p -r1.350 elf64-ppc.c
--- bfd/elf64-ppc.c	10 May 2011 06:13:07 -0000	1.350
+++ bfd/elf64-ppc.c	23 May 2011 01:15:41 -0000
@@ -4138,8 +4118,9 @@ ppc_get_stub_entry (const asection *inpu
 static struct ppc_stub_hash_entry *
 ppc_add_stub (const char *stub_name,
 	      asection *section,
-	      struct ppc_link_hash_table *htab)
+	      struct bfd_link_info *info)
 {
+  struct ppc_link_hash_table *htab = ppc_hash_table (info);
   asection *link_sec;
   asection *stub_sec;
   struct ppc_stub_hash_entry *stub_entry;
@@ -4176,8 +4157,8 @@ ppc_add_stub (const char *stub_name,
 				     TRUE, FALSE);
   if (stub_entry == NULL)
     {
-      (*_bfd_error_handler) (_("%B: cannot create stub entry %s"),
-			     section->owner, stub_name);
+      info->callbacks->einfo (_("%B: cannot create stub entry %s\n"),
+			      section->owner, stub_name);
       return NULL;
     }
 
@@ -6499,9 +6480,9 @@ ppc64_elf_adjust_dynamic_symbol (struct 
 	 function pointers, vtable refs and suchlike in read-only
 	 sections.  Allow them to proceed, but warn that this might
 	 break at runtime.  */
-      (*_bfd_error_handler)
+      info->callbacks->einfo
 	(_("copy reloc against `%s' requires lazy plt linking; "
-	   "avoid setting LD_BIND_NOW=1 or upgrade gcc"),
+	   "avoid setting LD_BIND_NOW=1 or upgrade gcc\n"),
 	 h->root.root.string);
     }
 
@@ -6510,8 +6491,8 @@ ppc64_elf_adjust_dynamic_symbol (struct 
 
   if (h->size == 0)
     {
-      (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
-			     h->root.root.string);
+      info->callbacks->einfo (_("dynamic variable `%s' is zero size\n"),
+			      h->root.root.string);
       return TRUE;
     }
 
@@ -6928,8 +6909,8 @@ dec_dynrel_count (bfd_vma r_info,
       pp = &p->next;
     }
 
-  (*_bfd_error_handler) (_("dynreloc miscount for %B, section %A"),
-			   sec->owner, sec);
+  info->callbacks->einfo (_("dynreloc miscount for %B, section %A\n"),
+			  sec->owner, sec);
   bfd_set_error (bfd_error_bad_value);
   return FALSE;
 }
@@ -7600,7 +7581,7 @@ ppc64_elf_tls_optimize (struct bfd_link_
 		      && !found_tls_get_addr_arg
 		      && is_branch_reloc (r_type))
 		    {
-		      info->callbacks->minfo (_("%C __tls_get_addr lost arg, "
+		      info->callbacks->minfo (_("%H __tls_get_addr lost arg, "
 						"TLS optimization disabled\n"),
 					      ibfd, sec, rel->r_offset);
 		      ret = TRUE;
@@ -7794,7 +7775,7 @@ ppc64_elf_tls_optimize (struct bfd_link_
 			 could just mark this symbol to exclude it
 			 from tls optimization but it's safer to skip
 			 the entire optimization.  */
-		      info->callbacks->minfo (_("%C arg lost __tls_get_addr, "
+		      info->callbacks->minfo (_("%H arg lost __tls_get_addr, "
 						"TLS optimization disabled\n"),
 					      ibfd, sec, rel->r_offset);
 		      ret = TRUE;
@@ -9473,9 +9454,10 @@ get_relocs (asection *sec, int count)
 }
 
 static bfd_vma
-get_r2off (struct ppc_link_hash_table *htab,
+get_r2off (struct bfd_link_info *info,
 	   struct ppc_stub_hash_entry *stub_entry)
 {
+  struct ppc_link_hash_table *htab = ppc_hash_table (info);
   bfd_vma r2off = htab->stub_group[stub_entry->target_section->id].toc_off;
 
   if (r2off == 0)
@@ -9489,15 +9471,15 @@ get_r2off (struct ppc_link_hash_table *h
       if (strcmp (opd->name, ".opd") != 0
 	  || opd->reloc_count != 0)
 	{
-	  (*_bfd_error_handler) (_("cannot find opd entry toc for %s"),
-				 stub_entry->h->elf.root.root.string);
+	  info->callbacks->einfo (_("cannot find opd entry toc for %s\n"),
+				  stub_entry->h->elf.root.root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  return 0;
 	}
       if (!bfd_get_section_contents (opd->owner, opd, buf, opd_off + 8, 8))
 	return 0;
       r2off = bfd_get_64 (opd->owner, buf);
-      r2off -= elf_gp (stub_entry->id_sec->output_section->owner);
+      r2off -= elf_gp (info->output_bfd);
     }
   r2off -= htab->stub_group[stub_entry->id_sec->id].toc_off;
   return r2off;
@@ -9547,7 +9529,7 @@ ppc_build_one_stub (struct bfd_hash_entr
       size = 4;
       if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
 	{
-	  bfd_vma r2off = get_r2off (htab, stub_entry);
+	  bfd_vma r2off = get_r2off (info, stub_entry);
 
 	  if (r2off == 0)
 	    {
@@ -9571,8 +9553,8 @@ ppc_build_one_stub (struct bfd_hash_entr
 
       if (off + (1 << 25) >= (bfd_vma) (1 << 26))
 	{
-	  (*_bfd_error_handler) (_("long branch stub `%s' offset overflow"),
-				 stub_entry->root.string);
+	  info->callbacks->einfo (_("long branch stub `%s' offset overflow\n"),
+				  stub_entry->root.string);
 	  htab->stub_error = TRUE;
 	  return FALSE;
 	}
@@ -9630,8 +9612,8 @@ ppc_build_one_stub (struct bfd_hash_entr
 					 FALSE, FALSE);
       if (br_entry == NULL)
 	{
-	  (*_bfd_error_handler) (_("can't find branch stub `%s'"),
-				 stub_entry->root.string);
+	  info->callbacks->einfo (_("can't find branch stub `%s'\n"),
+				  stub_entry->root.string);
 	  htab->stub_error = TRUE;
 	  return FALSE;
 	}
@@ -9691,8 +9673,8 @@ ppc_build_one_stub (struct bfd_hash_entr
 
       if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
 	{
-	  (*_bfd_error_handler)
-	    (_("linkage table error against `%s'"),
+	  info->callbacks->einfo
+	    (_("linkage table error against `%s'\n"),
 	     stub_entry->root.string);
 	  bfd_set_error (bfd_error_bad_value);
 	  htab->stub_error = TRUE;
@@ -9737,7 +9719,7 @@ ppc_build_one_stub (struct bfd_hash_entr
 	}
       else
 	{
-	  bfd_vma r2off = get_r2off (htab, stub_entry);
+	  bfd_vma r2off = get_r2off (info, stub_entry);
 
 	  if (r2off == 0)
 	    {
@@ -9833,8 +9815,8 @@ ppc_build_one_stub (struct bfd_hash_entr
 
       if (off + 0x80008000 > 0xffffffff || (off & 7) != 0)
 	{
-	  (*_bfd_error_handler)
-	    (_("linkage table error against `%s'"),
+	  info->callbacks->einfo
+	    (_("linkage table error against `%s'\n"),
 	     stub_entry->h != NULL
 	     ? stub_entry->h->elf.root.root.string
 	     : "<local sym>");
@@ -9986,7 +9968,7 @@ ppc_size_one_stub (struct bfd_hash_entry
       size = 4;
       if (stub_entry->stub_type == ppc_stub_long_branch_r2off)
 	{
-	  r2off = get_r2off (htab, stub_entry);
+	  r2off = get_r2off (info, stub_entry);
 	  if (r2off == 0)
 	    {
 	      htab->stub_error = TRUE;
@@ -10008,8 +9990,8 @@ ppc_size_one_stub (struct bfd_hash_entry
 					     TRUE, FALSE);
 	  if (br_entry == NULL)
 	    {
-	      (*_bfd_error_handler) (_("can't build branch stub `%s'"),
-				     stub_entry->root.string);
+	      info->callbacks->einfo (_("can't build branch stub `%s'\n"),
+				      stub_entry->root.string);
 	      htab->stub_error = TRUE;
 	      return FALSE;
 	    }
@@ -11151,7 +11133,7 @@ ppc64_elf_size_stubs (struct bfd_link_in
 		      continue;
 		    }
 
-		  stub_entry = ppc_add_stub (stub_name, section, htab);
+		  stub_entry = ppc_add_stub (stub_name, section, info);
 		  if (stub_entry == NULL)
 		    {
 		      free (stub_name);
@@ -11472,7 +11454,7 @@ ppc64_elf_build_stubs (bfd_boolean emit_
       || htab->glink->rawsize != htab->glink->size)
     {
       htab->stub_error = TRUE;
-      (*_bfd_error_handler) (_("stubs don't match calculated size"));
+      info->callbacks->einfo (_("stubs don't match calculated size\n"));
     }
 
   if (htab->stub_error)
@@ -11832,13 +11814,11 @@ ppc64_elf_relocate_section (bfd *output_
 	    /* R_PPC64_TLS is OK against a symbol in the TOC.  */
 	    ;
 	  else
-	    (*_bfd_error_handler)
+	    info->callbacks->einfo
 	      (!IS_PPC64_TLS_RELOC (r_type)
-	       ? _("%B(%A+0x%lx): %s used with TLS symbol %s")
-	       : _("%B(%A+0x%lx): %s used with non-TLS symbol %s"),
-	       input_bfd,
-	       input_section,
-	       (long) rel->r_offset,
+	       ? _("%H: %s used with TLS symbol %s\n")
+	       : _("%H: %s used with non-TLS symbol %s\n"),
+	       input_bfd, input_section, rel->r_offset,
 	       ppc64_elf_howto_table[r_type]->name,
 	       sym_name);
 	}
@@ -12334,23 +12314,19 @@ ppc64_elf_relocate_section (bfd *output_
 				  ".init") == 0
 			  || strcmp (input_section->output_section->name,
 				     ".fini") == 0)
-			(*_bfd_error_handler)
-			  (_("%B(%A+0x%lx): automatic multiple TOCs "
+			info->callbacks->einfo
+			  (_("%H: automatic multiple TOCs "
 			     "not supported using your crt files; "
-			     "recompile with -mminimal-toc or upgrade gcc"),
-			   input_bfd,
-			   input_section,
-			   (long) rel->r_offset);
+			     "recompile with -mminimal-toc or upgrade gcc\n"),
+			   input_bfd, input_section, rel->r_offset);
 		      else
-			(*_bfd_error_handler)
-			  (_("%B(%A+0x%lx): sibling call optimization to `%s' "
+			info->callbacks->einfo
+			  (_("%H: sibling call optimization to `%s' "
 			     "does not allow automatic multiple TOCs; "
 			     "recompile with -mminimal-toc or "
 			     "-fno-optimize-sibling-calls, "
-			     "or make `%s' extern"),
-			   input_bfd,
-			   input_section,
-			   (long) rel->r_offset,
+			     "or make `%s' extern\n"),
+			   input_bfd, input_section, rel->r_offset,
 			   sym_name,
 			   sym_name);
 		      bfd_set_error (bfd_error_bad_value);
@@ -12451,8 +12427,8 @@ ppc64_elf_relocate_section (bfd *output_
       switch (r_type)
 	{
 	default:
-	  (*_bfd_error_handler)
-	    (_("%B: unknown relocation type %d for symbol %s"),
+	  info->callbacks->einfo
+	    (_("%B: unknown relocation type %d for symbol %s\n"),
 	     input_bfd, (int) r_type, sym_name);
 
 	  bfd_set_error (bfd_error_bad_value);
@@ -12956,12 +12932,10 @@ ppc64_elf_relocate_section (bfd *output_
 			  ? h->elf.type == STT_GNU_IFUNC
 			  : ELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC)
 			{
-			  (*_bfd_error_handler)
-			    (_("%B(%A+0x%lx): relocation %s for indirect "
-			       "function %s unsupported"),
-			     input_bfd,
-			     input_section,
-			     (long) rel->r_offset,
+			  info->callbacks->einfo
+			    (_("%H: relocation %s for indirect "
+			       "function %s unsupported\n"),
+			     input_bfd, input_section, rel->r_offset,
 			     ppc64_elf_howto_table[r_type]->name,
 			     sym_name);
 			  ret = FALSE;
@@ -13063,8 +13037,8 @@ ppc64_elf_relocate_section (bfd *output_
 	case R_PPC64_PLTREL64:
 	  /* These ones haven't been implemented yet.  */
 
-	  (*_bfd_error_handler)
-	    (_("%B: relocation %s is not supported for symbol %s."),
+	  info->callbacks->einfo
+	    (_("%B: relocation %s is not supported for symbol %s\n"),
 	     input_bfd,
 	     ppc64_elf_howto_table[r_type]->name, sym_name);
 
@@ -13240,9 +13214,9 @@ ppc64_elf_relocate_section (bfd *output_
 	    mask = 15;
 	  if (((relocation + addend) & mask) != 0)
 	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): error: %s not a multiple of %u"),
-		 input_bfd, input_section, (long) rel->r_offset,
+	      info->callbacks->einfo
+		(_("%H: error: %s not a multiple of %u\n"),
+		 input_bfd, input_section, rel->r_offset,
 		 ppc64_elf_howto_table[r_type]->name,
 		 mask + 1);
 	      bfd_set_error (bfd_error_bad_value);
@@ -13259,11 +13233,9 @@ ppc64_elf_relocate_section (bfd *output_
 	  && !((input_section->flags & SEC_DEBUGGING) != 0
 	       && h->elf.def_dynamic))
 	{
-	  (*_bfd_error_handler)
-	    (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
-	     input_bfd,
-	     input_section,
-	     (long) rel->r_offset,
+	  info->callbacks->einfo
+	    (_("%H: unresolvable %s relocation against symbol `%s'\n"),
+	     input_bfd, input_section, rel->r_offset,
 	     ppc64_elf_howto_table[(int) r_type]->name,
 	     h->elf.root.root.string);
 	  ret = FALSE;
@@ -13306,11 +13278,9 @@ ppc64_elf_relocate_section (bfd *output_
 	    }
 	  else
 	    {
-	      (*_bfd_error_handler)
-		(_("%B(%A+0x%lx): %s reloc against `%s': error %d"),
-		 input_bfd,
-		 input_section,
-		 (long) rel->r_offset,
+	      info->callbacks->einfo
+		(_("%H: %s reloc against `%s': error %d\n"),
+		 input_bfd, input_section, rel->r_offset,
 		 ppc64_elf_howto_table[r_type]->name,
 		 sym_name,
 		 (int) r);
Index: ld/ldmain.c
===================================================================
RCS file: /cvs/src/src/ld/ldmain.c,v
retrieving revision 1.155
diff -u -p -r1.155 ldmain.c
--- ld/ldmain.c	17 May 2011 13:02:18 -0000	1.155
+++ ld/ldmain.c	23 May 2011 01:16:20 -0000
@@ -1399,7 +1399,7 @@ reloc_overflow (struct bfd_link_info *in
   if (overflow_cutoff_limit == -1)
     return TRUE;
 
-  einfo ("%X%C:", abfd, section, address);
+  einfo ("%X%H:", abfd, section, address);
 
   if (overflow_cutoff_limit >= 0
       && overflow_cutoff_limit-- == 0)
@@ -1451,7 +1451,7 @@ reloc_dangerous (struct bfd_link_info *i
 		 asection *section,
 		 bfd_vma address)
 {
-  einfo (_("%X%C: dangerous relocation: %s\n"),
+  einfo (_("%X%H: dangerous relocation: %s\n"),
 	 abfd, section, address, message);
   return TRUE;
 }
@@ -1466,7 +1466,7 @@ unattached_reloc (struct bfd_link_info *
 		  asection *section,
 		  bfd_vma address)
 {
-  einfo (_("%X%C: reloc refers to symbol `%T' which is not being output\n"),
+  einfo (_("%X%H: reloc refers to symbol `%T' which is not being output\n"),
 	 abfd, section, address, name);
   return TRUE;
 }
Index: ld/ldmisc.c
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.c,v
retrieving revision 1.39
diff -u -p -r1.39 ldmisc.c
--- ld/ldmisc.c	28 Feb 2011 18:34:52 -0000	1.39
+++ ld/ldmisc.c	23 May 2011 01:16:20 -0000
@@ -47,6 +47,7 @@
  %E current bfd error or errno
  %F error is fatal
  %G like %D, but only function name
+ %H like %C but in addition emit section+offset
  %I filename from a lang_input_statement_type
  %P print program name
  %R info about a relent
@@ -262,6 +263,7 @@ vfinfo (FILE *fp, const char *fmt, va_li
 	    case 'C':
 	    case 'D':
 	    case 'G':
+	    case 'H':
 	      /* Clever filename:linenumber with function name if possible.
 		 The arguments are a BFD, a section, and an offset.  */
 	      {
@@ -276,6 +278,7 @@ vfinfo (FILE *fp, const char *fmt, va_li
 		const char *functionname;
 		unsigned int linenumber;
 		bfd_boolean discard_last;
+		bfd_boolean done;
 
 		abfd = va_arg (arg, bfd *);
 		section = va_arg (arg, asection *);
@@ -296,14 +299,15 @@ vfinfo (FILE *fp, const char *fmt, va_li
 
 		   We do not always have a line number available so if
 		   we cannot find them we print out the section name and
-		   offset instread.  */
+		   offset instead.  */
 		discard_last = TRUE;
 		if (abfd != NULL
 		    && bfd_find_nearest_line (abfd, section, asymbols, offset,
 					      &filename, &functionname,
 					      &linenumber))
 		  {
-		    if (functionname != NULL && fmt[-1] == 'C')
+		    if (functionname != NULL
+			&& (fmt[-1] == 'C' || fmt[-1] == 'H'))
 		      {
 			/* Detect the case where we are printing out a
 			   message for the same function as the last
@@ -343,15 +347,21 @@ vfinfo (FILE *fp, const char *fmt, va_li
 		    if (filename != NULL)
 		      fprintf (fp, "%s:", filename);
 
+		    done = fmt[-1] != 'H';
 		    if (functionname != NULL && fmt[-1] == 'G')
 		      lfinfo (fp, "%T", functionname);
 		    else if (filename != NULL && linenumber != 0)
-		      fprintf (fp, "%u", linenumber);
+		      fprintf (fp, "%u%s", linenumber, ":" + done);
 		    else
-		      lfinfo (fp, "(%A+0x%v)", section, offset);
+		      done = FALSE;
 		  }
 		else
-		  lfinfo (fp, "%B:(%A+0x%v)", abfd, section, offset);
+		  {
+		    lfinfo (fp, "%B:", abfd);
+		    done = FALSE;
+		  }
+		if (!done)
+		  lfinfo (fp, "(%A+0x%v)", section, offset);
 
 		if (discard_last)
 		  {


-- 
Alan Modra
Australia Development Lab, IBM


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