This is an archive of the discontinued LLVM Phabricator instance.

[LLD][COFF] use offset in archive to disambiguate archive members
ClosedPublic

Authored by inglorion on Apr 10 2019, 5:33 PM.

Details

Summary

Archives can contain multiple members with the same name. This would
cause ThinLTO links to fail ("Expected at most one ThinLTO module per
bitcode file"). This change implements the same strategy we use in
the ELF linker: make the offset in the archive part of the module
name so that names are unique.

Diff Detail

Repository
rLLD LLVM Linker

Event Timeline

inglorion created this revision.Apr 10 2019, 5:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 10 2019, 5:33 PM
ruiu added inline comments.Apr 10 2019, 5:36 PM
lld/COFF/InputFiles.h
298 ↗(On Diff #194617)

Do you still need this ctor?

inglorion updated this revision to Diff 194761.Apr 11 2019, 2:24 PM

without second constructor

inglorion marked an inline comment as done.Apr 11 2019, 2:25 PM
inglorion added inline comments.
lld/COFF/InputFiles.h
298 ↗(On Diff #194617)

Alternatively, I could do without this constructor; there is just one call site where I would have to specify the parameters. I liked the constructor version a bit better because it doesn't end up with a bunch of parameters whose meaning is hard to deduce at the call site. I'm happy to go with whichever version you like better.

ruiu accepted this revision.Apr 11 2019, 6:44 PM

LGTM

This revision is now accepted and ready to land.Apr 11 2019, 6:44 PM
This revision was automatically updated to reflect the committed changes.