This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Enable --rtlib option for MSVC target
ClosedPublic

Authored by roman.shirokiy on Feb 19 2016, 8:57 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

roman.shirokiy retitled this revision from to [Driver] Enable --rtlib option for MSVC target.
roman.shirokiy updated this object.
roman.shirokiy added reviewers: rnk, majnemer, beanz, pcc.
roman.shirokiy added a subscriber: cfe-commits.
roman.shirokiy edited reviewers, added: rengolin; removed: pcc.Mar 9 2016, 5:02 AM

For now every native Windows installation of Clang contains small compiler-rt builtins lib (rL261432: [CMake] Add partial support for MSVC in compiler-rt builtins), but there is no specific interface to make use of this lib on Windows. This patch is ought to provide command line option (existing one) for linking compiler-rt builtins lib on user demand.

rengolin edited edge metadata.Mar 9 2016, 8:40 AM

Hi,

The error is very sensible, but I'm not sure why you're adding compiler-rt in the second change. Why is that necessary, and where are the tests for it.

Thanks!
--renato

Hello!

Thanks for the feedback!

MSVC got its own runtime lib, so the function "AddRunTimeLibs" is not used anywhere in "visualstudio::Linker::Constructjob" i.e. "--rtlib" option is currently unused in MSVC environment (there is always a warning: argument unused during compilation').

if (!Args.hasArg(options::OPT_nostdlib)) {
  AddRunTimeLibs(TC, TC.getDriver(), CmdArgs, Args);
}

This change is necessary to actually handle "--rtlib" on MSVC, but I totally agree that test for "-nostdlib --rtlib=compiler-rt" case is missed.

roman.shirokiy edited edge metadata.

Updated diff with the test for "nostdlib" + "rtlib" case.

rnk accepted this revision.Mar 11 2016, 9:00 AM
rnk edited edge metadata.

lgtm

lib/Driver/Tools.cpp
8948 ↗(On Diff #50260)

Can you make sure you didn't change the indentation of this line? It should be two spaces left of the 'break' above.

This revision is now accepted and ready to land.Mar 11 2016, 9:00 AM
This revision was automatically updated to reflect the committed changes.