This is an archive of the discontinued LLVM Phabricator instance.

[windows-itanium] Propagate DLL storage class to Initialisation Guard Variables
ClosedPublic

Authored by bd1976llvm on Nov 21 2022, 5:04 PM.

Details

Summary

Initialisation Guard Variables should take their DLL storage class from the guarded variable. Otherwise, there will be a link error if the compiler inlines a reference to the guard variable into another module but that guard variable is not exported from the defining module.

This is required for platforms such as PlayStation and windows-itanium, that are aiming for source compatibility with MSVC w.r.t. dllimport/export annotations, given Clang's existing design which allows for inlining of a dllimport function as long as all the variables/functions referenced are also marked dllimport.

A similar change exists for the MSVC ABI: https://reviews.llvm.org/D4136.

I have added a run test for windows-itanium for this issue to the build recipe: https://reviews.llvm.org/D88124.

Diff Detail

Event Timeline

bd1976llvm created this revision.Nov 21 2022, 5:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 5:04 PM
bd1976llvm requested review of this revision.Nov 21 2022, 5:04 PM

The change itself seems fine, but the CI failure seems related to this change.

bd1976llvm edited the summary of this revision. (Show Details)

Fix for test failure on *nix.

The change itself seems fine, but the CI failure seems related to this change.

Thanks. There's been renewed interest in using DLLs with C++ interfaces so we should, hopefully, be able to put some effort into improving the support.

compnerd accepted this revision.Nov 23 2022, 7:44 AM
This revision is now accepted and ready to land.Nov 23 2022, 7:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2022, 4:24 PM