The Mach-O format makes extensive use of embedded addends,
particularly for x86_64. This makes ICF's job a bit more difficult:
sections that are otherwise semantically identical may have different
raw bytes due to the embedded addends. Hashing and comparing the raw
bytes naively means that we miss folding opportunities.
This diff canonicalizes these sections by writing over those embedded
addends with zeros. In order to make this possible, the our previously
read-only MemoryBuffers need to be made into copy-on-write.
This requires some awkward casts, but I'm not sure there's a better way to do
things...
clang-tidy: warning: invalid case style for variable 'buf' [readability-identifier-naming]
not useful