diff options
author | Rui Ueyama <ruiu@google.com> | 2017-01-25 21:27:59 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-01-25 21:27:59 +0000 |
commit | 965bed8b824f9d721cefe9bfdbdb44e7b8859b78 (patch) | |
tree | cb7462d6f74ab71d24a03c6d330fe2ec3d96e73f | |
parent | 2467df6e4f04e3d0e8e78d662473ba1b87c0a885 (diff) | |
download | bcm5719-llvm-965bed8b824f9d721cefe9bfdbdb44e7b8859b78.tar.gz bcm5719-llvm-965bed8b824f9d721cefe9bfdbdb44e7b8859b78.zip |
Make error messages more consistent with other messages.
llvm-svn: 293095
-rw-r--r-- | lld/ELF/Target.cpp | 14 | ||||
-rw-r--r-- | lld/test/ELF/invalid/invalid-relocation-x64.s | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lld/ELF/Target.cpp b/lld/ELF/Target.cpp index b4f06d5afaf..85bb7f700fb 100644 --- a/lld/ELF/Target.cpp +++ b/lld/ELF/Target.cpp @@ -45,7 +45,10 @@ using namespace llvm::support::endian; using namespace llvm::ELF; std::string lld::toString(uint32_t Type) { - return getELFRelocationTypeName(elf::Config->EMachine, Type); + StringRef S = getELFRelocationTypeName(elf::Config->EMachine, Type); + if (S == "Unknown") + return ("Unknown (" + Twine(Type) + ")").str(); + return S; } namespace lld { @@ -390,8 +393,7 @@ RelExpr X86TargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const { case R_386_NONE: return R_HINT; default: - error("do not know how to handle relocation '" + toString(Type) + "' (" + - Twine(Type) + ")"); + error("unknown relocation type: " + toString(Type)); return R_HINT; } } @@ -672,8 +674,7 @@ RelExpr X86_64TargetInfo<ELFT>::getRelExpr(uint32_t Type, case R_X86_64_NONE: return R_HINT; default: - error("do not know how to handle relocation '" + toString(Type) + "' (" + - Twine(Type) + ")"); + error("unknown relocation type: " + toString(Type)); return R_HINT; } } @@ -1626,7 +1627,8 @@ RelExpr AMDGPUTargetInfo::getRelExpr(uint32_t Type, const SymbolBody &S) const { case R_AMDGPU_GOTPCREL32_HI: return R_GOT_PC; default: - fatal("do not know how to handle relocation " + Twine(Type)); + error("unknown relocation type: " + toString(Type)); + return R_HINT; } } diff --git a/lld/test/ELF/invalid/invalid-relocation-x64.s b/lld/test/ELF/invalid/invalid-relocation-x64.s index 4934874bf16..3abd636dcef 100644 --- a/lld/test/ELF/invalid/invalid-relocation-x64.s +++ b/lld/test/ELF/invalid/invalid-relocation-x64.s @@ -26,5 +26,5 @@ Sections: Type: R_X86_64_NONE # RUN: not ld.lld %p/Inputs/invalid-relocation-x64.elf -o %t2 2>&1 | FileCheck %s -# CHECK: do not know how to handle relocation 'Unknown' (152) -# CHECK: do not know how to handle relocation 'Unknown' (153) +# CHECK: unknown relocation type: Unknown (152) +# CHECK: unknown relocation type: Unknown (153) |