[lld] r293095 - Make error messages more consistent with other messages.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 25 13:27:59 PST 2017
Author: ruiu
Date: Wed Jan 25 15:27:59 2017
New Revision: 293095
URL: http://llvm.org/viewvc/llvm-project?rev=293095&view=rev
Log:
Make error messages more consistent with other messages.
Modified:
lld/trunk/ELF/Target.cpp
lld/trunk/test/ELF/invalid/invalid-relocation-x64.s
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=293095&r1=293094&r2=293095&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Jan 25 15:27:59 2017
@@ -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
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>::getRelEx
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(uin
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;
}
}
Modified: lld/trunk/test/ELF/invalid/invalid-relocation-x64.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/invalid/invalid-relocation-x64.s?rev=293095&r1=293094&r2=293095&view=diff
==============================================================================
--- lld/trunk/test/ELF/invalid/invalid-relocation-x64.s (original)
+++ lld/trunk/test/ELF/invalid/invalid-relocation-x64.s Wed Jan 25 15:27:59 2017
@@ -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)
More information about the llvm-commits
mailing list