[PATCH] D27778: Rename InputSection.cpp:getSymVA to getTargetVA.

Sean Silva via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 14:28:16 PST 2016

silvas created this revision.
silvas added a reviewer: ruiu.
silvas added a subscriber: llvm-commits.

This name was really confusing because there is also another static
helper Symbols.cpp:getSymVA which has the same name.

Any other naming suggestions are welcome. I just want to make it clear that this is different from Symbols.cpp:getSymVA. InputSection.cpp:getSymVA calls into Body.getVA which calls Symbols.cpp:getSymVA, so it also doesn't make much sense and makes the code harder to understand: they return different things, they should not be called `get<the-same-thing>`.



Index: ELF/InputSection.cpp
--- ELF/InputSection.cpp
+++ ELF/InputSection.cpp
@@ -337,9 +337,9 @@
 template <class ELFT>
-static typename ELFT::uint getSymVA(uint32_t Type, typename ELFT::uint A,
-                                    typename ELFT::uint P,
-                                    const SymbolBody &Body, RelExpr Expr) {
+static typename ELFT::uint
+getRelocTargetVA(uint32_t Type, typename ELFT::uint A, typename ELFT::uint P,
+                 const SymbolBody &Body, RelExpr Expr) {
   switch (Expr) {
   case R_HINT:
@@ -507,7 +507,7 @@
     uint64_t SymVA = 0;
     if (!Sym.isTls() || Out<ELFT>::TlsPhdr)
       SymVA = SignExtend64<sizeof(uintX_t) * 8>(
-          getSymVA<ELFT>(Type, Addend, AddrLoc, Sym, R_ABS));
+          getRelocTargetVA<ELFT>(Type, Addend, AddrLoc, Sym, R_ABS));
     Target->relocateOne(BufLoc, Type, SymVA);
@@ -535,8 +535,8 @@
     uintX_t AddrLoc = OutSec->Addr + Offset;
     RelExpr Expr = Rel.Expr;
-    uint64_t SymVA =
-        SignExtend64<Bits>(getSymVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, Expr));
+    uint64_t SymVA = SignExtend64<Bits>(
+        getRelocTargetVA<ELFT>(Type, A, AddrLoc, *Rel.Sym, Expr));
     switch (Expr) {
     case R_RELAX_GOT_PC:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27778.81472.patch
Type: text/x-patch
Size: 1317 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161214/d592d010/attachment.bin>

More information about the llvm-commits mailing list