[llvm-bugs] [Bug 38552] New: [Windows] Implement priorities in llvm.global_ctors in MSVC environments

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 13 17:25:06 PDT 2018


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

            Bug ID: 38552
           Summary: [Windows] Implement priorities in llvm.global_ctors in
                    MSVC environments
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: rnk at google.com
                CC: llvm-bugs at lists.llvm.org

The llvm.global_ctors array has three elements in each entry: initializer,
priority, and comdat key.

For Windows-MSVC environments, we do nothing with the priority, we put all
initializers in .CRT$XCU sections here:

static MCSectionCOFF *getCOFFStaticStructorSection(MCContext &Ctx,
                                                   const Triple &T, bool
IsCtor,
                                                   unsigned Priority,
                                                   const MCSymbol *KeySym,
                                                   MCSectionCOFF *Default) {
  if (T.isKnownWindowsMSVCEnvironment() || T.isWindowsItaniumEnvironment())
    return Ctx.getAssociativeCOFFSection(Default, KeySym, 0);

Oops.

It's tricky, becuase we have to turn a number from a name into a string that
sorts alphabetically between XCA and XCU. In particular, XCL is interesting,
because at that point, the CRT runs its initializers.

-- 
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/20180814/358a06e0/attachment-0001.html>


More information about the llvm-bugs mailing list