[lld] r264181 - [LTO] Keep linkonce symbols when required.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 26 11:38:44 PDT 2016
On Wed, Mar 23, 2016 at 11:52 AM, Rui Ueyama <ruiu at google.com> wrote:
> On Wed, Mar 23, 2016 at 7:41 PM, Davide Italiano via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: davide
>> Date: Wed Mar 23 13:41:48 2016
>> New Revision: 264181
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=264181&view=rev
>> Log:
>> [LTO] Keep linkonce symbols when required.
>>
>> Similarly to how we do with linkonce_odr symbols already, but
>> change their linkage to weak.
>>
>> Added:
>> lld/trunk/test/ELF/lto/Inputs/linkonce.ll
>> lld/trunk/test/ELF/lto/linkonce.ll
>> Modified:
>> lld/trunk/ELF/LTO.cpp
>>
>> Modified: lld/trunk/ELF/LTO.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=264181&r1=264180&r2=264181&view=diff
>>
>> ==============================================================================
>> --- lld/trunk/ELF/LTO.cpp (original)
>> +++ lld/trunk/ELF/LTO.cpp Wed Mar 23 13:41:48 2016
>> @@ -85,8 +85,16 @@ void BitcodeCompiler::add(BitcodeFile &F
>> if (!BitcodeFile::shouldSkip(Sym)) {
>> if (SymbolBody *B = Bodies[BodyIndex++])
>> if (&B->repl() == B && isa<DefinedBitcode>(B)) {
>> - if (GV->getLinkage() == llvm::GlobalValue::LinkOnceODRLinkage)
>> + switch (GV->getLinkage()) {
>> + default:
>> + break;
>> + case llvm::GlobalValue::LinkOnceAnyLinkage:
>> + GV->setLinkage(GlobalValue::WeakAnyLinkage);
>> + break;
>> + case llvm::GlobalValue::LinkOnceODRLinkage:
>> GV->setLinkage(GlobalValue::WeakODRLinkage);
>> + break;
>> + }
>> Keep.push_back(GV);
>
>
> Can you reduce the indentation? I think you can do this.
>
r264518. Thanks!
--
Davide
"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
More information about the llvm-commits
mailing list