[llvm] r361384 - [llvm-objcopy] Tidy up error messages

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 06:23:26 PDT 2019


Author: jhenderson
Date: Wed May 22 06:23:26 2019
New Revision: 361384

URL: http://llvm.org/viewvc/llvm-project?rev=361384&view=rev
Log:
[llvm-objcopy] Tidy up error messages

This patch brings various error messages into line with each other, by
removing trailing full stops, and making the first letter lower-case.
This addresses https://bugs.llvm.org/show_bug.cgi?id=40859.

Reviewed by: jhenderson, rupprecht, jakehehrlich

Differential Revision: https://reviews.llvm.org/D62072

Patch by Alex Brachet

Modified:
    llvm/trunk/test/tools/llvm-objcopy/COFF/remove-section.test
    llvm/trunk/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test
    llvm/trunk/test/tools/llvm-objcopy/COFF/weak-external.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/bad-build-id.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/binary-out-error.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/discard-locals-rel.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/dump-section.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/dynsym-error-remove-strtab.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/remove-linked-section.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/section-index-unsupported.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/strip-group-symbol.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/strip-section-err.test
    llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test
    llvm/trunk/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
    llvm/trunk/tools/llvm-objcopy/COFF/Object.cpp
    llvm/trunk/tools/llvm-objcopy/COFF/Reader.cpp
    llvm/trunk/tools/llvm-objcopy/COFF/Writer.cpp
    llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
    llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp

Modified: llvm/trunk/test/tools/llvm-objcopy/COFF/remove-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/COFF/remove-section.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/COFF/remove-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/COFF/remove-section.test Wed May 22 06:23:26 2019
@@ -96,7 +96,7 @@
 # Removing the .comdat section fails, since the .text section has relocations
 # against it.
 #
-# ERROR-RELOC: Relocation target 'foo' ({{.*}}) not found
+# ERROR-RELOC: relocation target 'foo' ({{.*}}) not found
 #
 #
 # Removing the .comdat section and .text (with a relocation against .comdat)

Modified: llvm/trunk/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/COFF/strip-reloc-symbol.test Wed May 22 06:23:26 2019
@@ -2,4 +2,4 @@ RUN: yaml2obj %p/Inputs/strip-symbols.ya
 RUN: not llvm-objcopy -N foo %t.o 2>&1 | FileCheck %s --check-prefix=ERROR
 RUN: not llvm-objcopy --strip-symbol foo %t.o 2>&1 | FileCheck %s --check-prefix=ERROR
 
-ERROR: error: '{{.*}}{{/|\\}}strip-reloc-symbol.test.tmp.o': not stripping symbol 'foo' because it is named in a relocation.
+ERROR: error: '{{.*}}{{/|\\}}strip-reloc-symbol.test.tmp.o': not stripping symbol 'foo' because it is named in a relocation

Modified: llvm/trunk/test/tools/llvm-objcopy/COFF/weak-external.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/COFF/weak-external.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/COFF/weak-external.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/COFF/weak-external.test Wed May 22 06:23:26 2019
@@ -15,7 +15,7 @@
 # SYMBOLS-POST-NEXT: AUX indx 0
 # SYMBOLS-EMPTY:
 
-# ERROR: Symbol 'foobar' is missing its weak target
+# ERROR: symbol 'foobar' is missing its weak target
 
 --- !COFF
 header:          

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/bad-build-id.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/bad-build-id.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/bad-build-id.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/bad-build-id.test Wed May 22 06:23:26 2019
@@ -1,7 +1,7 @@
 # RUN: yaml2obj %s > %t
 # RUN: not llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug %t 2>&1 >/dev/null | FileCheck %s
 
-# CHECK: build ID is smaller than two bytes.
+# CHECK: build ID is smaller than two bytes
 
 --- !ELF
 FileHeader:

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/binary-out-error.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/binary-out-error.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/binary-out-error.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/binary-out-error.test Wed May 22 06:23:26 2019
@@ -1,2 +1,2 @@
 # RUN: not llvm-objcopy -O binary %p/Inputs/alloc-symtab.o %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=SYMTAB
-# SYMTAB: Cannot write symbol table '.symtab' out to binary
+# SYMTAB: cannot write symbol table '.symtab' out to binary

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/discard-locals-rel.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/discard-locals-rel.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/discard-locals-rel.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/discard-locals-rel.test Wed May 22 06:23:26 2019
@@ -23,4 +23,4 @@ Symbols:
     Type:     STT_FUNC
     Section:  .text
 
-# CHECK: not stripping symbol '.L.rel' because it is named in a relocation.
+# CHECK: not stripping symbol '.L.rel' because it is named in a relocation

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/dump-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/dump-section.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/dump-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/dump-section.test Wed May 22 06:23:26 2019
@@ -41,4 +41,4 @@ ProgramHeaders:
 
 #SIZE: 4
 
