This patch implements extra output section factory for use in LinkerScript class. It attempts to merge input sections with the same name and different flags. When merge is impossible, error is raised.
See discussion here:
https://reviews.llvm.org/D22683
You moved this and some other code. Was there a reason for that ? It creates some noise in the patch.