I noticed that logic of PT_LOADs creation when script is used in gnu linekrs is different from what we have now.
For example ld seems to create 2 PT_LOADs. In first one it puts all sections before first writable, it is text load,
and also it has data load where all sections after and including first writable are placed.
FreeBSD script seems to rely on this logic, and also it seems to be clear and simple, so patch implements the same.
Alternative to this can be solution to force align to memory page boundary of sections with different flags.
That is the same we do for non-LS case. This method also can help to avoid unaligned segments.
What if the current section is writable and NewFlags are not writable? This code seems to merge them, but is it the right thing to do?