summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-01-03 16:38:46 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-01-03 16:38:46 +0000
commitcc333d7400f8485141c8aa36dc2d51e1738c5e9c (patch)
tree5d28b501bff8257e0257f38eb41f6ae70359c6ca
parentd703b198f25e8581db8bdeea75bf106633e24d8a (diff)
downloadbcm5719-llvm-cc333d7400f8485141c8aa36dc2d51e1738c5e9c.tar.gz
bcm5719-llvm-cc333d7400f8485141c8aa36dc2d51e1738c5e9c.zip
Refactor duplicated expression.
llvm-svn: 321736
-rw-r--r--lld/ELF/Relocations.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lld/ELF/Relocations.cpp b/lld/ELF/Relocations.cpp
index f22ca683cf6..8c8347cf327 100644
--- a/lld/ELF/Relocations.cpp
+++ b/lld/ELF/Relocations.cpp
@@ -884,8 +884,8 @@ static void scanRelocs(InputSectionBase &Sec, ArrayRef<RelTy> Rels) {
if (maybeReportUndefined(Sym, Sec, Rel.r_offset))
continue;
- RelExpr Expr =
- Target->getRelExpr(Type, Sym, Sec.Data.begin() + Rel.r_offset);
+ const uint8_t *RelocatedAddr = Sec.Data.begin() + Rel.r_offset;
+ RelExpr Expr = Target->getRelExpr(Type, Sym, RelocatedAddr);
// Ignore "hint" relocations because they are only markers for relaxation.
if (isRelExprOneOf<R_HINT, R_NONE>(Expr))
@@ -919,8 +919,7 @@ static void scanRelocs(InputSectionBase &Sec, ArrayRef<RelTy> Rels) {
if (Sym.isGnuIFunc())
Expr = toPlt(Expr);
else if (!Preemptible && Expr == R_GOT_PC && !isAbsoluteValue(Sym))
- Expr =
- Target->adjustRelaxExpr(Type, Sec.Data.data() + Rel.r_offset, Expr);
+ Expr = Target->adjustRelaxExpr(Type, RelocatedAddr, Expr);
else if (!Preemptible)
Expr = fromPlt(Expr);
OpenPOWER on IntegriCloud