[PATCH] D44962: ELF: Allow thunks to change size. NFCI.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 27 19:25:00 PDT 2018


ruiu added inline comments.


================
Comment at: lld/ELF/Thunks.cpp:146
+                          InputSectionBase &Section) {
+  auto *D = addSyntheticLocal(Name, Type, Value, /*Size=*/0, Section);
+  Syms.push_back(D);
----------------
auto -> Defined


================
Comment at: lld/ELF/Thunks.cpp:346-349
 void MicroMipsThunk::addSymbols(ThunkSection &IS) {
-  ThunkSym =
-      addSyntheticLocal(Saver.save("__microLA25Thunk_" + Destination.getName()),
-                        STT_FUNC, Offset, size(), IS);
-  ThunkSym->StOther |= STO_MIPS_MICROMIPS;
+  addSymbol(Saver.save("__microLA25Thunk_" + Destination.getName()), STT_FUNC,
+            0, IS)
+      ->StOther |= STO_MIPS_MICROMIPS;
----------------
Perhaps a personal preference, but I'd use a temporary variable like this

  Defined *D = addSymbol(...);
  D->StOther |= ...;


================
Comment at: lld/ELF/Thunks.h:59
   Symbol &Destination;
-  Symbol *ThunkSym;
+  llvm::SmallVector<Defined *, 3> Syms;
   uint64_t Offset = 0;
----------------
Can you add a comment somewhere why you could have more than one symbol for one thunk?


https://reviews.llvm.org/D44962





More information about the llvm-commits mailing list