[PATCH] D55679: Place .text.hot section before .text.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 13 16:57:33 PST 2018


pcc added a comment.

Thanks for the explanation.

It may seem like a trivial change now, but changes like this add up and may result in increased complexity later (e.g. suppose that we wanted to add an `--output-section-ordering-file` feature; this would need to interact somehow with this change), and once you start emulating another linker like this it can be difficult to undo the change since you don't know who might be unintentionally depending on the emulation. Unless there's evidence that more programs are relying on this assumption I think it's premature to code it into the linker.

I also consider it a bug for ChromeOS to make this assumption. This isn't the first lld transition issue we've seen whose root cause turned out to be an incorrect assumption. Can't you change ChromeOS so that instead of assuming that the first few pages are hot it just moves the pages covered by `.text.hot` into hugepages? It's possible to use a linker script to get the address of the start and end of `.text.hot`. See for example:
https://cs.chromium.org/chromium/src/base/android/library_loader/anchor_functions.lds
and how the symbols defined by that file are used.

Assuming that this is the code that implements hugepages:
https://cs.chromium.org/chromium/src/chromeos/hugepage_text/hugepage_text.cc
it would seem to result in simplifying the code a little as well.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D55679





More information about the llvm-commits mailing list