Previously we put orphans to the end. Patch implements simple heuristic instead.
Each orphan is placed after the last section in sequence with the same access
attributes.
Testcase is provided to show the behavior.
Currently it looks the same or very close to what ld do.
Let's name this getPermissions as this is RWX permissions.