[lld] r298796 - Remove a redundant local variable.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 25 20:42:01 PDT 2017
Author: ruiu
Date: Sat Mar 25 22:42:00 2017
New Revision: 298796
URL: http://llvm.org/viewvc/llvm-project?rev=298796&view=rev
Log:
Remove a redundant local variable.
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=298796&r1=298795&r2=298796&view=diff
==============================================================================
--- lld/trunk/ELF/Relocations.cpp (original)
+++ lld/trunk/ELF/Relocations.cpp Sat Mar 25 22:42:00 2017
@@ -506,10 +506,9 @@ template <class ELFT>
static RelExpr adjustExpr(SymbolBody &Body, RelExpr Expr, uint32_t Type,
const uint8_t *Data, InputSectionBase &S,
typename ELFT::uint RelOff) {
- bool Preemptible = isPreemptible(Body, Type);
if (Body.isGnuIFunc()) {
Expr = toPlt(Expr);
- } else if (!Preemptible) {
+ } else if (!isPreemptible(Body, Type)) {
if (needsPlt(Expr))
Expr = fromPlt(Expr);
if (Expr == R_GOT_PC && !isAbsoluteValue(Body))
@@ -531,11 +530,13 @@ static RelExpr adjustExpr(SymbolBody &Bo
" defined in " + toString(Body.File));
return Expr;
}
+
if (Body.getVisibility() != STV_DEFAULT) {
error(S.getLocation<ELFT>(RelOff) + ": cannot preempt symbol '" +
toString(Body) + "' defined in " + toString(Body.File));
return Expr;
}
+
if (Body.isObject()) {
// Produce a copy relocation.
auto *B = cast<SharedSymbol>(&Body);
@@ -549,6 +550,7 @@ static RelExpr adjustExpr(SymbolBody &Bo
}
return Expr;
}
+
if (Body.isFunc()) {
// This handles a non PIC program call to function in a shared library. In
// an ideal world, we could just report an error saying the relocation can
@@ -573,9 +575,9 @@ static RelExpr adjustExpr(SymbolBody &Bo
Body.NeedsPltAddr = true;
return toPlt(Expr);
}
+
error("symbol '" + toString(Body) + "' defined in " + toString(Body.File) +
" is missing type");
-
return Expr;
}
Modified: lld/trunk/ELF/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Target.cpp?rev=298796&r1=298795&r2=298796&view=diff
==============================================================================
--- lld/trunk/ELF/Target.cpp (original)
+++ lld/trunk/ELF/Target.cpp Sat Mar 25 22:42:00 2017
@@ -929,12 +929,14 @@ RelExpr X86_64TargetInfo<ELFT>::adjustRe
return RelExpr;
const uint8_t Op = Data[-2];
const uint8_t ModRm = Data[-1];
+
// FIXME: When PIC is disabled and foo is defined locally in the
// lower 32 bit address space, memory operand in mov can be converted into
// immediate operand. Otherwise, mov must be changed to lea. We support only
// latter relaxation at this moment.
if (Op == 0x8b)
return R_RELAX_GOT_PC;
+
// Relax call and jmp.
if (Op == 0xff && (ModRm == 0x15 || ModRm == 0x25))
return R_RELAX_GOT_PC;
More information about the llvm-commits
mailing list