-#NOBITS: Can't dump section ".bar": it has no contents
+#NOBITS: cannot dump section '.bar': it has no contents

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/dynrelocsec-remove-shlink-reference.test Wed May 22 06:23:26 2019
@@ -3,7 +3,7 @@
 ## Check we cannot remove the .dynsym symbol table because dynamic
 ## relocation section .rela.dyn still references it via sh_link field.
 # RUN: not llvm-objcopy -R .dynsym %t %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR
-# ERR: error: Symbol table .dynsym cannot be removed because it is referenced by the relocation section .rela.dyn.
+# ERR: error: symbol table '.dynsym' cannot be removed because it is referenced by the relocation section '.rela.dyn'
 
 ## Check we can remove .dynsym after removing the reference.
 # RUN: llvm-objcopy -R .dynsym -R .rela.dyn %t %t2

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/dynsym-error-remove-strtab.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/dynsym-error-remove-strtab.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/dynsym-error-remove-strtab.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/dynsym-error-remove-strtab.test Wed May 22 06:23:26 2019
@@ -2,7 +2,7 @@
 # RUN: cp  %p/Inputs/dynsym.so %t2
 # RUN: not llvm-strip --no-strip-all -R .dynstr %t2 2>&1 >/dev/null | FileCheck %s --check-prefix=ERR
 
-# ERR: Section .dynstr cannot be removed because it is referenced by the section .dynsym
+# ERR: section '.dynstr' cannot be removed because it is referenced by the section '.dynsym'
 
 # RUN: llvm-objcopy --allow-broken-links -R .dynstr %p/Inputs/dynsym.so %t3
 # RUN: llvm-objdump --section-headers %t3 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.dynstr

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/group-addr-misaligned.test Wed May 22 06:23:26 2019
@@ -1,6 +1,6 @@
 # RUN: yaml2obj %s > %t
 # RUN: not llvm-objcopy %t %t2 2>&1 | FileCheck %s
-# CHECK: error: Invalid alignment 1 of group section .group.
+# CHECK: error: invalid alignment 1 of group section '.group'
 
 # In this test, we check that llvm-objcopy reports an error
 # for SHT_GROUP section with invalid alignment (not a multiple of 4). 

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/hexagon-unsupported-on-x86.test Wed May 22 06:23:26 2019
@@ -12,4 +12,4 @@ Symbols:
     Index:    SHN_HEXAGON_SCOMMON
     Binding:  STB_GLOBAL
 
-# CHECK: Symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65280
+# CHECK: symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65280

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id-no-notes.test Wed May 22 06:23:26 2019
@@ -1,7 +1,7 @@
 # RUN: yaml2obj %s > %t
 # RUN: not llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug %t 2>&1 >/dev/null | FileCheck %s
 
-# CHECK: Could not find build ID.
+# CHECK: could not find build ID
 
 --- !ELF
 FileHeader:

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/no-build-id.test Wed May 22 06:23:26 2019
@@ -1,7 +1,7 @@
 # RUN: yaml2obj %s > %t
 # RUN: not llvm-objcopy --build-id-link-dir=%t-dir --build-id-link-input=.debug %t 2>&1 >/dev/null | FileCheck %s
 
-# CHECK: Could not find build ID.
+# CHECK: could not find build ID
 
 --- !ELF
 FileHeader:

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/reloc-error-remove-symtab.test Wed May 22 06:23:26 2019
@@ -31,7 +31,7 @@ Symbols:
     Size:     4
     Binding:  STB_GLOBAL
 
-# ERR: Symbol table .symtab cannot be removed because it is referenced by the relocation section .rel.text.
+# ERR: symbol table '.symtab' cannot be removed because it is referenced by the relocation section '.rel.text'
 
 # RUN: llvm-objcopy --allow-broken-links -R .symtab %t %t4
 # RUN: llvm-readobj --sections %t4 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.symtab

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/remove-linked-section.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/remove-linked-section.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/remove-linked-section.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/remove-linked-section.test Wed May 22 06:23:26 2019
@@ -16,7 +16,7 @@ Sections:
     Type:            SHT_PROGBITS
     Link:            .foo
 
-# ERR: Section .foo cannot be removed because it is referenced by the section .bar
+# ERR: section '.foo' cannot be removed because it is referenced by the section '.bar'
 
 # RUN: llvm-objcopy --allow-broken-links -R .foo %t.o %t3
 # RUN: llvm-readobj --sections %t3 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.foo

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/remove-shstrtab-error.test Wed May 22 06:23:26 2019
@@ -8,4 +8,4 @@ FileHeader:
   Type:            ET_REL
   Machine:         EM_X86_64
 
-# CHECK: Cannot write section header table because section header string table was removed.
+# CHECK: cannot write section header table because section header string table was removed

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/section-index-unsupported.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/section-index-unsupported.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/section-index-unsupported.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/section-index-unsupported.test Wed May 22 06:23:26 2019
@@ -12,4 +12,4 @@ Symbols:
     Index:    0xff05
     Binding:  STB_GLOBAL
 
