[PATCH] D81429: [COFF] Port CallGraphSort to COFF from ELF

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 14:21:31 PDT 2020


zequanwu marked an inline comment as done and an inline comment as not done.
zequanwu added inline comments.


================
Comment at: lld/Common/CallGraphSort.cpp:187
+  DenseMap<const T *, int> orderMap;
+  int curOrder = INT_MIN;
   for (int leader : sorted)
----------------
MaskRay wrote:
> Why is it `INT_MIN` now?
The order of section is sorted in increasing order, so this does not change the behavior.

Because I reuse the `sortBySectionOrder` of COFF's `/order`option to do sorting (https://github.com/llvm/llvm-project/blob/master/lld/COFF/Writer.cpp#L656). It assigns symbols in the given file priorities starting from `INT_MIN` and non present symbols get priority 0. It also sorts section in increasing order. 
Or I can leave `int curOrder =  1`, but when copying the numbers, subtracting each number by `INT_MIN`. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81429/new/

https://reviews.llvm.org/D81429





More information about the llvm-commits mailing list