[PATCH] D48929: [ELF] Update addends in non-allocatable sections for REL targets when creating a relocatable output.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 10 06:55:10 PDT 2018


grimar accepted this revision.
grimar added a comment.
This revision is now accepted and ready to land.

This LGTM. The minor suggestion is below.



================
Comment at: ELF/InputSection.cpp:744
+    Target->relocateOne(BufLoc, Rel.Type, TargetVA);
+  }
+}
----------------
Maybe I would make it even shorter:

```
  const unsigned Bits = Config->Is64 ? 64 : 32;
  for (const Relocation &Rel : Sec->Relocations) {
    assert(Rel.Expr == R_ABS);
    Target->relocateOne(Buf + Rel.Offset + Sec->OutSecOff, Rel.Type,
                        SignExtend64(Rel.Sym->getVA(Rel.Addend), Bits));
  }
```


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48929





More information about the llvm-commits mailing list