[llvm] r322814 - Don't drop dso_local in LTO.

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 09:40:43 PST 2018


On Wed, Jan 17, 2018 at 9:38 PM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: rafael
> Date: Wed Jan 17 21:38:43 2018
> New Revision: 322814
>
> URL: http://llvm.org/viewvc/llvm-project?rev=322814&view=rev
> Log:
> Don't drop dso_local in LTO.
>
> LTO sets dso_local as an optimization, so don't clear it.
>
> This avoid clearing it from undefined hidden symbols, which would then
> fail the verifier.
>
> Added:
>     llvm/trunk/test/LTO/Resolution/X86/setting-dso-local.ll
> Modified:
>     llvm/trunk/lib/LTO/LTO.cpp
>
> Modified: llvm/trunk/lib/LTO/LTO.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LTO/
> LTO.cpp?rev=322814&r1=322813&r2=322814&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/LTO/LTO.cpp (original)
> +++ llvm/trunk/lib/LTO/LTO.cpp Wed Jan 17 21:38:43 2018
> @@ -639,7 +639,8 @@ LTO::addRegularLTO(BitcodeModule BM, Arr
>        }
>
>        // Set the 'local' flag based on the linker resolution for this
> symbol.
> -      GV->setDSOLocal(Res.FinalDefinitionInLinkageUnit);
> +      if (Res.FinalDefinitionInLinkageUnit)
> +        GV->setDSOLocal(Res.FinalDefinitionInLinkageUnit);
>

Why not just set to "true" - since you already checked this flag.
Teresa

     }
>      // Common resolution: collect the maximum size/alignment over all
> commons.
>      // We also record if we see an instance of a common as prevailing, so
> that
>
> Added: llvm/trunk/test/LTO/Resolution/X86/setting-dso-local.ll
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LTO/
> Resolution/X86/setting-dso-local.ll?rev=322814&view=auto
> ============================================================
> ==================
> --- llvm/trunk/test/LTO/Resolution/X86/setting-dso-local.ll (added)
> +++ llvm/trunk/test/LTO/Resolution/X86/setting-dso-local.ll Wed Jan 17
> 21:38:43 2018
> @@ -0,0 +1,15 @@
> +; RUN: llvm-as -o %t.o %s
> +; RUN: llvm-lto2 run -o %t2.o %t.o -r=%t.o,_start,plx -r=%t.o,foobar,x
> +; RUN: llvm-readelf --symbols %t2.o.0 | FileCheck %s
> +
> +; We used to fail the verifier by clearing dso_local from foobar
> +
> +; CHECK:  0000000000000000     0 NOTYPE  GLOBAL HIDDEN   UND foobar
> +
> +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
> +target triple = "x86_64-unknown-linux-gnu"
> +
> + at foobar = external hidden global i32
> +define i32* @_start() {
> +  ret i32* @foobar
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>



-- 
Teresa Johnson |  Software Engineer |  tejohnson at google.com |  408-460-2413
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180118/ddcc9dff/attachment.html>


More information about the llvm-commits mailing list