[PATCH] D24670: Fix unresolved linker symbols from misplaced extern definitions
Chuck Atkins via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 26 07:27:11 PDT 2016
ping?
----------
Chuck Atkins
Staff R&D Engineer, Scientific Computing
Kitware, Inc.
(518) 881-1183
On Wed, Sep 21, 2016 at 11:21 AM, Chuck Atkins <chuck.atkins at kitware.com>
wrote:
> chuckatkins updated this revision to Diff 72047.
> chuckatkins added a comment.
>
> Fix unresolved linker symbols from un-namespaced extern definitions
>
> When LCSSAID and LoopSimplifyID are declared extern inside a function body,
> some linkers will fail to resolve the actual symbols defined in the llvm
> namespace. By removing the function local extern declarations and moving
> them to outside the function body, the symbols can be properly resolved.
> This is specifically an issue when building with the Intel compiler.
>
>
> https://reviews.llvm.org/D24670
>
> Files:
> lib/Transforms/Utils/LoopUtils.cpp
>
> Index: lib/Transforms/Utils/LoopUtils.cpp
> ===================================================================
> --- lib/Transforms/Utils/LoopUtils.cpp
> +++ lib/Transforms/Utils/LoopUtils.cpp
> @@ -929,6 +929,14 @@
> return UsedOutside;
> }
>
> +// We locally access their IDs for LoopSimplify and LCSSA here because
> +// users shouldn't directly get them from this header.
> +namespace llvm
> +{
> + extern char &LoopSimplifyID;
> + extern char &LCSSAID;
> +}
> +
> void llvm::getLoopAnalysisUsage(AnalysisUsage &AU) {
> // By definition, all loop passes need the LoopInfo analysis and the
> // Dominator tree it depends on. Because they all participate in the
> loop
> @@ -938,10 +946,7 @@
> AU.addRequired<LoopInfoWrapperPass>();
> AU.addPreserved<LoopInfoWrapperPass>();
>
> - // We must also preserve LoopSimplify and LCSSA. We locally access
> their IDs
> - // here because users shouldn't directly get them from this header.
> - extern char &LoopSimplifyID;
> - extern char &LCSSAID;
> + // We must also preserve LoopSimplify and LCSSA.
> AU.addRequiredID(LoopSimplifyID);
> AU.addPreservedID(LoopSimplifyID);
> AU.addRequiredID(LCSSAID);
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160926/5f006d3f/attachment.html>
More information about the llvm-commits
mailing list