This uses an extra array so that we only have to do a hash lookup per entry.
Unfortunately, this actually slows down a clang link a bit (from 0.497803521 to 0.499284172 seconds). It looks like at least in clang there are not that many references to SHF_MERGE entries for the extra memory allocation to be beneficial.
We could try allocating the offsets in the end of MergeInputSection, but that seems a bit much for now.
My suggestion would be to revisit this once SHF_STRINGS is implemented.