This is an archive of the discontinued LLVM Phabricator instance.

Add an option to use the MSVC linker to link LTO-generated object files.
ClosedPublic

Authored by ruiu on Feb 3 2017, 6:02 PM.

Details

Summary

This patch defines a new command line option, /MSVCLTO, to LLD.
If that option is given, LLD invokes link.exe to link LTO-generated
object files. This is hacky but useful because link.exe can create
PDB files.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Feb 3 2017, 6:02 PM
pcc added inline comments.Feb 3 2017, 6:24 PM
lld/COFF/DriverUtils.cpp
647 ↗(On Diff #87062)

Should this create a response file instead of passing the arguments directly?

652 ↗(On Diff #87062)

Should this strip all inputs or just bitcode files?

658 ↗(On Diff #87062)

What about /opt:lld*?

lld/COFF/SymbolTable.cpp
354 ↗(On Diff #87062)

Maybe call this something like compileBitcodeFiles?

ruiu updated this revision to Diff 87263.Feb 6 2017, 10:44 AM
  • Updated as per pcc's review comments.
lld/COFF/DriverUtils.cpp
647 ↗(On Diff #87062)

Done.

652 ↗(On Diff #87062)

Strip only bitcode files.

658 ↗(On Diff #87062)

lldmap and lldmap_file are only options that start with lld in COFF.

lld/COFF/SymbolTable.cpp
354 ↗(On Diff #87062)

Done.

pcc added inline comments.Feb 6 2017, 11:00 AM
lld/COFF/DriverUtils.cpp
658 ↗(On Diff #87062)

I was referring to /opt:lldlto=N, /opt:lldltojobs=N and /opt:lldltopartitions=N.

lld/test/COFF/msvclto.ll
3 ↗(On Diff #87263)

Why do you have "not" here? I'd expect this to succeed on Windows.

ruiu updated this revision to Diff 87273.Feb 6 2017, 11:38 AM
  • Updated as per review comments.
ruiu added inline comments.Feb 6 2017, 11:40 AM
lld/COFF/DriverUtils.cpp
658 ↗(On Diff #87062)

Ah. We should skip these options too. Done.

lld/test/COFF/msvclto.ll
3 ↗(On Diff #87263)

We only need to verify the command line arguments passed to MSVC, so I added || true to make this line always succeed.

pcc accepted this revision.Feb 6 2017, 11:57 AM

LGTM

lld/COFF/DriverUtils.cpp
659 ↗(On Diff #87273)

I guess defaultlib flags will always refer to archive files, so you probably don't want to strip them.

This revision is now accepted and ready to land.Feb 6 2017, 11:57 AM
This revision was automatically updated to reflect the committed changes.