This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Propagate dllexport to thunks
ClosedPublic

Authored by smeenai on Jun 29 2017, 5:04 PM.

Details

Summary

Under Windows Itanium, we need to export virtual and non-virtual thunks
if the functions being thunked are exported. These thunks would
previously inherit their dllexport attribute from the declaration, but
r298330 changed declarations to not have dllexport attributes. We
therefore need to add the dllexport attribute to the definition
ourselves now.

Diff Detail

Repository
rL LLVM

Event Timeline

smeenai created this revision.Jun 29 2017, 5:04 PM
compnerd accepted this revision.Jun 29 2017, 5:06 PM
This revision is now accepted and ready to land.Jun 29 2017, 5:06 PM
This revision was automatically updated to reflect the committed changes.
rnk added a subscriber: rnk.Jun 30 2017, 9:03 AM

This appears to affect our behavior under the MS ABI. We still seem to use this logic from CGVTables, even though that code is primarily Itanium related. In http://crbug.com/738468 we're seeing the LNK4102 linker warning, which says: "export of deleting destructor (name); image may not run correctly". You might want to take a look at that warning and reconsider whether this is something you want to do or not. MSVC makes it possible to allocate objects in different DLLs with different allocators, pass them across DLL boundaries, and deallocate them correctly if they are deleted through the vtable.

I'm going to revert for now to fix things.

Sorry about the breakage. I'll redo this limiting it to windows-itanium (and add a comment explaining why we want it).