[lld] r195596 - [Gnu] Set the type of binary that lld would generate.

Shankar Easwaran shankare at codeaurora.org
Sun Nov 24 20:32:32 PST 2013


On 11/24/2013 10:26 PM, Rui Ueyama wrote:
> On Sun, Nov 24, 2013 at 8:14 PM, Shankar Easwaran
> <shankare at codeaurora.org>wrote:
>
>> Author: shankare
>> Date: Sun Nov 24 22:14:38 2013
>> New Revision: 195596
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=195596&view=rev
>> Log:
>> [Gnu] Set the type of binary that lld would generate.
>>
>> This is needed before any of the search paths are searched for.
>>
>> Added:
>>      lld/trunk/test/elf/X86_64/staticlib-search.test
>> Modified:
>>      lld/trunk/lib/Driver/GnuLdDriver.cpp
>>
>> Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=195596&r1=195595&r2=195596&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
>> +++ lld/trunk/lib/Driver/GnuLdDriver.cpp Sun Nov 24 22:14:38 2013
>> @@ -158,12 +158,6 @@ bool GnuLdDriver::parse(int argc, const
>>     bool asNeeded = false;
>>     bool _outputOptionSet = false;
>>
>> -  // Create a dynamic executable by default
>> -  ctx->setOutputELFType(llvm::ELF::ET_EXEC);
>> -  ctx->setIsStaticExecutable(false);
>> -  ctx->setAllowShlibUndefines(false);
>> -  ctx->setUseShlibUndefines(true);
>> -
>>     int index = 0;
>>
>>     // Set sys root path.
>> @@ -176,17 +170,23 @@ bool GnuLdDriver::parse(int argc, const
>>          it != ie; ++it)
>>       ctx->addSearchPath((*it)->getValue());
>>
>> -  // Process all the arguments and create Input Elements
>> -  for (auto inputArg : *parsedArgs) {
>> -    switch (inputArg->getOption().getID()) {
>> -    case OPT_mllvm:
>> -      ctx->appendLLVMOption(inputArg->getValue());
>> -      break;
>> +  // Create a dynamic executable by default
>> +  ctx->setOutputELFType(llvm::ELF::ET_EXEC);
>> +  ctx->setIsStaticExecutable(false);
>> +  ctx->setAllowShlibUndefines(false);
>> +  ctx->setUseShlibUndefines(true);
>
> You might want to move this to ELFLinkingContext as default values, so that
> you don't need to explicitly set them in the driver by hand. I'd think
> making the linking context to have a reasonable set of default value would
> make sense (and for other attributes we do that).
Agree. Will do that. Thanks for pointing that out.

Thanks

Shankar Easwaran

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation




More information about the llvm-commits mailing list