This is an archive of the discontinued LLVM Phabricator instance.

[COFF] Implement llvm.global_ctors priorities for MSVC COFF targets
ClosedPublic

Authored by rnk on Sep 7 2018, 3:32 PM.

Details

Summary

MSVC and LLD sort sections ASCII-betically, so we need to use section
names that sort between .CRT$XCA (the start) and .CRT$XCU (the default
priority).

In the general case, use .CRT$XCT12345 as the section name, and let the
linker sort the zero-padded digits.

Users with low priorities typically want to initialize as early as
possible, so use .CRT$XCA00199 for prioties less than 200. This number
is arbitrary.

Implements PR38552.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Sep 7 2018, 3:32 PM
rnk edited the summary of this revision. (Show Details)Sep 7 2018, 3:33 PM
smeenai added a subscriber: smeenai.Sep 7 2018, 3:41 PM
majnemer accepted this revision.Sep 7 2018, 3:47 PM

LGTM

This revision is now accepted and ready to land.Sep 7 2018, 3:47 PM
rnk updated this revision to Diff 164534.Sep 7 2018, 4:08 PM
  • beef up test
This revision was automatically updated to reflect the committed changes.