Simplify MergeOutputSection.
authorRui Ueyama <ruiu@google.com>
Fri, 18 Nov 2016 05:05:43 +0000 (05:05 +0000)
committerRui Ueyama <ruiu@google.com>
Fri, 18 Nov 2016 05:05:43 +0000 (05:05 +0000)
commit77f2a875759a68c91cb9b2fc82bd6a0ba6eb5581
tree44cff9fc887925abd997f81a3b9bb491d0863e5b
parent37bf5c6a3f31eee7fd95ead38855b081629cf9ca
Simplify MergeOutputSection.

MergeOutputSection class was a bit hard to use because it provdes
a series of finalize functions that have to be called in a right way
at a right time. It also intereacted with MergeInputSection, and the
logic was somewhat entangled between the two classes.

This patch simplifies it by providing only one finalize function.
Now, all you have to do is to call MergeOutputSection::finalize
when you have added all sections to the output section. Then, it
internally merges strings and initliazes StringPiece objects.
I think this is much easier to understand.

This patch also adds comments.

llvm-svn: 287314
lld/ELF/InputSection.cpp
lld/ELF/InputSection.h
lld/ELF/OutputSections.cpp
lld/ELF/OutputSections.h
lld/ELF/Writer.cpp