-# CHECK: Symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65285
+# CHECK: symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65285

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/strip-group-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/strip-group-symbol.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/strip-group-symbol.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/strip-group-symbol.test Wed May 22 06:23:26 2019
@@ -28,4 +28,4 @@ Symbols:
     Section: .text
     Binding: STB_WEAK
 
-#CHECK: Symbol foo cannot be removed because it is referenced by the section .group[1].
+# CHECK: symbol 'foo' cannot be removed because it is referenced by the section '.group[1]'

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/strip-reloc-symbol.test Wed May 22 06:23:26 2019
@@ -28,4 +28,4 @@ Symbols:
     Value:    0x1000
     Size:     8
 
-#CHECK: not stripping symbol 'foo' because it is named in a relocation.
+# CHECK: not stripping symbol 'foo' because it is named in a relocation

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/strip-section-err.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/strip-section-err.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/strip-section-err.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/strip-section-err.test Wed May 22 06:23:26 2019
@@ -3,7 +3,7 @@
 
 # RUN: yaml2obj %s > %t1
 # RUN: not llvm-objcopy -R .data %t1 2>&1 | FileCheck %s
-# CHECK: error: Section .data can't be removed: (.text+0x1) has relocation against symbol 'foo'
+# CHECK: error: section '.data' cannot be removed: (.text+0x1) has relocation against symbol 'foo'
 
 ## Check the behavior when we also remove the relocation section.
 ## We have no reference in this case and hence no error should be emitted.

Modified: llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test (original)
+++ llvm/trunk/test/tools/llvm-objcopy/ELF/symtab-error-on-remove-strtab.test Wed May 22 06:23:26 2019
@@ -10,7 +10,7 @@ FileHeader:
   Type:            ET_REL
   Machine:         EM_X86_64
 
-# ERR: String table .strtab cannot be removed because it is referenced by the symbol table .symtab
+# ERR: string table '.strtab' cannot be removed because it is referenced by the symbol table '.symtab'
 
 # RUN: llvm-objcopy --allow-broken-links -R .strtab %t %t4
 # RUN: llvm-objdump --section-headers %t4 | FileCheck %s --check-prefix=SECTIONS --implicit-check-not=.strtab

Modified: llvm/trunk/tools/llvm-objcopy/COFF/COFFObjcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/COFF/COFFObjcopy.cpp?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/COFF/COFFObjcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/COFF/COFFObjcopy.cpp Wed May 22 06:23:26 2019
@@ -143,7 +143,7 @@ static Error handleArgs(const CopyConfig
         reportError(Config.OutputFilename,
                     createStringError(llvm::errc::invalid_argument,
                                       "not stripping symbol '%s' because it is "
-                                      "named in a relocation.",
+                                      "named in a relocation",
                                       Sym.Name.str().c_str()));
       return true;
     }
@@ -189,7 +189,7 @@ static Error handleArgs(const CopyConfig
       Config.DiscardMode == DiscardType::Locals ||
       !Config.SymbolsToAdd.empty() || Config.EntryExpr) {
     return createStringError(llvm::errc::invalid_argument,
-                             "Option not supported by llvm-objcopy for COFF");
+                             "option not supported by llvm-objcopy for COFF");
   }
 
   return Error::success();

Modified: llvm/trunk/tools/llvm-objcopy/COFF/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/COFF/Object.cpp?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/COFF/Object.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/COFF/Object.cpp Wed May 22 06:23:26 2019
@@ -53,7 +53,7 @@ Error Object::markSymbols() {
       auto It = SymbolMap.find(R.Target);
       if (It == SymbolMap.end())
         return createStringError(object_error::invalid_symbol_index,
-                                 "Relocation target %zu not found", R.Target);
+                                 "relocation target %zu not found", R.Target);
       It->second->Referenced = true;
     }
   }

Modified: llvm/trunk/tools/llvm-objcopy/COFF/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/COFF/Reader.cpp?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/COFF/Reader.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/COFF/Reader.cpp Wed May 22 06:23:26 2019
@@ -81,7 +81,7 @@ Error COFFReader::readSections(Object &O
       return NameOrErr.takeError();
     if (Sec->hasExtendedRelocations())
       return createStringError(object_error::parse_failed,
-                               "Extended relocations not supported yet");
+                               "extended relocations not supported yet");
   }
   Obj.addSections(Sections);
   return Error::success();
@@ -135,7 +135,7 @@ Error COFFReader::readSymbols(Object &Ob
       Sym.TargetSectionId = Sections[SymRef.getSectionNumber() - 1].UniqueId;
     else
       return createStringError(object_error::parse_failed,
-                               "Section number out of range");
+                               "section number out of range");
     // For section definitions, check if it is comdat associative, and if
     // it is, find the target section unique id.
     const coff_aux_section_definition *SD = SymRef.getSectionDefinition();
