This is an archive of the discontinued LLVM Phabricator instance.

[LTO] Don't apply LTOPostLink module flag during writeMergedModule
ClosedPublic

Authored by steven_wu on Jul 28 2020, 12:35 PM.

Details

Summary

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

Diff Detail

Event Timeline

steven_wu created this revision.Jul 28 2020, 12:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2020, 12:35 PM
steven_wu requested review of this revision.Jul 28 2020, 12:35 PM
This revision is now accepted and ready to land.Aug 26 2020, 10:42 AM