[llvm-bugs] [Bug 33527] New: Add a flag to force the llvm::Linker to import of Global Intrinsic Variables

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 20 08:53:32 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33527

            Bug ID: 33527
           Summary: Add a flag to force the llvm::Linker to import of
                    Global Intrinsic Variables
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Linker
          Assignee: unassignedbugs at nondot.org
          Reporter: benoit.belley at autodesk.com
                CC: llvm-bugs at lists.llvm.org

We are suggesting adding a flag to the llvm::Linker to force to import global
intrinsic variables. 

The usage scenario for using this flag goes as follows:

  1. A front-end generates an LLVM module.

  2. A small runtime support library is linked-in. The runtime
     library is distributed as bitcode. It is generated using "clang++
     -emit-llvm' and 'llvm-link'. This allows LTO to kick-in and
     functions from the runtime support library become candidates for
     inlining. This is the desired effect.

  3. The resulting LLVM module is compiled and dynamically loaded.

The issue is with the Linker::LinkOnlyNeeded flag. Using it has a huge
positive impact on link and compilation time :-). But, it causes the
@llvm.global_ctors and @llvm.global_dtors references from the
linked-in modules to be discarded :-(. AFAICT, the Linker code assumes
ThinLTO when the LinkOnlyNeeded flags is specified, and full-LTO
otherwise.

To resolve this, we are suggesting adding an extra flag, namely
Linker::ImportGlobalIntrinsicVariables to specify that the global intrinsic
variables of the source module should be imported into the destination module.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170620/c7d592e6/attachment.html>


More information about the llvm-bugs mailing list