[lld] r272133 - [ELF] Replace getELFRelocationTypeName() calls with getRelName(). NFC.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 8 05:22:27 PDT 2016
Author: grimar
Date: Wed Jun 8 07:22:26 2016
New Revision: 272133
URL: http://llvm.org/viewvc/llvm-project?rev=272133&view=rev
Log:
[ELF] Replace getELFRelocationTypeName() calls with getRelName(). NFC.
That made few places in code a bit shorter.
Modified:
lld/trunk/ELF/Relocations.cpp
lld/trunk/ELF/Target.cpp
Modified: lld/trunk/ELF/Relocations.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=272133&r1=272132&r2=272133&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Wed Jun 8 07:22:26 2016
@@ -58,6 +58,8 @@ using namespace llvm::support::endian;
namespace lld {
namespace elf {
+StringRef getRelName(uint32_t Type);
+
static bool refersToGotEntry(RelExpr Expr) {
return Expr == R_GOT || Expr == R_GOT_OFF || Expr == R_MIPS_GOT_LOCAL ||
Expr == R_MIPS_GOT_LOCAL_PAGE || Expr == R_GOT_PAGE_PC ||
@@ -235,10 +237,8 @@ static int32_t findMipsPairedAddend(cons
return ((read32<E>(BufLoc) & 0xffff) << 16) +
readSignedLo16<E>(Buf + RI->r_offset);
}
- unsigned OldType = Rel->getType(Config->Mips64EL);
- StringRef OldName = getELFRelocationTypeName(Config->EMachine, OldType);
- StringRef NewName = getELFRelocationTypeName(Config->EMachine, Type);
- warning("can't find matching " + NewName + " relocation for " + OldName);
+ warning("can't find matching " + getRelName(Type) + " relocation for " +
+ getRelName(Rel->getType(Config->Mips64EL)));
return 0;
}
@@ -300,9 +300,8 @@ static bool isStaticLinkTimeConstant(Rel
if (AbsVal && RelE) {
if (Body.isUndefined() && !Body.isLocal() && Body.symbol()->isWeak())
return true;
- StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
- error("relocation " + S + " cannot refer to absolute symbol " +
- Body.getName());
+ error("relocation " + getRelName(Type) +
+ " cannot refer to absolute symbol " + Body.getName());
return true;
}
@@ -400,9 +399,8 @@ static RelExpr adjustExpr(const elf::Obj
// only memory. We can hack around it if we are producing an executable and
// the refered symbol can be preemepted to refer to the executable.
if (Config->Shared || (Config->Pic && !isRelExpr(Expr))) {
- StringRef S = getELFRelocationTypeName(Config->EMachine, Type);
- error("relocation " + S + " cannot be used when making a shared "
- "object; recompile with -fPIC.");
+ error("relocation " + getRelName(Type) +
+ " cannot be used when making a shared object; recompile with -fPIC.");
return Expr;
}
if (Body.getVisibility() != STV_DEFAULT) {
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=272133&r1=272132&r2=272133&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Wed Jun 8 07:22:26 2016
@@ -47,7 +47,7 @@ TargetInfo *Target;
static void or32le(uint8_t *P, int32_t V) { write32le(P, read32le(P) | V); }
-static StringRef getRelName(uint32_t Type) {
+StringRef getRelName(uint32_t Type) {
return getELFRelocationTypeName(Config->EMachine, Type);
}
More information about the llvm-commits
mailing list