@@ -144,7 +144,7 @@ Error COFFReader::readSymbols(Object &Ob
       int32_t Index = SD->getNumber(IsBigObj);
       if (Index <= 0 || static_cast<uint32_t>(Index - 1) >= Sections.size())
         return createStringError(object_error::parse_failed,
-                                 "Unexpected associative section index");
+                                 "unexpected associative section index");
       Sym.AssociativeComdatTargetSectionId = Sections[Index - 1].UniqueId;
     } else if (WE) {
       // This is a raw symbol index for now, but store it in the Symbol
@@ -171,11 +171,11 @@ Error COFFReader::setSymbolTargets(Objec
     if (Sym.WeakTargetSymbolId) {
       if (*Sym.WeakTargetSymbolId >= RawSymbolTable.size())
         return createStringError(object_error::parse_failed,
-                                 "Weak external reference out of range");
+                                 "weak external reference out of range");
       const Symbol *Target = RawSymbolTable[*Sym.WeakTargetSymbolId];
       if (Target == nullptr)
         return createStringError(object_error::parse_failed,
-                                 "Invalid SymbolTableIndex");
+                                 "invalid SymbolTableIndex");
       Sym.WeakTargetSymbolId = Target->UniqueId;
     }
   }
@@ -187,7 +187,7 @@ Error COFFReader::setSymbolTargets(Objec
       const Symbol *Sym = RawSymbolTable[R.Reloc.SymbolTableIndex];
       if (Sym == nullptr)
         return createStringError(object_error::parse_failed,
-                                 "Invalid SymbolTableIndex");
+                                 "invalid SymbolTableIndex");
       R.Target = Sym->UniqueId;
       R.TargetName = Sym->Name;
     }
@@ -208,7 +208,7 @@ Expected<std::unique_ptr<Object>> COFFRe
   } else {
     if (!CBFH)
       return createStringError(object_error::parse_failed,
-                               "No COFF file header returned");
+                               "no COFF file header returned");
     // Only copying the few fields from the bigobj header that we need
     // and won't recreate in the end.
     Obj->CoffFileHeader.Machine = CBFH->Machine;

Modified: llvm/trunk/tools/llvm-objcopy/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/COFF/Writer.cpp?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/COFF/Writer.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/COFF/Writer.cpp Wed May 22 06:23:26 2019
@@ -29,7 +29,7 @@ Error COFFWriter::finalizeRelocTargets()
       const Symbol *Sym = Obj.findSymbol(R.Target);
       if (Sym == nullptr)
         return createStringError(object_error::invalid_symbol_index,
-                                 "Relocation target '%s' (%zu) not found",
+                                 "relocation target '%s' (%zu) not found",
                                  R.TargetName.str().c_str(), R.Target);
       R.Reloc.SymbolTableIndex = Sym->RawIndex;
     }
@@ -47,7 +47,7 @@ Error COFFWriter::finalizeSymbolContents
       const Section *Sec = Obj.findSection(Sym.TargetSectionId);
       if (Sec == nullptr)
         return createStringError(object_error::invalid_symbol_index,
-                                 "Symbol '%s' points to a removed section",
+                                 "symbol '%s' points to a removed section",
                                  Sym.Name.str().c_str());
       Sym.Sym.SectionNumber = Sec->Index;
 
@@ -66,7 +66,7 @@ Error COFFWriter::finalizeSymbolContents
           if (Sec == nullptr)
             return createStringError(
                 object_error::invalid_symbol_index,
-                "Symbol '%s' is associative to a removed section",
+                "symbol '%s' is associative to a removed section",
                 Sym.Name.str().c_str());
           SDSectionNumber = Sec->Index;
         }
@@ -83,7 +83,7 @@ Error COFFWriter::finalizeSymbolContents
       const Symbol *Target = Obj.findSymbol(*Sym.WeakTargetSymbolId);
       if (Target == nullptr)
         return createStringError(object_error::invalid_symbol_index,
-                                 "Symbol '%s' is missing its weak target",
+                                 "symbol '%s' is missing its weak target",
                                  Sym.Name.str().c_str());
       WE->TagIndex = Target->RawIndex;
     }
@@ -383,7 +383,7 @@ Error COFFWriter::patchDebugDirectory()
       if (Dir->RelativeVirtualAddress + Dir->Size >
           S.Header.VirtualAddress + S.Header.SizeOfRawData)
         return createStringError(object_error::parse_failed,
-                                 "Debug directory extends past end of section");
+                                 "debug directory extends past end of section");
 
       size_t Offset = Dir->RelativeVirtualAddress - S.Header.VirtualAddress;
       uint8_t *Ptr = Buf.getBufferStart() + S.Header.PointerToRawData + Offset;
@@ -400,14 +400,14 @@ Error COFFWriter::patchDebugDirectory()
     }
   }
   return createStringError(object_error::parse_failed,
-                           "Debug directory not found");
+                           "debug directory not found");
 }
 
 Error COFFWriter::write() {
   bool IsBigObj = Obj.getSections().size() > MaxNumberOfSections16;
   if (IsBigObj && Obj.IsPE)
     return createStringError(object_error::parse_failed,
-                             "Too many sections for executable");
+                             "too many sections for executable");
   return write(IsBigObj);
 }
 

