[PATCH] D23352: [ELF] - Linkerscript: implemented simple heuristic for placing orphan sections.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 07:18:50 PDT 2016
grimar added a comment.
In https://reviews.llvm.org/D23352#528358, @ruiu wrote:
> Please ping me again once https://reviews.llvm.org/D23866 has landed.
It seems that it will never be landed. If we decide to go with multiple output sections solution so support SHT_MERGE,
there is no more point to do https://reviews.llvm.org/D23866.
So this patch is still uses Factory, what is looks what we want.
================
Comment at: ELF/LinkerScript.cpp:290
@@ +289,3 @@
+ auto R = std::find_if(
+ ScriptConfig->Commands.rbegin(), ScriptConfig->Commands.rend(),
+ [&](std::unique_ptr<BaseCommand> &Base) {
----------------
ruiu wrote:
> Why rbegin and rend? If it doesn't have to be rbegin/rend, use begin/end.
I am searching the last section with the same access attributes to place orphan right after. So I had to search from the end to start.
================
Comment at: ELF/LinkerScript.cpp:302
@@ +301,3 @@
+ // with the same attributes we found earlier.
+ auto Pos = R != ScriptConfig->Commands.rend() ? R.base()
+ : ScriptConfig->Commands.end();
----------------
ruiu wrote:
> What is `base()`?
base() converts reverse iterator to regular:
http://en.cppreference.com/w/cpp/iterator/reverse_iterator/base
https://reviews.llvm.org/D23352
More information about the llvm-commits
mailing list