[lld] r267045 - Start adding support for internalizing shared libraries.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 13:49:52 PDT 2016


On Thu, Apr 21, 2016 at 1:44 PM, Davide Italiano <davide at freebsd.org> wrote:
> On Thu, Apr 21, 2016 at 1:35 PM, Rafael Espindola via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: rafael
>> Date: Thu Apr 21 15:35:25 2016
>> New Revision: 267045
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=267045&view=rev
>> Log:
>> Start adding support for internalizing shared libraries.
>>
>> Modified:
>>     lld/trunk/ELF/LTO.cpp
>>     lld/trunk/ELF/Symbols.cpp
>>     lld/trunk/ELF/Symbols.h
>>     lld/trunk/ELF/Writer.cpp
>>     lld/trunk/test/ELF/lto/internalize-exportdyn.ll
>>
>> Modified: lld/trunk/ELF/LTO.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=267045&r1=267044&r2=267045&view=diff
>> ==============================================================================
>> --- lld/trunk/ELF/LTO.cpp (original)
>> +++ lld/trunk/ELF/LTO.cpp Thu Apr 21 15:35:25 2016
>> @@ -74,6 +74,17 @@ static void runLTOPasses(Module &M, Targ
>>      saveBCFile(M, ".lto.opt.bc");
>>  }
>>
>> +static bool shouldInternalize(const SmallPtrSet<GlobalValue *, 8> &Used,
>> +                              SymbolBody &B, GlobalValue *GV) {
>> +  if (B.isUsedInRegularObj())
>> +    return false;
>> +
>> +  if (Used.count(GV))
>> +    return false;
>> +
>> +  return !B.includeInDynsym();
>> +}
>> +
>
> Thanks for splitting into this function.
> I just noticed that gold never internalizes if it produces an lld,
> maybe something that can be considered for a next patch.
>

s/produces an lld/produces a relocatable/
Sorry,


-- 
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