[PATCH] D56325: Sort symbols in .bss by size.

Vic Yang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 12:56:41 PST 2019


victoryang added inline comments.


================
Comment at: lld/ELF/Writer.cpp:1249
+  // number of dirty pages at runtime.
+  if (Name == ".bss")
+    Sec->sort([](InputSectionBase *S) { return S->getSize(); });
----------------
pcc wrote:
> I wonder whether we should do this for all `SHF_WRITE` sections. I can see similar logic applying to `.data` for example.
For .data section specifically, the logic does apply, and I saw more memory saving when I sorted .bss+.data vs only .bss on Android. Applying this to all SHF_WRITE sections should be fine. It is possible that sorting results in no memory save at all in the worst case, but that shouldn't be a problem.


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

https://reviews.llvm.org/D56325





More information about the llvm-commits mailing list