[PATCH] D52156: [LLD] [COFF] Alternative ARM range thunk algorithm

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 17 16:45:54 PDT 2018


ruiu added a comment.

I think I prefer this way, as it is conceptually a bit simpler than the iterative algorithm you've implemented in another patch.



================
Comment at: COFF/Writer.cpp:369-371
+  int64_t Diff = S - P - 4;
+  Diff = abs(Diff);
+  Diff += Margin;
----------------
I'd write these three lines one line.


================
Comment at: COFF/Writer.cpp:385
+static std::pair<Defined *, bool>
+getThunk(DenseMap<uint64_t, Defined *> &LastThunks, Defined *Target, uint64_t P,
+         uint16_t Type, int Margin) {
----------------
The relationship between section and its thunk is 1:N. I believe that's why you are using a map to manage thunk -> symbol mapping.

However, I think you visit sections in the increasing address order, so if the last thunk is not reachable, no other thunks are reachable. Can you use the fact?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D52156





More information about the llvm-commits mailing list