Large COFF section names are moved into the string table and the section header field is the offset into the string table encoded in ASCII for offset smaller than 7 digits and in base64 for larger offsets.
The operation of taking the string table offsets is done in a few places in the codebase, so it is helpful to move this operation into BinaryFormat so that it can be shared everywhere it's done.
So this patch takes the implementation of this operation from llvm/lib/MC/WinCOFFObjectWriter.cpp and moves it into BinaryFormat.
This is a prerequisite for https://reviews.llvm.org/D118692 that fixes an issue where llvm-objcopy was implementing this encoding operation incorrectly.
NameSize isn't referenced anywhere in this signature - I have to go a long way to find what it refers to. Perhaps replace NameSize with the NameSize constant value or something to that effect?