[3/8] ELF linker messages

Message ID 20180222234128.GJ3812@bubble.grove.modra.org
State New
Headers show
Series
  • [1/8] ppc error/warning messages
Related show

Commit Message

Alan Modra Feb. 22, 2018, 11:41 p.m.
This fixes a number of cases where we capitalized error messages or
printed a full-stop, and corrects "Dwarf" to "DWARF".

bfd/
	* dwarf2.c, * elf-attrs.c, * elf-eh-frame.c, * elf.c, * elf32-gen.c,
	* elflink.c: Standardize error/warning messages.  Replace use of
	linker callback einfo with _bfd_error_handler when possible.
ld/
	* testsuite/ld-elf/indirect.exp,
	* testsuite/ld-elf/pr22649-2ab-mips.msg,
	* testsuite/ld-elf/pr22649-2cd-mips.msg,
	* testsuite/ld-elf/pr22649.msg,
	* testsuite/ld-elf/tls_common.exp,
	* testsuite/ld-elfcomm/elfcomm.exp,
	* testsuite/ld-arm/attr-merge-incompatible.d,
	* testsuite/ld-tic6x/attr-compatibility-gnu-other.d,
	* testsuite/ld-tic6x/attr-compatibility-other-gnu.d,
	* testsuite/ld-tic6x/attr-compatibility-other-other.d,
	* testsuite/ld-i386/warn1.d: Update expected error/warning messages.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8d89b13..7540b69 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,11 @@ 
 2018-02-23  Alan Modra  <amodra@gmail.com>
 
+	* dwarf2.c, * elf-attrs.c, * elf-eh-frame.c, * elf.c, * elf32-gen.c,
+	* elflink.c: Standardize error/warning messages.  Replace use of
+	linker callback einfo with _bfd_error_handler when possible.
+
+2018-02-23  Alan Modra  <amodra@gmail.com>
+
 	* aoutx.h, * coff-alpha.c, * coff-i860.c, * coff-m68k.c,
 	* coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
 	* coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-w65.c,
diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c
index b0173e9..2413542 100644
--- a/bfd/dwarf2.c
+++ b/bfd/dwarf2.c
@@ -540,7 +540,7 @@  read_section (bfd *	      abfd,
 	}
       if (! msec)
 	{
-	  _bfd_error_handler (_("Dwarf Error: Can't find %s section."),
+	  _bfd_error_handler (_("DWARF error: can't find %s section."),
 			      sec->uncompressed_name);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
@@ -569,8 +569,8 @@  read_section (bfd *	      abfd,
   if (offset != 0 && offset >= *section_size)
     {
       /* xgettext: c-format */
-      _bfd_error_handler (_("Dwarf Error: Offset (%" PRIu64 ")"
-			    " greater than or equal to %s size (%" PRIu64 ")."),
+      _bfd_error_handler (_("DWARF error: offset (%" PRIu64 ")"
+			    " greater than or equal to %s size (%" PRIu64 ")"),
 			  (uint64_t) offset, section_name,
 			  (uint64_t) *section_size);
       bfd_set_error (bfd_error_bad_value);
@@ -1087,7 +1087,7 @@  read_attribute_value (struct attribute *  attr,
 
   if (info_ptr >= info_ptr_end && form != DW_FORM_flag_present)
     {
-      _bfd_error_handler (_("Dwarf Error: Info pointer extends beyond end of attributes"));
+      _bfd_error_handler (_("DWARF error: info pointer extends beyond end of attributes"));
       bfd_set_error (bfd_error_bad_value);
       return info_ptr;
     }
@@ -1259,7 +1259,7 @@  read_attribute_value (struct attribute *  attr,
       attr->u.sval = implicit_const;
       break;
     default:
-      _bfd_error_handler (_("Dwarf Error: Invalid or unhandled FORM value: %#x."),
+      _bfd_error_handler (_("DWARF error: invalid or unhandled FORM value: %#x"),
 			  form);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
@@ -1565,7 +1565,7 @@  concat_filename (struct line_info_table *table, unsigned int file)
       /* FILE == 0 means unknown.  */
       if (file)
 	_bfd_error_handler
-	  (_("Dwarf Error: mangled line number section (bad file number)."));
+	  (_("DWARF error: mangled line number section (bad file number)"));
       return strdup ("<unknown>");
     }
 
@@ -1910,7 +1910,7 @@  read_formatted_entries (struct comp_unit *unit, bfd_byte **bufp,
   buf += bytes_read;
   if (format_count == 0 && data_count != 0)
     {
-      _bfd_error_handler (_("Dwarf Error: Zero format count."));
+      _bfd_error_handler (_("DWARF error: zero format count"));
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
     }
@@ -1920,7 +1920,7 @@  read_formatted_entries (struct comp_unit *unit, bfd_byte **bufp,
   if (data_count > (bfd_vma) (buf_end - buf))
     {
       _bfd_error_handler
-	(_("Dwarf Error: data count (%" PRIx64 ") larger than buffer size."),
+	(_("DWARF error: data count (%" PRIx64 ") larger than buffer size"),
 	 (uint64_t) data_count);
       bfd_set_error (bfd_error_bad_value);
       return FALSE;
@@ -1961,7 +1961,7 @@  read_formatted_entries (struct comp_unit *unit, bfd_byte **bufp,
 	      break;
 	    default:
 	      _bfd_error_handler
-		(_("Dwarf Error: Unknown format content type %" PRIu64 "."),
+		(_("DWARF error: unknown format content type %" PRIu64),
 		 (uint64_t) content_type);
 	      bfd_set_error (bfd_error_bad_value);
 	      return FALSE;
@@ -2041,7 +2041,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
   if (stash->dwarf_line_size < 16)
     {
       _bfd_error_handler
-	(_("Dwarf Error: Line info section is too small (%" PRId64 ")"),
+	(_("DWARF error: line info section is too small (%" PRId64 ")"),
 	 (int64_t) stash->dwarf_line_size);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
@@ -2071,7 +2071,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
     {
       _bfd_error_handler
 	/* xgettext: c-format */
-	(_("Dwarf Error: Line info data is bigger (%#" PRIx64 ")"
+	(_("DWARF error: line info data is bigger (%#" PRIx64 ")"
 	   " than the space remaining in the section (%#lx)"),
 	 (uint64_t) lh.total_length, (unsigned long) (line_end - line_ptr));
       bfd_set_error (bfd_error_bad_value);
@@ -2084,7 +2084,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
   if (lh.version < 2 || lh.version > 5)
     {
       _bfd_error_handler
-	(_("Dwarf Error: Unhandled .debug_line version %d."), lh.version);
+	(_("DWARF error: unhandled .debug_line version %d"), lh.version);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
@@ -2094,7 +2094,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
       >= line_end)
     {
       _bfd_error_handler
-	(_("Dwarf Error: Ran out of room reading prologue"));
+	(_("DWARF error: ran out of room reading prologue"));
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
@@ -2112,7 +2112,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
       if (segment_selector_size != 0)
 	{
 	  _bfd_error_handler
-	    (_("Dwarf Error: Line info unsupported segment selector size %u."),
+	    (_("DWARF error: line info unsupported segment selector size %u"),
 	     segment_selector_size);
 	  bfd_set_error (bfd_error_bad_value);
 	  return NULL;
@@ -2139,7 +2139,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
   if (lh.maximum_ops_per_insn == 0)
     {
       _bfd_error_handler
-	(_("Dwarf Error: Invalid maximum operations per instruction."));
+	(_("DWARF error: invalid maximum operations per instruction"));
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
@@ -2158,7 +2158,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
 
   if (line_ptr + (lh.opcode_base - 1) >= line_end)
     {
-      _bfd_error_handler (_("Dwarf Error: Ran out of room reading opcodes"));
+      _bfd_error_handler (_("DWARF error: ran out of room reading opcodes"));
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
@@ -2331,7 +2331,7 @@  decode_line_info (struct comp_unit *unit, struct dwarf2_debug *stash)
 		  break;
 		default:
 		  _bfd_error_handler
-		    (_("Dwarf Error: mangled line number section."));
+		    (_("DWARF error: mangled line number section"));
 		  bfd_set_error (bfd_error_bad_value);
 		line_fail:
 		  if (filename != NULL)
@@ -2834,7 +2834,7 @@  find_abstract_instance (struct comp_unit *   unit,
       if (!die_ref || die_ref >= total)
 	{
 	  _bfd_error_handler
-	    (_("Dwarf Error: Invalid abstract instance DIE ref."));
+	    (_("DWARF error: invalid abstract instance DIE ref"));
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -2871,7 +2871,7 @@  find_abstract_instance (struct comp_unit *   unit,
       if (info_ptr == NULL)
 	{
 	  _bfd_error_handler
-	    (_("Dwarf Error: Unable to read alt ref %" PRIu64 "."),
+	    (_("DWARF error: unable to read alt ref %" PRIu64),
 	     (uint64_t) die_ref);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
@@ -2895,7 +2895,7 @@  find_abstract_instance (struct comp_unit *   unit,
       if (!die_ref || die_ref >= total)
 	{
 	  _bfd_error_handler
-	    (_("Dwarf Error: Invalid abstract instance DIE ref."));
+	    (_("DWARF error: invalid abstract instance DIE ref"));
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -2912,7 +2912,7 @@  find_abstract_instance (struct comp_unit *   unit,
       if (! abbrev)
 	{
 	  _bfd_error_handler
-	    (_("Dwarf Error: Could not find abbrev number %u."), abbrev_number);
+	    (_("DWARF error: could not find abbrev number %u"), abbrev_number);
 	  bfd_set_error (bfd_error_bad_value);
 	  return FALSE;
 	}
@@ -2929,7 +2929,7 @@  find_abstract_instance (struct comp_unit *   unit,
 	      if (info_ptr == orig_info_ptr)
 		{
 		  _bfd_error_handler
-		    (_("Dwarf Error: Abstract instance recursion detected."));
+		    (_("DWARF error: abstract instance recursion detected"));
 		  bfd_set_error (bfd_error_bad_value);
 		  return FALSE;
 		}
@@ -3085,7 +3085,7 @@  scan_unit_for_symbols (struct comp_unit *unit)
 	  if (abbrev_number != previous_failed_abbrev)
 	    {
 	      _bfd_error_handler
-		(_("Dwarf Error: Could not find abbrev number %u."),
+		(_("DWARF error: could not find abbrev number %u"),
 		 abbrev_number);
 	      previous_failed_abbrev = abbrev_number;
 	    }
@@ -3358,8 +3358,8 @@  parse_comp_unit (struct dwarf2_debug *stash,
       if (version)
 	{
 	  _bfd_error_handler
-	    (_("Dwarf Error: found dwarf version '%u', this reader"
-	       " only handles version 2, 3, 4 and 5 information."), version);
+	    (_("DWARF error: found dwarf version '%u', this reader"
+	       " only handles version 2, 3, 4 and 5 information"), version);
 	  bfd_set_error (bfd_error_bad_value);
 	}
       return NULL;
@@ -3402,8 +3402,8 @@  parse_comp_unit (struct dwarf2_debug *stash,
     {
       _bfd_error_handler
 	/* xgettext: c-format */
-	(_("Dwarf Error: found address size '%u', this reader"
-	   " can not handle sizes greater than '%u'."),
+	(_("DWARF error: found address size '%u', this reader"
+	   " can not handle sizes greater than '%u'"),
 	 addr_size,
 	 (unsigned int) sizeof (bfd_vma));
       bfd_set_error (bfd_error_bad_value);
@@ -3413,8 +3413,8 @@  parse_comp_unit (struct dwarf2_debug *stash,
   if (addr_size != 2 && addr_size != 4 && addr_size != 8)
     {
       _bfd_error_handler
-	("Dwarf Error: found address size '%u', this reader"
-	 " can only handle address sizes '2', '4' and '8'.", addr_size);
+	("DWARF error: found address size '%u', this reader"
+	 " can only handle address sizes '2', '4' and '8'", addr_size);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
     }
@@ -3439,7 +3439,7 @@  parse_comp_unit (struct dwarf2_debug *stash,
   abbrev = lookup_abbrev (abbrev_number, abbrevs);
   if (! abbrev)
     {
-      _bfd_error_handler (_("Dwarf Error: Could not find abbrev number %u."),
+      _bfd_error_handler (_("DWARF error: could not find abbrev number %u"),
 			  abbrev_number);
       bfd_set_error (bfd_error_bad_value);
       return NULL;
@@ -3505,7 +3505,7 @@  parse_comp_unit (struct dwarf2_debug *stash,
 	    if (! is_str_attr (attr.form))
 	      {
 		_bfd_error_handler
-		  (_("Dwarf Error: DW_AT_comp_dir attribute encountered with a non-string form."));
+		  (_("DWARF error: DW_AT_comp_dir attribute encountered with a non-string form"));
 		comp_dir = NULL;
 	      }
 
diff --git a/bfd/elf-attrs.c b/bfd/elf-attrs.c
index 670012a..dfdf1a5 100644
--- a/bfd/elf-attrs.c
+++ b/bfd/elf-attrs.c
@@ -601,7 +601,7 @@  _bfd_elf_merge_object_attributes (bfd *ibfd, struct bfd_link_info *info)
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-		(_("error: %pB: Object has vendor-specific contents that "
+		(_("error: %pB: object has vendor-specific contents that "
 		   "must be processed by the '%s' toolchain"),
 		 ibfd, in_attr->s);
 	  return FALSE;
@@ -611,7 +611,7 @@  _bfd_elf_merge_object_attributes (bfd *ibfd, struct bfd_link_info *info)
 	  || (in_attr->i != 0 && strcmp (in_attr->s, out_attr->s) != 0))
 	{
 	  /* xgettext:c-format */
-	  _bfd_error_handler (_("error: %pB: Object tag '%d, %s' is "
+	  _bfd_error_handler (_("error: %pB: object tag '%d, %s' is "
 				"incompatible with tag '%d, %s'"),
 			      ibfd,
 			      in_attr->i, in_attr->s ? in_attr->s : "",
diff --git a/bfd/elf-eh-frame.c b/bfd/elf-eh-frame.c
index d61c915..12f06ef 100644
--- a/bfd/elf-eh-frame.c
+++ b/bfd/elf-eh-frame.c
@@ -1042,9 +1042,9 @@  _bfd_elf_parse_eh_frame (bfd *abfd, struct bfd_link_info *info,
   goto success;
 
  free_no_table:
-  (*info->callbacks->einfo)
+  _bfd_error_handler
     /* xgettext:c-format */
-    (_("%P: error in %pB(%pA); no .eh_frame_hdr table will be created.\n"),
+    (_("error in %pB(%pA); no .eh_frame_hdr table will be created"),
      abfd, sec);
   hdr_info->u.dwarf.table = FALSE;
   if (sec_info)
@@ -1532,16 +1532,16 @@  _bfd_elf_discard_section_eh_frame
 		hdr_info->u.dwarf.table = FALSE;
 		if (num_warnings_issued < 10)
 		  {
-		    (*info->callbacks->einfo)
+		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("%P: FDE encoding in %pB(%pA) prevents .eh_frame_hdr"
-			 " table being created.\n"), abfd, sec);
+		      (_("FDE encoding in %pB(%pA) prevents .eh_frame_hdr"
+			 " table being created"), abfd, sec);
 		    num_warnings_issued ++;
 		  }
 		else if (num_warnings_issued == 10)
 		  {
-		    (*info->callbacks->einfo)
-		      (_("%P: Further warnings about FDE encoding preventing .eh_frame_hdr generation dropped.\n"));
+		    _bfd_error_handler
+		      (_("further warnings about FDE encoding preventing .eh_frame_hdr generation dropped"));
 		    num_warnings_issued ++;
 		  }
 	      }
@@ -2133,9 +2133,9 @@  _bfd_elf_write_section_eh_frame (bfd *abfd,
 			address += elf_gp (abfd);
 			break;
 		      default:
-			(*info->callbacks->einfo)
-			  (_("%P: DW_EH_PE_datarel unspecified"
-			     " for this architecture.\n"));
+			_bfd_error_handler
+			  (_("DW_EH_PE_datarel unspecified"
+			     " for this architecture"));
 			/* Fall thru */
 		      case bfd_arch_frv:
 		      case bfd_arch_i386:
@@ -2304,7 +2304,7 @@  _bfd_elf_fixup_eh_frame_hdr (struct bfd_link_info *info)
       if (sec->output_section != osec)
 	{
 	  _bfd_error_handler
-	    (_("Invalid output section for .eh_frame_entry: %pA"),
+	    (_("invalid output section for .eh_frame_entry: %pA"),
 	     sec->output_section);
 	  return FALSE;
 	}
@@ -2327,7 +2327,7 @@  _bfd_elf_fixup_eh_frame_hdr (struct bfd_link_info *info)
   if (i != 0)
     {
       _bfd_error_handler
-	(_("Invalid contents in %pA section"), osec);
+	(_("invalid contents in %pA section"), osec);
       return FALSE;
     }
 
@@ -2483,10 +2483,9 @@  write_dwarf_eh_frame_hdr (bfd *abfd, struct bfd_link_info *info)
 	    overlap = TRUE;
 	}
       if (overflow)
-	(*info->callbacks->einfo) (_("%P: .eh_frame_hdr entry overflow.\n"));
+	_bfd_error_handler (_(".eh_frame_hdr entry overflow"));
       if (overlap)
-	(*info->callbacks->einfo)
-	  (_("%P: .eh_frame_hdr refers to overlapping FDEs.\n"));
+	_bfd_error_handler (_(".eh_frame_hdr refers to overlapping FDEs"));
       if (overflow || overlap)
 	{
 	  bfd_set_error (bfd_error_bad_value);
diff --git a/bfd/elf.c b/bfd/elf.c
index 5984fe7..7fe975d 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1389,7 +1389,7 @@  copy_special_section_fields (const bfd *ibfd,
 	{
 	  _bfd_error_handler
 	    /* xgettext:c-format */
-	    (_("%pB: Invalid sh_link field (%d) in section number %d"),
+	    (_("%pB: invalid sh_link field (%d) in section number %d"),
 	     ibfd, iheader->sh_link, secnum);
 	  return FALSE;
 	}
@@ -1405,7 +1405,7 @@  copy_special_section_fields (const bfd *ibfd,
 	   if we could not find a match ?  */
 	_bfd_error_handler
 	  /* xgettext:c-format */
-	  (_("%pB: Failed to find link section for section %d"), obfd, secnum);
+	  (_("%pB: failed to find link section for section %d"), obfd, secnum);
     }
 
   if (iheader->sh_info)
@@ -1432,7 +1432,7 @@  copy_special_section_fields (const bfd *ibfd,
       else
 	_bfd_error_handler
 	  /* xgettext:c-format */
-	  (_("%pB: Failed to find info section for section %d"), obfd, secnum);
+	  (_("%pB: failed to find info section for section %d"), obfd, secnum);
     }
 
   return changed;
@@ -3223,7 +3223,7 @@  elf_fake_sections (bfd *abfd, asection *asect, void *fsarg)
     {
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: error: Alignment power %d of section `%pA' is too big"),
+	(_("%pB: error: alignment power %d of section `%pA' is too big"),
 	 abfd, asect->alignment_power, asect);
       arg->failed = TRUE;
       return;
@@ -5472,7 +5472,7 @@  assign_file_positions_for_load_sections (bfd *abfd,
 		      && p->p_paddr < (bfd_vma) off))
 		{
 		  _bfd_error_handler
-		    (_("%pB: Not enough room for program headers,"
+		    (_("%pB: not enough room for program headers,"
 		       " try linking with -N"),
 		     abfd);
 		  bfd_set_error (bfd_error_bad_value);
@@ -6837,9 +6837,10 @@  rewrite_elf_program_header (bfd *ibfd, bfd *obfd)
 	  if (segment->p_type == PT_LOAD
 	      && (segment->p_filesz > 0 || segment->p_memsz == 0))
 	    /* xgettext:c-format */
-	    _bfd_error_handler (_("%pB: warning: Empty loadable segment detected"
-				  " at vaddr=%#" PRIx64 ", is this intentional?"),
-				ibfd, (uint64_t) segment->p_vaddr);
+	    _bfd_error_handler
+	      (_("%pB: warning: empty loadable segment detected"
+		 " at vaddr=%#" PRIx64 ", is this intentional?"),
+	       ibfd, (uint64_t) segment->p_vaddr);
 
 	  map->count = 0;
 	  *pointer_to_map = map;
@@ -7949,10 +7950,11 @@  error_return:
 		  if (shndx == SHN_BAD)
 		    {
 		      /* xgettext:c-format */
-		      _bfd_error_handler (_("\
-Unable to find equivalent output section for symbol '%s' from section '%s'"),
-					  syms[idx]->name ? syms[idx]->name : "<Local sym>",
-					  sec->name);
+		      _bfd_error_handler
+			(_("unable to find equivalent output section"
+			   " for symbol '%s' from section '%s'"),
+			 syms[idx]->name ? syms[idx]->name : "<Local sym>",
+			 sec->name);
 		      bfd_set_error (bfd_error_invalid_operation);
 		      goto error_return;
 		    }
diff --git a/bfd/elf32-gen.c b/bfd/elf32-gen.c
index a521c84..8f9e338 100644
--- a/bfd/elf32-gen.c
+++ b/bfd/elf32-gen.c
@@ -66,7 +66,7 @@  check_for_relocs (bfd * abfd, asection * o, void * failed)
 
       ehdrp = elf_elfheader (abfd);
       /* xgettext:c-format */
-      _bfd_error_handler (_("%pB: Relocations in generic ELF (EM: %d)"),
+      _bfd_error_handler (_("%pB: relocations in generic ELF (EM: %d)"),
 			  abfd, ehdrp->e_machine);
 
       bfd_set_error (bfd_error_wrong_format);
diff --git a/bfd/elflink.c b/bfd/elflink.c
index d9be924..092edae 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -3822,9 +3822,9 @@  elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
 	   && ehdr->e_machine == bed->elf_machine_alt1)
 	  || (bed->elf_machine_alt2 != 0
 	      && ehdr->e_machine == bed->elf_machine_alt2)))
-    info->callbacks->einfo
+    _bfd_error_handler
       /* xgettext:c-format */
-      (_("%P: alternate ELF machine code found (%d) in %pB, expecting %d\n"),
+      (_("alternate ELF machine code found (%d) in %pB, expecting %d"),
        ehdr->e_machine, abfd, bed->elf_machine_code);
 
   /* As a GNU extension, any input sections which are named
@@ -4779,14 +4779,14 @@  error_free_dyn:
 		  if (normal_bfd == NULL)
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("Warning: alignment %u of common symbol `%s' in %pB is"
+		      (_("warning: alignment %u of common symbol `%s' in %pB is"
 			 " greater than the alignment (%u) of its section %pA"),
 		       1 << common_align, name, common_bfd,
 		       1 << normal_align, h->root.u.def.section);
 		  else
 		    _bfd_error_handler
 		      /* xgettext:c-format */
-		      (_("Warning: alignment %u of symbol `%s' in %pB"
+		      (_("warning: alignment %u of symbol `%s' in %pB"
 			 " is smaller than %u in %pB"),
 		       1 << normal_align, name, normal_bfd,
 		       1 << common_align, common_bfd);
@@ -4803,7 +4803,7 @@  error_free_dyn:
 		  && ! size_change_ok)
 		_bfd_error_handler
 		  /* xgettext:c-format */
-		  (_("Warning: size of symbol `%s' changed"
+		  (_("warning: size of symbol `%s' changed"
 		     " from %" PRIu64 " in %pB to %" PRIu64 " in %pB"),
 		   name, (uint64_t) h->size, old_bfd,
 		   (uint64_t) isym->st_size, abfd);
@@ -4838,7 +4838,7 @@  error_free_dyn:
 		  if (h->type != STT_NOTYPE && ! type_change_ok)
 		    /* xgettext:c-format */
 		    _bfd_error_handler
-		      (_("Warning: type of symbol `%s' changed"
+		      (_("warning: type of symbol `%s' changed"
 			 " from %d to %d in %pB"),
 		       name, h->type, type, abfd);
 
@@ -8717,10 +8717,10 @@  elf_link_adjust_relocs (bfd *abfd,
 	  && ! info->gc_keep_exported)
 	{
 	  /* PR 21524: Let the user know if a symbol was removed by garbage collection.  */
-	  _bfd_error_handler (_("%pB:%pA: error: relocation references symbol %s which was removed by garbage collection."),
+	  _bfd_error_handler (_("%pB:%pA: error: relocation references symbol %s which was removed by garbage collection"),
 			      abfd, sec,
 			      (*rel_hash)->root.root.string);
-	  _bfd_error_handler (_("%pB:%pA: error: try relinking with --gc-keep-exported enabled."),
+	  _bfd_error_handler (_("%pB:%pA: error: try relinking with --gc-keep-exported enabled"),
 			      abfd, sec);
 	  bfd_set_error (bfd_error_invalid_operation);
 	  return FALSE;
@@ -8956,7 +8956,7 @@  elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
 		    /* Section size is only divisible by rela.  */
 		    if (use_rela_initialised && !use_rela)
 		      {
-			_bfd_error_handler (_("%pB: Unable to sort relocs - "
+			_bfd_error_handler (_("%pB: unable to sort relocs - "
 					      "they are in more than one size"),
 					    abfd);
 			bfd_set_error (bfd_error_invalid_operation);
@@ -8974,7 +8974,7 @@  elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
 		/* Section size is only divisible by rel.  */
 		if (use_rela_initialised && use_rela)
 		  {
-		    _bfd_error_handler (_("%pB: Unable to sort relocs - "
+		    _bfd_error_handler (_("%pB: unable to sort relocs - "
 					  "they are in more than one size"),
 					abfd);
 		    bfd_set_error (bfd_error_invalid_operation);
@@ -8990,7 +8990,7 @@  elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
 	      {
 		/* The section size is not divisible by either -
 		   something is wrong.  */
-		_bfd_error_handler (_("%pB: Unable to sort relocs - "
+		_bfd_error_handler (_("%pB: unable to sort relocs - "
 				      "they are of an unknown size"), abfd);
 		bfd_set_error (bfd_error_invalid_operation);
 		return 0;
@@ -9013,7 +9013,7 @@  elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
 		    /* Section size is only divisible by rela.  */
 		    if (use_rela_initialised && !use_rela)
 		      {
-			_bfd_error_handler (_("%pB: Unable to sort relocs - "
+			_bfd_error_handler (_("%pB: unable to sort relocs - "
 					      "they are in more than one size"),
 					    abfd);
 			bfd_set_error (bfd_error_invalid_operation);
@@ -9031,7 +9031,7 @@  elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
 		/* Section size is only divisible by rel.  */
 		if (use_rela_initialised && use_rela)
 		  {
-		    _bfd_error_handler (_("%pB: Unable to sort relocs - "
+		    _bfd_error_handler (_("%pB: unable to sort relocs - "
 					  "they are in more than one size"),
 					abfd);
 		    bfd_set_error (bfd_error_invalid_operation);
@@ -9047,7 +9047,7 @@  elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
 	      {
 		/* The section size is not divisible by either -
 		   something is wrong.  */
-		_bfd_error_handler (_("%pB: Unable to sort relocs - "
+		_bfd_error_handler (_("%pB: unable to sort relocs - "
 				      "they are of an unknown size"), abfd);
 		bfd_set_error (bfd_error_invalid_operation);
 		return 0;
@@ -9099,7 +9099,7 @@  elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
   if (sort == NULL)
     {
       (*info->callbacks->warning)
-	(info, _("Not enough memory to sort relocations"), 0, abfd, 0, 0);
+	(info, _("not enough memory to sort relocations"), 0, abfd, 0, 0);
       return 0;
     }
 
@@ -9367,7 +9367,7 @@  check_dynsym (bfd *abfd, Elf_Internal_Sym *sym)
 	 beyond 64k.  */
       _bfd_error_handler
 	/* xgettext:c-format */
-	(_("%pB: Too many sections: %d (>= %d)"),
+	(_("%pB: too many sections: %d (>= %d)"),
 	 abfd, bfd_count_sections (abfd), SHN_LORESERVE & 0xffff);
       bfd_set_error (bfd_error_nonrepresentable_section);
       return FALSE;
@@ -9930,7 +9930,7 @@  elf_link_output_extsym (struct bfd_hash_entry *bh, void *data)
 	    {
 	      _bfd_error_handler
 		/* xgettext:c-format */
-		(_("%pB: No symbol version section for versioned symbol `%s'"),
+		(_("%pB: no symbol version section for versioned symbol `%s'"),
 		 flinfo->output_bfd, h->root.root.string);
 	      eoinfo->failed = TRUE;
 	      return FALSE;
@@ -12553,10 +12553,10 @@  bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
 		{
 		  if (info->error_textrel)
 		    info->callbacks->einfo
-		      (_("%P%X: read-only segment has dynamic relocations.\n"));
+		      (_("%P%X: read-only segment has dynamic relocations\n"));
 		  else
 		    info->callbacks->einfo
-		      (_("%P: warning: creating a DT_TEXTREL in a shared object.\n"));
+		      (_("%P: warning: creating a DT_TEXTREL in a shared object\n"));
 		  break;
 		}
 	    }
@@ -13165,7 +13165,7 @@  elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
 
 	  if (info->print_gc_sections && o->size != 0)
 	    /* xgettext:c-format */
-	    _bfd_error_handler (_("Removing unused section '%pA' in file '%pB'"),
+	    _bfd_error_handler (_("removing unused section '%pA' in file '%pB'"),
 				o, sub);
 	}
     }
@@ -13383,7 +13383,7 @@  bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
   if (!bed->can_gc_sections
       || !is_elf_hash_table (info->hash))
     {
-      _bfd_error_handler(_("Warning: gc-sections option ignored"));
+      _bfd_error_handler(_("warning: gc-sections option ignored"));
       return TRUE;
     }
 
@@ -13509,7 +13509,7 @@  bfd_elf_gc_record_vtinherit (bfd *abfd,
     }
 
   /* xgettext:c-format */
-  _bfd_error_handler (_("%pB: %pA+%#" PRIx64 ": No symbol found for INHERIT"),
+  _bfd_error_handler (_("%pB: %pA+%#" PRIx64 ": no symbol found for INHERIT"),
 		      abfd, sec, (uint64_t) offset);
   bfd_set_error (bfd_error_invalid_operation);
   return FALSE;
@@ -13685,7 +13685,7 @@  bfd_elf_lookup_section_flags (struct bfd_link_info *info,
 	  if (!tf->valid)
 	    {
 	      info->callbacks->einfo
-		(_("Unrecognized INPUT_SECTION_FLAG %s\n"), tf->name);
+		(_("unrecognized INPUT_SECTION_FLAG %s\n"), tf->name);
 	      return FALSE;
 	    }
 	}
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 15d24c6..04aa2c9 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,19 @@ 
 2018-02-23  Alan Modra  <amodra@gmail.com>
 
+	* testsuite/ld-elf/indirect.exp,
+	* testsuite/ld-elf/pr22649-2ab-mips.msg,
+	* testsuite/ld-elf/pr22649-2cd-mips.msg,
+	* testsuite/ld-elf/pr22649.msg,
+	* testsuite/ld-elf/tls_common.exp,
+	* testsuite/ld-elfcomm/elfcomm.exp,
+	* testsuite/ld-arm/attr-merge-incompatible.d,
+	* testsuite/ld-tic6x/attr-compatibility-gnu-other.d,
+	* testsuite/ld-tic6x/attr-compatibility-other-gnu.d,
+	* testsuite/ld-tic6x/attr-compatibility-other-other.d,
+	* testsuite/ld-i386/warn1.d: Update expected error/warning messages.
+
+2018-02-23  Alan Modra  <amodra@gmail.com>
+
 	* testsuite/ld-powerpc/attr-gnu-12-21.d,
 	* testsuite/ld-powerpc/attr-gnu-4-12.d,
 	* testsuite/ld-powerpc/attr-gnu-4-13.d,
diff --git a/ld/testsuite/ld-arm/attr-merge-incompatible.d b/ld/testsuite/ld-arm/attr-merge-incompatible.d
index 41711da..74cf90c 100644
--- a/ld/testsuite/ld-arm/attr-merge-incompatible.d
+++ b/ld/testsuite/ld-arm/attr-merge-incompatible.d
@@ -2,4 +2,4 @@ 
 #source: attr-merge-incompatiblea.s
 #as:
 #ld:
-#error: Object has vendor-specific contents that must be processed by the '.+' toolchain
+#error: object has vendor-specific contents that must be processed by the '.+' toolchain
diff --git a/ld/testsuite/ld-elf/indirect.exp b/ld/testsuite/ld-elf/indirect.exp
index 9fa2bac..71664e7 100644
--- a/ld/testsuite/ld-elf/indirect.exp
+++ b/ld/testsuite/ld-elf/indirect.exp
@@ -124,7 +124,7 @@  set cmd "$ld -e start -o tmpdir/indirect1 tmpdir/indirect1a.o tmpdir/libindirect
 check_link_message "$cmd" [list $string1 $string] "$testname"
 
 set string ": final link failed: Nonrepresentable section on output"
-set string2 ": No symbol version section for versioned symbol \`foo@FOO\'"
+set string2 ": no symbol version section for versioned symbol \`foo@FOO\'"
 set testname "Indirect symbol 2"
 set cmd "$ld -shared  -o tmpdir/indirect2.so tmpdir/indirect2.o"
 check_link_message "$cmd" [list $string2 $string] "$testname"
diff --git a/ld/testsuite/ld-elf/pr22649-2ab-mips.msg b/ld/testsuite/ld-elf/pr22649-2ab-mips.msg
index e27e6e4..e819cc0 100644
--- a/ld/testsuite/ld-elf/pr22649-2ab-mips.msg
+++ b/ld/testsuite/ld-elf/pr22649-2ab-mips.msg
@@ -1,2 +1,2 @@ 
-.*: Removing unused section '\.data' in file 'tmpdir/pr22649-2.\.o'
-.*: Removing unused section '\.(?:reginfo|MIPS\.options)' in file 'tmpdir/pr22649-2.\.o'
+.*: removing unused section '\.data' in file 'tmpdir/pr22649-2.\.o'
+.*: removing unused section '\.(?:reginfo|MIPS\.options)' in file 'tmpdir/pr22649-2.\.o'
diff --git a/ld/testsuite/ld-elf/pr22649-2cd-mips.msg b/ld/testsuite/ld-elf/pr22649-2cd-mips.msg
index 6a7aa77..a513d82 100644
--- a/ld/testsuite/ld-elf/pr22649-2cd-mips.msg
+++ b/ld/testsuite/ld-elf/pr22649-2cd-mips.msg
@@ -1 +1 @@ 
-.*: Removing unused section '\.(?:reginfo|MIPS\.options)' in file 'tmpdir/pr22649-2.\.o'
+.*: removing unused section '\.(?:reginfo|MIPS\.options)' in file 'tmpdir/pr22649-2.\.o'
diff --git a/ld/testsuite/ld-elf/pr22649.msg b/ld/testsuite/ld-elf/pr22649.msg
index 66b5f25..76d64a4 100644
--- a/ld/testsuite/ld-elf/pr22649.msg
+++ b/ld/testsuite/ld-elf/pr22649.msg
@@ -1,3 +1,3 @@ 
 #...
-.*: Removing unused section '\.data' in file 'tmpdir/pr22649-2.*\.o'
+.*: removing unused section '\.data' in file 'tmpdir/pr22649-2.*\.o'
 #pass
diff --git a/ld/testsuite/ld-elf/tls_common.exp b/ld/testsuite/ld-elf/tls_common.exp
index 80b0efa..ce3ec90 100644
--- a/ld/testsuite/ld-elf/tls_common.exp
+++ b/ld/testsuite/ld-elf/tls_common.exp
@@ -57,7 +57,7 @@  if { ![ld_link $ld tmpdir/tls_commona "tmpdir/tls_common1a.o"] } {
     if { [string match "*not supported*" $link_output]
 	 || [string match "*unrecognized option*" $link_output] } {
 	unsupported "$ld_options is not supported by this target"
-    } elseif { [string match "*Warning*alignment*of common symbol*" $link_output] } {
+    } elseif { [string match "*warning*alignment*of common symbol*" $link_output] } {
 	fail "tls_common"
     } else {
 	unresolved "tls_common"
@@ -69,7 +69,7 @@  if { ![ld_link $ld tmpdir/tls_commonb "tmpdir/tls_common1b.o"] } {
     if { [string match "*not supported*" $link_output]
 	 || [string match "*unrecognized option*" $link_output] } {
 	unsupported "$ld_options is not supported by this target"
-    } elseif { [string match "*Warning*alignment*of common symbol*" $link_output] } {
+    } elseif { [string match "*warning*alignment*of common symbol*" $link_output] } {
 	fail "tls_common"
     } else {
 	unresolved "tls_common"
diff --git a/ld/testsuite/ld-elfcomm/elfcomm.exp b/ld/testsuite/ld-elfcomm/elfcomm.exp
index 4f3ebdd..7aafd82 100644
--- a/ld/testsuite/ld-elfcomm/elfcomm.exp
+++ b/ld/testsuite/ld-elfcomm/elfcomm.exp
@@ -199,14 +199,14 @@  if { [ld_link $ld tmpdir/common1.o $options] } {
 # This test fails on MIPS because the backend sets type_change_ok.
 # The size change warning is suppressed.  Same on hppa64.
 if {[istarget mips*-*-*] || [istarget hppa*64*-*-*]} {
-    if { ![regexp "Warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output] } {
+    if { ![regexp "warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output] } {
         fail $test1w1
     } else {
         pass $test1w1
     }
 } else {
-    if { ![regexp "Warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output]
-         || ![regexp "Warning: size of symbol \`_?foo1\' changed from 2 in tmpdir/common1a.o to 21 in tmpdir/common1b.o" $link_output] } {
+    if { ![regexp "warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output]
+         || ![regexp "warning: size of symbol \`_?foo1\' changed from 2 in tmpdir/common1a.o to 21 in tmpdir/common1b.o" $link_output] } {
         fail $test1w1
     } else {
         pass $test1w1
@@ -233,7 +233,7 @@  if { [ld_link $ld tmpdir/common1.o $options] } {
     return
 }
 
-if { ![regexp "Warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output] } {
+if { ![regexp "warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output] } {
     fail $test1w2
 } else {
     pass $test1w2
diff --git a/ld/testsuite/ld-i386/warn1.d b/ld/testsuite/ld-i386/warn1.d
index dd541f2..3c78f31 100644
--- a/ld/testsuite/ld-i386/warn1.d
+++ b/ld/testsuite/ld-i386/warn1.d
@@ -1,4 +1,4 @@ 
 #name: --warn-shared-textrel --fatal-warnings
 #as: --32
 #ld: -shared -melf_i386 --warn-shared-textrel --fatal-warnings
-#error: .*warning: creating a DT_TEXTREL in a shared object.
+#error: .*warning: creating a DT_TEXTREL in a shared object
diff --git a/ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d b/ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d
index 423ab07..e232314 100644
--- a/ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d
+++ b/ld/testsuite/ld-tic6x/attr-compatibility-gnu-other.d
@@ -3,4 +3,4 @@ 
 #ld: -r -melf32_tic6x_le
 #source: attr-compatibility-gnu.s
 #source: attr-compatibility-other.s
-#error: .*Object has vendor-specific contents that must be processed by the 'other' toolchain
+#error: .*object has vendor-specific contents that must be processed by the 'other' toolchain
diff --git a/ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d b/ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d
index 80d73e5..d60dd90 100644
--- a/ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d
+++ b/ld/testsuite/ld-tic6x/attr-compatibility-other-gnu.d
@@ -3,4 +3,4 @@ 
 #ld: -r -melf32_tic6x_le
 #source: attr-compatibility-other.s
 #source: attr-compatibility-gnu.s
-#error: .*Object tag '1, gnu' is incompatible with tag '1, other'
+#error: .*object tag '1, gnu' is incompatible with tag '1, other'
diff --git a/ld/testsuite/ld-tic6x/attr-compatibility-other-other.d b/ld/testsuite/ld-tic6x/attr-compatibility-other-other.d
index 0ebd99b..f1a5a20 100644
--- a/ld/testsuite/ld-tic6x/attr-compatibility-other-other.d
+++ b/ld/testsuite/ld-tic6x/attr-compatibility-other-other.d
@@ -3,4 +3,4 @@ 
 #ld: -r -melf32_tic6x_le
 #source: attr-compatibility-other.s
 #source: attr-compatibility-other.s
-#error: .*Object has vendor-specific contents that must be processed by the 'other' toolchain
+#error: .*object has vendor-specific contents that must be processed by the 'other' toolchain