[PATCH] D12459: Implement selective bitcode linking and internalization of linked symbols

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 18:45:53 PDT 2015


> On 2015-Aug-28, at 16:49, Artem Belevich <tra at google.com> wrote:
> 
> tra updated this revision to Diff 33496.
> tra added a comment.
> 
> Removed changes included by mistake.
> 
> 
> https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D12459&d=BQIFaQ&c=eEvniauFctOgLOKGJOplqw&r=vftFLnHiqThJHdL0qZWd_Vo12qdMVOZDFnNVBhP9GKA&m=PKL2IuOfJnWB2-AdFlWVD-dRggL3xbPmKtlr6_HirP4&s=sjGKqOnMoiP1gQJd-fjNNojV5DtyLfVqxr7yejH8IBw&e= 
> 
> Files:
>  include/llvm/Linker/Linker.h
>  lib/Linker/LinkModules.cpp
>  test/Linker/Inputs/linkage.c.ll
>  test/Linker/link-flags.ll
>  tools/llvm-link/llvm-link.cpp
> 
> <D12459.33496.patch>

LGTM with a nitpick below.

> Index: tools/llvm-link/llvm-link.cpp
> ===================================================================
> --- tools/llvm-link/llvm-link.cpp
> +++ tools/llvm-link/llvm-link.cpp
> @@ -1249,6 +1260,11 @@
>  bool ModuleLinker::linkGlobalValueBody(GlobalValue &Src) {
>    Value *Dst = ValueMap[&Src];
>    assert(Dst);
> +  if (shouldInternalizeLinkedSymbols())
> +    if (auto *DGV = dyn_cast<GlobalValue>(Dst)) {
> +      DGV->setVisibility(GlobalValue::DefaultVisibility);

Isn't visibility set to 'default' by `setLinkage()`?

> +      DGV->setLinkage(GlobalValue::InternalLinkage);
> +    }
>    if (auto *F = dyn_cast<Function>(&Src))
>      return linkFunctionBody(cast<Function>(*Dst), *F);
>    if (auto *GVar = dyn_cast<GlobalVariable>(&Src)) {



More information about the llvm-commits mailing list