[PATCH] D29129: [LLD][ELF] Use Synthetic Sections for Thunks

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 26 11:59:44 PST 2017


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

LGTM



================
Comment at: ELF/Relocations.cpp:861-866
+    Thunk<ELFT> *T = ThunkedSymbols.lookup(&Body);
+    if (T)
+      return std::make_pair(T, false);
+    T = addThunk<ELFT>(Type, Body);
+    ThunkedSymbols[&Body] = T;
+    return std::make_pair(T, true);
----------------
This code looks up ThunkedSymbols twice with the same key. I wonder if you can avoid that by doing something like this with a reference.

  Thunk<ELFT> *&T = ThunkedSymbols[&Body];
  if (T)
    return std::make_pair(T, false);
  T = addThunk<ELFT>(Type, Body);
  return std::make_pair(T, true);


================
Comment at: ELF/Thunks.h:47
+  // typical code section alignment.
+  virtual uint32_t alignment() const { return 4; }
   const SymbolBody &Destination;
----------------
nit: Can you make this a member variable set by ctor to avoid the cost of virtual function call?


https://reviews.llvm.org/D29129





More information about the llvm-commits mailing list