[PATCH] D19267: ModuleLinker: Do not import linkonce/weak as "external_weak"

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 19 09:08:33 PDT 2016


LGTM


On 19 April 2016 at 11:49, Mehdi AMINI <mehdi.amini at apple.com> wrote:
> joker.eph created this revision.
> joker.eph added a reviewer: rafael.
> joker.eph added subscribers: tejohnson, llvm-commits.
>
> There is no reason to have a weak reference because the external
> definition will be weak.
>
> http://reviews.llvm.org/D19267
>
> Files:
>   lib/Linker/IRMover.cpp
>   test/Linker/comdat14.ll
>
> Index: test/Linker/comdat14.ll
> ===================================================================
> --- test/Linker/comdat14.ll
> +++ test/Linker/comdat14.ll
> @@ -5,5 +5,5 @@
>  @v = global i32 0, comdat ($c)
>
>  ; CHECK: @v = global i32 0, comdat($c)
> -; CHECK: @v2 = extern_weak dllexport global i32
> -; CHECK: @v3 = extern_weak global i32
> +; CHECK: @v2 = external dllexport global i32
> +; CHECK: @v3 = external global i32
> Index: lib/Linker/IRMover.cpp
> ===================================================================
> --- lib/Linker/IRMover.cpp
> +++ lib/Linker/IRMover.cpp
> @@ -617,8 +617,7 @@
>
>    if (ForDefinition)
>      NewGV->setLinkage(SGV->getLinkage());
> -  else if (SGV->hasExternalWeakLinkage() || SGV->hasWeakLinkage() ||
> -           SGV->hasLinkOnceLinkage())
> +  else if (SGV->hasExternalWeakLinkage())
>      NewGV->setLinkage(GlobalValue::ExternalWeakLinkage);
>
>    NewGV->copyAttributesFrom(SGV);
>
>


More information about the llvm-commits mailing list