For ld64 which uses legacy LTOCodeGenerator, it relies on
writeMergedModule to perform ld -r (generates a linked object file).
If all the inputs to ld -r is fullLTO bitcode, ld64 will linked the
bitcode module, internalize all the symbols and write out another
fullLTO bitcode object file. This bitcode file doesn't have all the
bitcode inputs and it should not have LTOPostLink module flag. It will
also cause error when this bitcode object file is linked with other LTO
object file.
Fix the issue by not applying LTOPostLink flag during writeMergedModule
function. The flag should only be added when all the bitcode are linked
and ready to be optimized.
rdar://problem/58462798