There are a few cases where we have almost duplicated code.
This patches fixes the simplest: the finalize and write of dynamic section. Right now they have to have exactly the same structure to decide if a DT_* entry is needed and then to actually write it.
We cannot just write it to a std::vector in the first pass since addresses have not been computed yet.
It is better to describe a bit more detail. Because only this DynamicSection adds strings to DynStrTab, we can compute the size of DynStrTab early in this function, and that helps us to fill DT_STRSZ field in this function.