<p dir="ltr">If at all possible I would frame that in terms of the existing comparison function.</p>
<p dir="ltr">Do you want to give it a try or would be able to test a patch if I wrote one?</p>
<p dir="ltr">Cheers,<br>
Rafael</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 22, 2016 11:20 AM, "Eugene Leviant" <<a href="mailto:evgeny.leviant@gmail.com">evgeny.leviant@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yep, for the very first version I'd find last allocatable section with<br>
same access specifier (R/W/X), and insert orphan section after.<br>
I think George attempted to do something like this already.<br>
<br>
<a href="https://reviews.llvm.org/D23352" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D23352</a><br>
<br>
2016-09-22 18:02 GMT+03:00 Rafael Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>>:<br>
> On 22 September 2016 at 09:40, Eugene Leviant <<a href="mailto:evgeny.leviant@gmail.com">evgeny.leviant@gmail.com</a>> wrote:<br>
>>> Do you have an example?<br>
>><br>
>> PHDRS { kernel  PT_LOAD; }<br>
>><br>
>> SECTIONS {<br>
>>   .rwx : { *(.rwx) } : kernel<br>
>>   .ro : { *(.ro) } : kernel<br>
>> }<br>
>><br>
>> If you place any ro orphan section to the beginning of the list,<br>
>> you'll create extra PT_LOAD. In my case you'll get unbootable kernel<br>
>> :-)<br>
>><br>
>><br>
>> I'm pretty sure (although I can't prove that) that putting orphan<br>
>> section after the last scripted section with compatible attributes<br>
>> will do a better job.<br>
><br>
> I see. Right now we put the orphan section it the first position such<br>
> that they compare less than the section that follows.<br>
><br>
> You suggestion in to put them in the last position such that they<br>
> don't compare less than the section that precedes them, is that<br>
> correct?<br>
><br>
> Cheers,<br>
> Rafael<br>
</blockquote></div></div>