This diff started as a simple fix for a linker issue (Trac #9314) and ended up with this quite big refactoring to make it easier to ensure that the fix was correct in every case.
To fix the memory consumption issue in the RTS linker (Trac #9314), we fill the mmap'ed pages as much as possible instead of allocating one page per object code section. We obtain huge memory gains (153MB -> 86KB in the test case given in trac Trac #9314). [Startup performance may be better too because of the reduced number of mmap calls (~20k -> 470)]
During the refactoring, I figured out that section alignment constraints were not always correctly handled (iirc, the alignment had to be correct in the object code file in the first place, which is not always the case). Now it should always be correctly handled when we load a section.