Modified: llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/ELF/ELFObjcopy.cpp Wed May 22 06:23:26 2019
@@ -168,7 +168,7 @@ findBuildID(const object::ELFFile<ELFT>
       return std::move(Err);
   }
   return createStringError(llvm::errc::invalid_argument,
-                           "Could not find build ID.");
+                           "could not find build ID");
 }
 
 static Expected<ArrayRef<uint8_t>>
@@ -186,7 +186,7 @@ findBuildID(const object::ELFObjectFileB
 }
 
 template <class... Ts>
-static Error makeStringError(std::error_code EC, const Twine &Msg, Ts&&... Args) {
+static Error makeStringError(std::error_code EC, const Twine &Msg, Ts &&... Args) {
   std::string FullMsg = (EC.message() + ": " + Msg).str();
   return createStringError(EC, FullMsg.c_str(), std::forward<Ts>(Args)...);
 }
@@ -222,16 +222,16 @@ static Error linkToBuildIdDir(const Copy
                             /*MakeAbsolute*/ false);
   if (auto EC = sys::fs::create_hard_link(ToLink, TmpPath)) {
     Path.push_back('\0');
-    return makeStringError(EC, "cannot link %s to %s", ToLink.data(),
-                             Path.data());
+    return makeStringError(EC, "cannot link '%s' to '%s'", ToLink.data(),
+                           Path.data());
   }
   // We then atomically rename the link into place which will just move the
   // link. If rename fails something is more seriously wrong so just return
   // an error.
   if (auto EC = sys::fs::rename(TmpPath, Path)) {
     Path.push_back('\0');
-    return makeStringError(EC, "cannot link %s to %s", ToLink.data(),
-                             Path.data());
+    return makeStringError(EC, "cannot link '%s' to '%s'", ToLink.data(),
+                           Path.data());
   }
   // If `Path` was already a hard-link to the same underlying file then the
   // temp file will be left so we need to remove it. Remove will not cause
@@ -239,7 +239,7 @@ static Error linkToBuildIdDir(const Copy
   // it rather than checking.
   if (auto EC = sys::fs::remove(TmpPath)) {
     TmpPath.push_back('\0');
-    return makeStringError(EC, "could not remove %s", TmpPath.data());
+    return makeStringError(EC, "could not remove '%s'", TmpPath.data());
   }
   return Error::success();
 }
@@ -250,7 +250,7 @@ static Error splitDWOToFile(const CopyCo
   auto OnlyKeepDWOPred = [&DWOFile](const SectionBase &Sec) {
     return onlyKeepDWOPred(*DWOFile, Sec);
   };
-  if (Error E = DWOFile->removeSections(Config.AllowBrokenLinks,
+  if (Error E = DWOFile->removeSections(Config.AllowBrokenLinks, 
                                         OnlyKeepDWOPred))
     return E;
   if (Config.OutputArch) {
@@ -269,10 +269,9 @@ static Error dumpSectionToFile(StringRef
   for (auto &Sec : Obj.sections()) {
     if (Sec.Name == SecName) {
       if (Sec.OriginalData.empty())
-        return createStringError(
-            object_error::parse_failed,
-            "Can't dump section \"%s\": it has no contents",
-            SecName.str().c_str());
+        return createStringError(object_error::parse_failed,
+                                 "cannot dump section '%s': it has no contents",
+                                 SecName.str().c_str());
       Expected<std::unique_ptr<FileOutputBuffer>> BufferOrErr =
           FileOutputBuffer::create(Filename, Sec.OriginalData.size());
       if (!BufferOrErr)
@@ -285,7 +284,8 @@ static Error dumpSectionToFile(StringRef
       return Error::success();
     }
   }
-  return createStringError(object_error::parse_failed, "Section not found");
+  return createStringError(object_error::parse_failed, "section '%s' not found",
+                           SecName.str().c_str());
 }
 
 static bool isCompressable(const SectionBase &Section) {
@@ -534,11 +534,11 @@ static Error replaceAndRemoveSections(co
   }
 
   if (Config.CompressionType != DebugCompressionType::None)
-    replaceDebugSections(Obj, RemovePred, isCompressable,
+    replaceDebugSections(Obj, RemovePred, isCompressable, 
                          [&Config, &Obj](const SectionBase *S) {
                            return &Obj.addSection<CompressedSection>(
-                               *S, Config.CompressionType);
-                         });
+                                *S, Config.CompressionType);
+                        });
   else if (Config.DecompressDebugSections)
     replaceDebugSections(
         Obj, RemovePred,
@@ -600,13 +600,13 @@ static Error handleArgs(const CopyConfig
           Sec.Name = (Config.AllocSectionsPrefix + Sec.Name).str();
           PrefixedSections.insert(&Sec);
 
-        // Rename relocation sections associated to the allocated sections.
-        // For example, if we rename .text to .prefix.text, we also rename
-        // .rel.text to .rel.prefix.text.
-        //
-        // Dynamic relocation sections (SHT_REL[A] with SHF_ALLOC) are handled
-        // above, e.g., .rela.plt is renamed to .prefix.rela.plt, not
-        // .rela.prefix.plt since GNU objcopy does so.
+          // Rename relocation sections associated to the allocated sections.
+          // For example, if we rename .text to .prefix.text, we also rename
+          // .rel.text to .rel.prefix.text.
+          //
+          // Dynamic relocation sections (SHT_REL[A] with SHF_ALLOC) are handled
+          // above, e.g., .rela.plt is renamed to .prefix.rela.plt, not
+          // .rela.prefix.plt since GNU objcopy does so.
         } else if (auto *RelocSec = dyn_cast<RelocationSectionBase>(&Sec)) {
           auto *TargetSec = RelocSec->getSection();
           if (TargetSec && (TargetSec->Flags & SHF_ALLOC)) {
@@ -735,7 +735,7 @@ Error executeObjcopyOnBinary(const CopyC
       return createFileError(
           Config.InputFilename,
           createStringError(object_error::parse_failed,
-                            "build ID is smaller than two bytes."));
+                            "build ID is smaller than two bytes"));
   }
 
   if (!Config.BuildIdLinkDir.empty() && Config.BuildIdLinkInput)

Modified: llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp?rev=361384&r1=361383&r2=361384&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp (original)
+++ llvm/trunk/tools/llvm-objcopy/ELF/Object.cpp Wed May 22 06:23:26 2019
@@ -124,23 +124,23 @@ template <class ELFT>
 void ELFSectionSizer<ELFT>::visit(DecompressedSection &Sec) {}
 
 void BinarySectionWriter::visit(const SectionIndexSection &Sec) {
-  error("Cannot write symbol section index table '" + Sec.Name + "' ");
+  error("cannot write symbol section index table '" + Sec.Name + "' ");
 }
 
 void BinarySectionWriter::visit(const SymbolTableSection &Sec) {
-  error("Cannot write symbol table '" + Sec.Name + "' out to binary");
+  error("cannot write symbol table '" + Sec.Name + "' out to binary");
 }
 
 void BinarySectionWriter::visit(const RelocationSection &Sec) {
-  error("Cannot write relocation section '" + Sec.Name + "' out to binary");
+  error("cannot write relocation section '" + Sec.Name + "' out to binary");
 }
 
 void BinarySectionWriter::visit(const GnuDebugLinkSection &Sec) {
-  error("Cannot write '" + Sec.Name + "' out to binary");
+  error("cannot write '" + Sec.Name + "' out to binary");
 }
 
 void BinarySectionWriter::visit(const GroupSection &Sec) {
-  error("Cannot write '" + Sec.Name + "' out to binary");
+  error("cannot write '" + Sec.Name + "' out to binary");
 }
 
 void SectionWriter::visit(const Section &Sec) {
@@ -202,7 +202,7 @@ void ELFSectionWriter<ELFT>::visit(const
 }
 
 void BinarySectionWriter::visit(const DecompressedSection &Sec) {
-  error("Cannot write compressed section '" + Sec.Name + "' ");
+  error("cannot write compressed section '" + Sec.Name + "' ");
 }
 
 void DecompressedSection::accept(SectionVisitor &Visitor) const {
@@ -222,7 +222,7 @@ void OwnedDataSection::accept(MutableSec
 }
 
 void BinarySectionWriter::visit(const CompressedSection &Sec) {
-  error("Cannot write compressed section '" + Sec.Name + "' ");
+  error("cannot write compressed section '" + Sec.Name + "' ");
 }
 
 template <class ELFT>
@@ -433,8 +433,8 @@ Error SymbolTableSection::removeSectionR
     if (!AllowBrokenLinks)
       return createStringError(
           llvm::errc::invalid_argument,
-          "String table %s cannot be removed because it is "
-          "referenced by the symbol table %s",
+          "string table '%s' cannot be removed because it is "
+          "referenced by the symbol table '%s'",
           SymbolNames->Name.data(), this->Name.data());
     SymbolNames = nullptr;
   }
@@ -523,7 +523,7 @@ void SymbolTableSection::fillShndxTable(
 
 const Symbol *SymbolTableSection::getSymbolByIndex(uint32_t Index) const {
   if (Symbols.size() <= Index)
-    error("Invalid symbol index: " + Twine(Index));
+    error("invalid symbol index: " + Twine(Index));
   return Symbols[Index].get();
 }
 
@@ -565,8 +565,8 @@ Error RelocationSection::removeSectionRe
     if (!AllowBrokenLinks)
       return createStringError(
           llvm::errc::invalid_argument,
-          "Symbol table %s cannot be removed because it is "
-          "referenced by the relocation section %s.",
+          "symbol table '%s' cannot be removed because it is "
+          "referenced by the relocation section '%s'",
           Symbols->Name.data(), this->Name.data());
     Symbols = nullptr;
   }
@@ -575,7 +575,7 @@ Error RelocationSection::removeSectionRe
     if (!R.RelocSymbol->DefinedIn || !ToRemove(R.RelocSymbol->DefinedIn))
       continue;
     return createStringError(llvm::errc::invalid_argument,
-                             "Section %s can't be removed: (%s+0x%" PRIx64
+                             "section '%s' cannot be removed: (%s+0x%" PRIx64
                              ") has relocation against symbol '%s'",
                              R.RelocSymbol->DefinedIn->Name.data(),
                              SecToApplyRel->Name.data(), R.Offset,
@@ -653,7 +653,7 @@ Error RelocationSection::removeSymbols(
     if (ToRemove(*Reloc.RelocSymbol))
       return createStringError(
           llvm::errc::invalid_argument,
-          "not stripping symbol '%s' because it is named in a relocation.",
+          "not stripping symbol '%s' because it is named in a relocation",
           Reloc.RelocSymbol->Name.data());
   return Error::success();
 }
@@ -680,37 +680,37 @@ void DynamicRelocationSection::accept(Se
 }
 
 void DynamicRelocationSection::accept(MutableSectionVisitor &Visitor) {
-  Visitor.visit(*this);
-}
-
-Error DynamicRelocationSection::removeSectionReferences(
-    bool AllowBrokenLinks, function_ref<bool(const SectionBase *)> ToRemove) {
-  if (ToRemove(Symbols)) {
-    if (!AllowBrokenLinks)
-      return createStringError(
-          llvm::errc::invalid_argument,
-          "Symbol table %s cannot be removed because it is "
-          "referenced by the relocation section %s.",
-          Symbols->Name.data(), this->Name.data());
-    Symbols = nullptr;
-  }
-
-  // SecToApplyRel contains a section referenced by sh_info field. It keeps
-  // a section to which the relocation section applies. When we remove any
-  // sections we also remove their relocation sections. Since we do that much
-  // earlier, this assert should never be triggered.
-  assert(!SecToApplyRel || !ToRemove(SecToApplyRel));
-
-  return Error::success();
-}
-
-Error Section::removeSectionReferences(bool AllowBrokenDependency,
-    function_ref<bool(const SectionBase *)> ToRemove) {
-  if (ToRemove(LinkSection)) {
+  Visitor.visit(*this);
+}
+
+Error DynamicRelocationSection::removeSectionReferences(
+    bool AllowBrokenLinks, function_ref<bool(const SectionBase *)> ToRemove) {
+  if (ToRemove(Symbols)) {
+    if (!AllowBrokenLinks)
+      return createStringError(
+          llvm::errc::invalid_argument,
+          "symbol table '%s' cannot be removed because it is "
+          "referenced by the relocation section '%s'",
+          Symbols->Name.data(), this->Name.data());
+    Symbols = nullptr;
+  }
+
+  // SecToApplyRel contains a section referenced by sh_info field. It keeps
+  // a section to which the relocation section applies. When we remove any
+  // sections we also remove their relocation sections. Since we do that much
+  // earlier, this assert should never be triggered.
+  assert(!SecToApplyRel || !ToRemove(SecToApplyRel));
+
+  return Error::success();
+}
+
+Error Section::removeSectionReferences(bool AllowBrokenDependency,
+    function_ref<bool(const SectionBase *)> ToRemove) {
+  if (ToRemove(LinkSection)) {
     if (!AllowBrokenDependency)
       return createStringError(llvm::errc::invalid_argument,
-                               "Section %s cannot be removed because it is "
-                               "referenced by the section %s",
+                               "section '%s' cannot be removed because it is "
+                               "referenced by the section '%s'",
                                LinkSection->Name.data(), this->Name.data());
     LinkSection = nullptr;
   }
@@ -725,8 +725,8 @@ void GroupSection::finalize() {
 Error GroupSection::removeSymbols(function_ref<bool(const Symbol &)> ToRemove) {
   if (ToRemove(*Sym))
     return createStringError(llvm::errc::invalid_argument,
-                             "Symbol %s cannot be removed because it is "
-                             "referenced by the section %s[%d].",
+                             "symbol '%s' cannot be removed because it is "
+                             "referenced by the section '%s[%d]'",
                              Sym->Name.data(), this->Name.data(), this->Index);
   return Error::success();
 }
@@ -996,24 +996,24 @@ template <class ELFT> void ELFBuilder<EL
 template <class ELFT>
 void ELFBuilder<ELFT>::initGroupSection(GroupSection *GroupSec) {
   if (GroupSec->Align % sizeof(ELF::Elf32_Word) != 0)
-    error("Invalid alignment " + Twine(GroupSec->Align) + " of group section " +
-          GroupSec->Name);
+    error("invalid alignment " + Twine(GroupSec->Align) + " of group section '" +
+          GroupSec->Name + "'");
   auto SecTable = Obj.sections();
   auto SymTab = SecTable.template getSectionOfType<SymbolTableSection>(
       GroupSec->Link,
-      "Link field value " + Twine(GroupSec->Link) + " in section " +
-          GroupSec->Name + " is invalid",
-      "Link field value " + Twine(GroupSec->Link) + " in section " +
-          GroupSec->Name + " is not a symbol table");
+      "link field value '" + Twine(GroupSec->Link) + "' in section '" +
+          GroupSec->Name + "' is invalid",
+      "link field value '" + Twine(GroupSec->Link) + "' in section '" +
+          GroupSec->Name + "' is not a symbol table");
   auto Sym = SymTab->getSymbolByIndex(GroupSec->Info);
   if (!Sym)
-    error("Info field value " + Twine(GroupSec->Info) + " in section " +
-          GroupSec->Name + " is not a valid symbol index");
+    error("info field value '" + Twine(GroupSec->Info) + "' in section '" +
+          GroupSec->Name + "' is not a valid symbol index");
   GroupSec->setSymTab(SymTab);
   GroupSec->setSymbol(Sym);
   if (GroupSec->Contents.size() % sizeof(ELF::Elf32_Word) ||
       GroupSec->Contents.empty())
-    error("The content of the section " + GroupSec->Name + " is malformed");
+    error("the content of the section " + GroupSec->Name + " is malformed");
   const ELF::Elf32_Word *Word =
       reinterpret_cast<const ELF::Elf32_Word *>(GroupSec->Contents.data());
   const ELF::Elf32_Word *End =
@@ -1022,8 +1022,8 @@ void ELFBuilder<ELFT>::initGroupSection(
   for (; Word != End; ++Word) {
     uint32_t Index = support::endian::read32<ELFT::TargetEndianness>(Word);
     GroupSec->addMember(SecTable.getSection(
-        Index, "Group member index " + Twine(Index) + " in section " +
-                   GroupSec->Name + " is invalid"));
+        Index, "group member index " + Twine(Index) + " in section '" +
+                   GroupSec->Name + "' is invalid"));
   }
 }
 
@@ -1040,31 +1040,31 @@ void ELFBuilder<ELFT>::initSymbolTable(S
 
     if (Sym.st_shndx == SHN_XINDEX) {
       if (SymTab->getShndxTable() == nullptr)
-        error("Symbol '" + Name +
-              "' has index SHN_XINDEX but no SHT_SYMTAB_SHNDX section exists.");
+        error("symbol '" + Name +
+              "' has index SHN_XINDEX but no SHT_SYMTAB_SHNDX section exists");
       if (ShndxData.data() == nullptr) {
         const Elf_Shdr &ShndxSec =
             *unwrapOrError(ElfFile.getSection(SymTab->getShndxTable()->Index));
         ShndxData = unwrapOrError(
             ElfFile.template getSectionContentsAsArray<Elf_Word>(&ShndxSec));
         if (ShndxData.size() != Symbols.size())
-          error("Symbol section index table does not have the same number of "
-                "entries as the symbol table.");
+          error("symbol section index table does not have the same number of "
+                "entries as the symbol table");
       }
       Elf_Word Index = ShndxData[&Sym - Symbols.begin()];
       DefSection = Obj.sections().getSection(
           Index,
-          "Symbol '" + Name + "' has invalid section index " + Twine(Index));
+          "symbol '" + Name + "' has invalid section index " + Twine(Index));
     } else if (Sym.st_shndx >= SHN_LORESERVE) {
       if (!isValidReservedSectionIndex(Sym.st_shndx, Obj.Machine)) {
         error(
-            "Symbol '" + Name +
+            "symbol '" + Name +
             "' has unsupported value greater than or equal to SHN_LORESERVE: " +
             Twine(Sym.st_shndx));
       }
     } else if (Sym.st_shndx != SHN_UNDEF) {
       DefSection = Obj.sections().getSection(
-          Sym.st_shndx, "Symbol '" + Name +
+          Sym.st_shndx, "symbol '" + Name +
                             "' is defined has invalid section index " +
                             Twine(Sym.st_shndx));
     }
@@ -1290,7 +1290,7 @@ std::unique_ptr<Object> ELFReader::creat
     Builder.build();
     return Obj;
   }
-  error("Invalid file type");
+  error("invalid file type");
 }
 
 template <class ELFT> void ELFWriter<ELFT>::writeEhdr() {
@@ -1625,8 +1625,8 @@ template <class ELFT> Error ELFWriter<EL
   // to do that.
   if (Obj.SectionNames == nullptr && WriteSectionHeaders)
     return createStringError(llvm::errc::invalid_argument,
-                             "Cannot write section header table because "
-                             "section header string table was removed.");
+                             "cannot write section header table because "
+                             "section header string table was removed");
 
   Obj.sortSections();
 




More information about the llvm-commits mailing list