[PATCH] D25325: [ELF] Change way we place non-scripted (orphan) sections
Rafael Ávila de Espíndola via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 6 10:12:05 PDT 2016
rafael added inline comments.
> Writer.cpp:750
> // non-script sections independently.
> // * Move each non-script section to the first position where it
> // compareSectionsNonScript less than the successor.
This needs to be updated.
> Writer.cpp:772
> + // In such case there are no sections which can share segment with section N.
> + for (auto I = OutputSections.begin(); I != NonScriptI; ++I) {
> + bool Greater = compareSectionsNonScript<ELFT>(*NonScriptI, *I);
This is a bit hard to read. Maybe you can write a lambda that given two candidates decides which one is better for placing the orphan. That way this would be
std:: max_element(I, NonScriptI, [&] (OutputSectionBase<ELFT> *A, OutputSectionBase<ELFT> *B) {
...
}
And if I understand correctly, the logic would be
- Prefer A/B if one can share a PT_LOAD.
- Prefer A/B if the element compares less than one.
- Otherwise prefer the last one.
Repository:
rL LLVM
https://reviews.llvm.org/D25325
More information about the llvm-commits
mailing list