This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Avoid archive member collisions with old API
ClosedPublic

Authored by johanengelen on Sep 17 2017, 9:30 AM.

Details

Summary

ld64 on OSX uses the old ThinLTOCodegenerator API. When two modules have the same name in an archive (valid archive), a name collision happens for the modules' buffer identifiers.
This PR resolves this, by suffixing the module name with an increasing number such that the identifiers are guaranteed to be unique.

For a similar fix in LLD, see https://reviews.llvm.org/D25495

Event Timeline

johanengelen created this revision.Sep 17 2017, 9:30 AM

(I did not know how to test this well, so no test added)

mehdi_amini edited edge metadata.Sep 17 2017, 10:18 AM

LGTM.

Did you check ld64 in Xcode 9? I think ld64 was fixed to append the suffix as well.

mehdi_amini accepted this revision.Sep 17 2017, 10:27 AM
This revision is now accepted and ready to land.Sep 17 2017, 10:27 AM

I did not check Xcode 9 (can't on my current system :/ ).

johanengelen closed this revision.Sep 17 2017, 10:39 AM