An archive looks like
<header>
<symbol table>
<tail>
The symbol table refers to offsets in the tail. A complication is that we would like to support symbol tables that use 64 bit offsets if it turns out that any of the offsets is too big.
This patch changes the archive writer to first compute the tail. We cannot just compute one bit StringRef since that would require reading every member upfront, but we can represent it as a series of StringRefs.
Having done that it is much easier to compute the symbol table and all offsets are computed before it is written. With this if there is an accounting problem it will show up with a regular symbol table, not just when a 64 bit one is needed.
This should help simplify D36812.
It looks like you are using StringSaver only to save this member contents. You may be able to remove StringSaver if you change this to std::string.