Skip to content
Snippets Groups Projects
Commit 5abd4efb authored by Zuzana Baranová's avatar Zuzana Baranová
Browse files

CC: Make ld the default linker and lld optional (with --use-lld).

parent 32d26e98
No related branches found
No related tags found
No related merge requests found
......@@ -83,14 +83,7 @@ namespace divine::cc
ld_args_c.push_back( _ld_args[i].c_str() );
auto ld_job = drv->getJobs( ld_args_c ).back();
if ( _po.use_system_ld )
{
ld_job.args.insert( ld_job.args.begin(), ld_job.name );
auto r = brick::proc::spawnAndWait( brick::proc::CaptureStderr, ld_job.args );
if ( !r )
throw cc::CompileError( "failed to link, ld exited with " + to_string( r ) );
}
else
if ( _po.use_lld )
{
ld_job.args.insert( ld_job.args.begin(), "divcc" );
std::vector< const char * > lld_job_c;
......@@ -102,6 +95,13 @@ namespace divine::cc
if ( !linked )
throw cc::CompileError( "lld failed, not linked" );
}
else
{
ld_job.args.insert( ld_job.args.begin(), ld_job.name );
auto r = brick::proc::spawnAndWait( brick::proc::CaptureStderr, ld_job.args );
if ( !r )
throw cc::CompileError( "failed to link, ld exited with " + to_string( r ) );
}
std::unique_ptr< llvm::Module > mod = link_bitcode();
std::string file_out = _po.outputFile != "" ? _po.outputFile : "a.out";
......
......@@ -100,8 +100,8 @@ namespace divine::cc
po.toObjectOnly = true;
else if ( *it == "-E" )
po.preprocessOnly = true;
else if ( *it == "--use-system-ld" )
po.use_system_ld = true;
else if ( *it == "--use-lld" )
po.use_lld = true;
else if ( *it == "-g" )
po.opts.emplace_back( "-debug-info-kind=standalone" );
else
......
......@@ -37,7 +37,7 @@ namespace divine::cc
bool preprocessOnly = false;
bool hasHelp = false;
bool hasVersion = false;
bool use_system_ld = false;
bool use_lld = false;
};
ParsedOpts parseOpts( std::vector< std::string > rawCCOpts );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment