diff options
| author | James Henderson <jh7370@my.bristol.ac.uk> | 2019-05-22 13:23:26 +0000 |
|---|---|---|
| committer | James Henderson <jh7370@my.bristol.ac.uk> | 2019-05-22 13:23:26 +0000 |
| commit | 5316a0d200f8072bc6ef25f2e2707de9eca84a54 (patch) | |
| tree | 32a3ba3d2caf46e0f5abe26db18f8d462c35fd77 /llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | |
| parent | 0e7994718bc4210584ada6b0a80bf315baafc293 (diff) | |
| download | bcm5719-llvm-5316a0d200f8072bc6ef25f2e2707de9eca84a54.tar.gz bcm5719-llvm-5316a0d200f8072bc6ef25f2e2707de9eca84a54.zip | |
[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
llvm-svn: 361384
Diffstat (limited to 'llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp')
| -rw-r--r-- | llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp index 072e5f074d1..b14af2c128b 100644 --- a/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp +++ b/llvm/tools/llvm-objcopy/ELF/ELFObjcopy.cpp @@ -168,7 +168,7 @@ findBuildID(const object::ELFFile<ELFT> &In) { 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::ELFObjectFileBase &In) { } 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 CopyConfig &Config, StringRef ToLink, /*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 CopyConfig &Config, StringRef ToLink, // 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 CopyConfig &Config, const Reader &Reader, 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 SecName, StringRef Filename, 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 SecName, StringRef Filename, 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(const CopyConfig &Config, Object &Obj) { } 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 &Config, Object &Obj, 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 CopyConfig &Config, 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) |

